This way will run next tests:
- Static tests, including PHPMD and PHPCS
- All unit tests
- Code coverage test
This is the best way to run tests locally.
- Navigate to working directory
- Run
composer test:all
and verify results
To run unit tests, specify the configuration file in the following command:
./vendor/bin/phpunit --configuration tests/unit
- Run PHPCS test with following command:
./vendor/bin/phpcs src --standard=tests/static/phpcs-ruleset.xml -p -n
- Run PHPMD tests with following command:
./vendor/bin/phpmd src xml tests/static/phpmd-ruleset.xml
This test will generate a pretty report for unit test coverage.
- Run the command
composer test:coverage
- Observe result in CLI output
- Be sure to enable xDebug for this test
This test will generate a pretty report for unit test coverage.
- Run the command
composer test:coverage-generate
- Navigate to
tests/unit/tmp/coverage
and openindex.html
file in browser
- Be sure to enable xDebug for this test
- After you setup PhpStorm with PhpUnit and PHPCS, etc, it sometimes runs really slow. But, there is an icon in the bottom right corner of PhpStorm you can click on (it looks like Travis) that will let you temporarily disable inspections.