Download the PHP package umc/uutg without Composer
On this page you can find all versions of the php package umc/uutg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package uutg
Ultimate Unit Test Generator (UUTG)
This is a standalone application for generating the boilerplate for unit tests for PHP unit
Story
I like writing unit tests for the code I write. But I don't like writing the same thing over and over again.
So I created this application that does (should do / will hopefully do) the boilerplate for me.
What it does.
It generates a class which extends PHPUnit\Framework\TestCase
and contains
- a
setUp
method where all class dependencies and public method parameters are mocked. - empty methods for each public method in the class where you need to add your tests.
Example
(follow the inline comments in the generated code) For this class and the default profile (see profiles section lower)
it will generate this unit test class
How to configure it
You can create your own configuration file starting from uutg.php.dist and use it instead of the default one. Each element in the configuration file is explained inside uutg.php.dist
How to use it.
You can install if via composer First configure the repository
Then install de library as a dev dependency
if you installed this via composer you can run it via cli
php ./vendor/bin/uutg --class="Class\\NameHere" [--config=path/to/config/file]
- class is the name of the class you want to generate a test for.
- config is the path to the config file for generating the test. if empty, the default uutg.php.dist will be used
if you installed it "manually" you can run it similar to the composer version php ./uutg --class="Class\\NameHere" [--config=path/to/config/file]
but you have to make sure your class can be autoloaded but the script.
FAQs and comments
- "But TDD says you should write the test first and then the class. You are doing it the other way around.". Yes you are right.
- "Will this make me better at unit testing?". No. It will only make you faster.
- "This application does not have unit tests.". Right again.