modulero / cruddy-tests
Cruddy Tests for Laravel
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 0
pkg:composer/modulero/cruddy-tests
Requires
- php: ^7.1
- illuminate/console: 5.5.*|5.6.*|5.7.*|5.8.*
- illuminate/support: 5.5.*|5.6.*|5.7.*|5.8.*
- symfony/console: 3.4.*|4.2.*
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2025-10-19 02:28:34 UTC
README
This package provides an easy way to create CRUD-based feature tests.
Installation
You can install this package via composer using:
composer require --dev modulero/cruddy-tests
The package will automatically register itself.
To publish the config file to config/cruddy-tests.php run:
php artisan vendor:publish --provider="Modulero\CruddyTests\CruddyTestsServiceProvider"
This will publish a file named cruddy-tests.php in your config directory with the following contents:
<?php return [ /* |-------------------------------------------------------------------------- | Default Resource Abilities |-------------------------------------------------------------------------- | | This array of abilities will be used to determine which cruddy tests need | to be created. Feel free to change this into something you want. | */ 'abilities' => [ 'viewAny', 'view', 'create', 'update', 'delete', ], ];
Usage
After you've installed the package and optionally overwritten the values in the config-file, working with this package will be a breeze.
The only thing you need to do is call the artisan command:
php artisan make:cruddy-tests Foo
This will create a folder in the Tests\Feature namespace with the name Foo. In this folder files will be created based on the resource abilities in your config. With the default config it will create these files:
- ViewAnyFooTest
- ViewFooTest
- CreateFooTest
- UpdateFooTest
- DeleteFooTest
Certain resources might not need all the available abilities. In that case you can use the options --only and --except.
php artisan make:cruddy-tests Foo --only=create
php artisan make:cruddy-tests Foo --except=view,delete
You can add multiple abilities through a comma-separated list. The names need to match the ones in your config file. It is not recommended to use both options at the same time. When you do the --only option takes precedence over --except.
Changelog
Please see CHANGELOG for more information about recent changes.
Security
If you discover any security related issues, please email richard@modulero.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.