PHPUnit examples in support of my blog:
https://neerajdas.com/blog/getting-started-with-phpunit
Setup:
- Clone / Download: https://github.com/nkdas91/Getting-started-with-PHPUnit.git
- Copy
env.example.php
toenv.php
and replace default values. - Create a DB
phpunit
and importsql/phpunit.sql
- Update
ABSOLUTE_PATH_TO_DOCUMENT_ROOT
inphpunit.xml
. - Run
composer install
in the root directory. - Run
XDEBUG_MODE=coverage ./vendor/bin/phpunit
to run unit tests and generate Code Coverage.