Download the PHP package effiana/phpunit-test-generator without Composer
On this page you can find all versions of the php package effiana/phpunit-test-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download effiana/phpunit-test-generator
More information about effiana/phpunit-test-generator
Files in effiana/phpunit-test-generator
Package phpunit-test-generator
Short Description Generate PHPUnit test classes for a PHP class.
License MIT
Informations about the package phpunit-test-generator
PHPUnit Test Generator
This PHP tool can generate PHPUnit test classes for your PHP classes.
This tool currently only supports the PSR4 autoloading strategy. If you would like to see it support other autoloading strategies and application organizational structures, pull requests are welcome.
Install
You can also download the latest PHAR from the releases page.
Generate Test Class
Take a class named App\Services\MyService
located in src/Services/MyService.php
:
And a dependency to this class named App\Services\Dependency
located in src/Services/Dependency.php
:
Now you can generate a test class for MyService
with the following command:
You can also pass a path to a class instead of giving the class name:
A test would be generated at tests/Services/MyServiceTest.php
that looks like this:
Now you have a skeleton unit test and you can fill in the defails of the generated methods.
All versions of phpunit-test-generator with dependencies
doctrine/inflector Version ^1.3
nikic/php-parser Version ^4.3
symfony/console Version ^4.1 | ^5.0
symfony/filesystem Version ^4.2 | ^5.0