mrshk/laravel-test-generator

Laravel package for generating unit test automatically

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/mrshk/laravel-test-generator

1.0.4 2024-07-16 12:43 UTC

This package is auto-updated.

Last update: 2025-10-16 15:28:23 UTC


README

Auto generate the unit test file for the available routes

Installation

The package can easily be installed by running composer require mrshk/laravel-test-generator in your project's root folder.

If you are running a version of Laravel < 5.5 also make sure you add MrShk7\LaravelTestGenerator\TestGeneratorServiceProvider::class to the providers array in config/app.php.

This will register the artisan command that will be available to you.

Usage

Generating the test file is easy, simply run php artisan laravel-test:generate in your project root. This will write all the test cases into the file based on controller.

If you wish to filter for specific routes only, you can pass a filter attribute using --filter, for example php artisan laravel-test:generate --filter='/api'

If you wish to change the directory of creating the test file, you can pass a directory using --dir, for example php artisan laravel-test:generate --dir='V1'

If you wish to add the @depends attribute to all the function except the first function for running test cases synchronously, you can pass a sync attribute using --sync, for example php artisan laravel-test:generate --sync='true'