Skip to content

Test Generator ‚Äč

The Test Generator Command, creates a new test file for the specified module, with a basic blueprint (the code will be commented). To create a new Category test, for the Product Module, you can run the following command:

php artisan modular:make-test Product Category

Or if you are using Laravel Sail, run:

sail artisan modular:make-test Product Category

A new CategoryTest.php file will be created at modules/Product/Tests/CategoryTest.php.

The generated file will contain the following content (uncomment the code to run the example test created for your module):


// use Illuminate\Foundation\Testing\RefreshDatabase;
// use Tests\TestCase;

// uses(TestCase::class, RefreshDatabase::class);

// it('can run the example test', function () {
//     $this->assertTrue(true);
// });