two-thirds / laravel-test-suite
Requires
- php: >=7.1.3
- illuminate/support: ^5.4|^6.0|^7.0|^8.0
- symfony/console: ^3.2|4.*|5.*
- symfony/process: ^3.2|4.*|5.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.13
- mockery/mockery: ^1.2
- php-mock/php-mock-phpunit: ^2.1
- phpmd/phpmd: ^2.8
- phpunit/phpunit: ^8.0
- squizlabs/php_codesniffer: ^3.5
- two-thirds/artisan-anywhere: ^2.0
README
Add Laravel Test Suite to your project to make it easy to run your testing tools directly from Artisan. Once installed, just run php artisan test
. Out of the box it automatically detects and runs phpunit ( with or without code coverage ), Laravel dusk, php-cs-fixer and php mess detector.
I welcome any additional tools or bugfixes via pull / merge request.
Installation
Composer
Laravel Test Suite can be installed through composer:
composer require --dev two-thirds/laravel-test-suite
Register service provider
If you are using Laravel 5.5 or greater, the service provider will be loaded automatically. If using 5.4, add the following to the providers
array of config/app.php
:
TwoThirds\TestSuite\TestSuiteServiceProvider::class,
Publishing config (optional)
Laravel Test Suite comes with a sane set of defaults out of the box but if you want to customize how any of the suites are ran, you can publish to your project:
php artisan vendor:publish --tag=laravel-test-suite
Test your code
Simply run php artisan test
to run the whole test suite against your codebase.
Tests can be run individually as well:
php artisan test:phpunit
php artisan test:dusk
php artisan test:php-cs-fixer
php artisan test:phpmd
Running Dusk in non-headless mode
Sometimes it can be useful to be able to see your dusk tests as they execute, for troubleshooting purposes. This package makes it really easy to do that using the --show
flag, however you need to make a small change to the DuskTestCase::driver
method:
protected function driver()
{
$options = (new ChromeOptions())->addArguments([
'--disable-gpu', // Remove the '--headless' option from this array
'--no-sandbox',
'--window-size=1920,1080',
]);
// Add this section
if (! env('DUSK_DISABLE_HEADLESS', false)) {
$options->addArguments(['--headless']);
}
...
}
Then, you simply run php artisan test:dusk --show
to see the chrome instance running in the foreground.