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:

bash
php 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):

php
<?php

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

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

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