Real time testing

Just when you need a real time testing like npm run watch this is the stuff

composer require spatie/phpunit-watcher --dev

Usage :
vendor/bin/phpunit-watcher watch

Running Artisan migrate Fresh after each test

after reading this , I tried to make the same steps turns out it didn't work, So I tinkered around and add it in createsApplication an now it works


namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\Artisan;

trait CreatesApplication
     * Creates the application.
     * @return \Illuminate\Foundation\Application

    protected static $setUpHasRunOnce = false;
    public function createApplication()
        $app = require __DIR__.'/../bootstrap/app.php';

        if (!static::$setUpHasRunOnce) {
                ['--class' => 'DatabaseSeeder']
            static::$setUpHasRunOnce = true;

        return $app;

Make the test pretty

vendor/bin/phpunit tests/Unit/  --testdox