After 7 years of existence, PhpUnitGen is not maintained anymore. Read the post
The CLI tool can be installed using:
composer require --dev phpunitgen/consoleDetailed information and webapp version are available at https://phpunitgen.io.
Note: this repository contains the webapp code of PhpUnitGen. If you want to use the tool on your console, you can install the command line package. If you want to see the core code, you should go on core package.
PhpUnitGen is an online and command line tool to generate your unit tests' skeletons on your projects.
- Generates tests skeletons for your PHP classes
- Binds with Laravel "make" command
- Generates class instantiation using dummy parameters or mocks
- Adapts to PHPUnit or Mockery mocks generation
PhpUnitGen is not meant to generate your tests content but only the skeleton (except for getters/setters).
This is because inspecting your code to generate the appropriate test is way too complex, and might result in missing some of the code's features or marking them as "passed unit test" even if it contains errors.
You can track the tasks we plan to do on our Taiga.io project.
Please see CONTRIBUTING for more details.
Informal discussion regarding bugs, new features, and implementation of existing features takes place in the Github issue page of Core repository.
Clone this repository and into the project directory:
git clone https://github.com/paul-thebaud/phpunitgen-webapp.git
cd phpunitgen-webappCopy the environment file:
cp .env.example .envInstall backend and frontend dependencies using:
composer install
yarn installBuild the frontend files:
yarn prodRun the local PHP server, and go to http://localhost:8000:
php -S localhost:8000 -t publicdocker build -t phpunitgen-phpfpm -f ./docker/Dockerfile-phpfpmalpine .docker build -t phpunitgen-nginx -f ./docker/local/Dockerfile-nginxalpine .docker build -t phpunitgen-nginx -f ./docker/production/Dockerfile-phpfpmalpine .docker run -d --name phpunitgen-phpfpm -p 9000:9000 -v <root project directory>:/var/wwww phpunitgen-phpfpmdocker run -d --name phpunitgen-nginx -p 80:80 443:443 \
-v <root project directory>/nginx/local/local.pem:/local.pem \
-v <root project directory>/nginx/local/local-key.pem:/local-key.pem \
-v <root project directory>:/var/www \
-v <root project directory>/nginx/local/app.conf:/etc/nginx/conf.d/default.conf \
-v <root project directory>/nginx/nginx.conf:/etc/nginx/nginx.conf \
phpunitgen-nginxdocker run -d --name phpunitgen-phpfpm -p 9000:9000 phpunitgen-phpfpmdocker run -d --name phpunitgen-nginx -p 80:80 443:443 \
-v <root project directory>/nginx/local/local.pem:/local.pem \
-v <root project directory>/nginx/local/local-key.pem:/local-key.pem \
phpunitgen-nginxTo issue local certificates for HTTPS we used https://github.com/FiloSottile/mkcert
You just need to put your local.pem (certificate) and local-key.pem (private key) in the nginx/local/ folder.
On the local dev compose file there're different volumes used to facilitate your local development. You can use "yarn watch" and edit the blade file directly from your local files. However, if you change any php dependencies you will need to rebuild the phpunitgen-phpfpm container.
docker-compose -f ./docker-compose.local.dev.yml up --buildThis compose file will generate two container with less volumes. (Only your local certificates to enable https)
docker-compose -f ./docker-compose.local.prod.yml up --buildkubectl apply -k kubernetes/staging/kubectl apply -k kubernetes/production/PhpUnitGen is an open-sourced software licensed under the MIT license.