Skip to content

Create Test Laravel ​

Generate a PHPUnit feature or unit test stub inside a module.

Command Information ​

  • Signature: modularous:make:laravel:test {module} {test} [--unit]
  • Aliases: modularous:create:laravel:test
  • Category: Generators

Arguments ​

ArgumentRequiredDescription
moduleYesThe module name the test belongs to (e.g. Blog)
testYesThe test class name (e.g. PostCreationTest)

Options ​

OptionDefaultDescription
--unitfalseGenerate a unit test instead of a feature test

Examples ​

bash
# Generate a feature test
php artisan modularous:make:laravel:test Blog PostCreationTest

# Generate a unit test
php artisan modularous:make:laravel:test Blog PostSlugTest --unit

Output ​

Generates the test file inside the target module:

Modules/Blog/Tests/Feature/PostCreationTest.php
# or with --unit:
Modules/Blog/Tests/Unit/PostSlugTest.php

The stub extends Tests\TestCase and includes a single placeholder test_example() method.