If you have not been writing any tests for your Laravel app, and need a way to scaffold your integration tests, this tool is for you.
- Generator scans your registered routes
- Generates Test for each controller
- Generates stubs for each one of your controller actions
- You will need to then fill in the stubs with whatever logic your app needs.
<?php
namespace Tests\Amazing\Dashboard\DashboardTest;
use Tests\TestCase;
class DashboardTest extends TestCase
{
/** @see \App\Http\Controllers\Dashboard\DashboardController::index() */
public function test_get_dashboard_index()
{
//$response = $this->get(route('dashboard.index', []));
//$response->assertOk();
}
////
}
composer require --dev boggybot/laravel-test-generator
php artisan generate:tests
By default, any matching registered route in the current project namespace qualifies. eg. App\
You can change which namespace for generator to scan.
php artisan generate:tests --app-namespace="AwesomeApp"
By default, all tests will be written to 'tests/Acceptance' folder.
php artisan generate:tests --test-namespace="Tests\FeatureTests"
php artisan vendor:publish --tag=laravel-test-generator-stubs