Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

PhpUnitGen is a online tool to generate your unit tests' skeletons on your projects.

License

Notifications You must be signed in to change notification settings

paul-thebaud/phpunitgen-webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhpUnitGen

Build Status StyleCI Quality Gate Status Coverage

⚠️ PhpUnitGen end of life

After 7 years of existence, PhpUnitGen is not maintained anymore. Read the post

Installation

The CLI tool can be installed using:

composer require --dev phpunitgen/console

Detailed information and webapp version are available at https://phpunitgen.io.

About PhpUnitGen

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.

Key features

  • 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.

Roadmap

You can track the tasks we plan to do on our Taiga.io project.

Contributing

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.

Installing the application locally

Clone this repository and into the project directory:

git clone https://github.com/paul-thebaud/phpunitgen-webapp.git

cd phpunitgen-webapp

Copy the environment file:

cp .env.example .env

Install backend and frontend dependencies using:

composer install

yarn install

Build the frontend files:

yarn prod

Run the local PHP server, and go to http://localhost:8000:

php -S localhost:8000 -t public

Build docker images

PHP-fpm

docker build -t phpunitgen-phpfpm -f ./docker/Dockerfile-phpfpmalpine .

Nginx local

docker build -t phpunitgen-nginx -f ./docker/local/Dockerfile-nginxalpine .

Nginx production

docker build -t phpunitgen-nginx -f ./docker/production/Dockerfile-phpfpmalpine .

Run docker images

PHP-fpm local

docker run -d --name phpunitgen-phpfpm -p 9000:9000 -v <root project directory>:/var/wwww phpunitgen-phpfpm

Nginx local

docker 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-nginx

PHP-fpm production

docker run -d --name phpunitgen-phpfpm -p 9000:9000 phpunitgen-phpfpm

Nginx production

docker 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-nginx

Installing the application with docker-compose

HTTPS

To 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.

Development

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 --build

Production-like (Used to test on with an environment near the production architecture)

This 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 --build

Installing with kubernetes

Staging

kubectl apply -k kubernetes/staging/

Production

kubectl apply -k kubernetes/production/

Credits

License

PhpUnitGen is an open-sourced software licensed under the MIT license.

About

PhpUnitGen is a online tool to generate your unit tests' skeletons on your projects.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published