two-thirds/laravel-test-suite

4.4.0 2020-10-16 11:05 UTC

This package is auto-updated.

Last update: 2024-04-17 00:19:20 UTC


README

pipeline status coverage report

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.