DEV Community

Cover image for PhpUnitGen, testing, the new way!
Paul Thébaud
Paul Thébaud

Posted on • Edited on

PhpUnitGen, testing, the new way!

You are part of the very exclusive club of PHP developers and you inflict yourself swirls of copy/paste to satisfy PHPUnit?
Unit tests haunt you even in your nightmares?

PhpUnitGen has been designed to make your nights sweater and your apps better tested!

What is PhpUnitGen?

PhpUnitGen is a development tool for PHP 7.1 and up, which allows you to generate PHPUnit tests skeletons.

The project started in 2017. The first version, named phpunit-generator was released in 2018.

Here are some of the main features:

  • Detects classes and traits, and instantiates them appropriately.
  • Instantiate/mock the classes/traits object/scalar dependencies.
  • Automatically generates tests for getter/setter methods.
  • Binds with Laravel 5.8+ and the php artisan make command.
  • Free web application and Restful API.

I started working on a brand new version in 2019, and it is now time to release it!

It is more modular, better coded and has new features.
The web application has been totally revised too, and is now working with Laravel Lumen and VueJS/Typescript.

How to use it?

There are many ways of using PhpUnitGen: web application, command line, PHP code and even the Restful API.

All those possibilities are described in the web application, phpunitgen.io.

TL;DR

PhpUnitGen is a tool to generate your PHP unit tests skeletons.

Just checkout the phpunitgen.io website to quickly try the tool.

Top comments (4)

Collapse
 
ayusopatricia profile image
Patricia Ayuso

It looks awesome Paul. Thanks!

Collapse
 
paulthebaud profile image
Paul Thébaud

Thanks a lot!

Collapse
 
sjoller profile image
Mads Jensen • Edited

This looks interesting.
I'm not well versed in writing tests, so I'm not really sure what goes into the Tests\\TestCase file. Could you elaborate or point me in direction of further reading?

Collapse
 
vilaincorentin profile image
Corentin Vilain

Very impressive and very useful! <3