This document describing how you can run tests.
This environment contains the next types of tests:
- Application tests (TODO: Implement it)
- Integration tests (TODO: Implement it)
- Unit tests (TODO: Implement it)
All tests relies to PHPUnit library.
Note 1: Please note that this environment does not use simple phpunit as does Symfony by default, that's why symfony container shell ./bin/phpunit
command is not exist.
Note 2: Application
test === Functional
test, please use naming convention(Application
) as described here.
You can run tests using the following local shell command(s):
make phpunit # Run all tests
After execution above local shell command, you are able to check a code coverage report. Please open reports/coverage/index.html
with your browser.
If you want to run a single test or all tests in specified directory, you can use the next steps:
1.Use next local shell command in order to enter into symfony container shell:
make ssh # Enter symfony container shell
2.Use next symfony container shell command(s) in order to run test(s):
./vendor/bin/phpunit ./tests/Application/Controller/ApiKeyControllerTest.php # Just this single test class
./vendor/bin/phpunit ./tests/Application/Controller/ # All tests in the directory
By default, this environment is using a separate database for testing.
If you need to change separate environment for testing (f.e. change database or another stuff) you need to edit .env.test
file.
You can run tests directly from your IDE PhpStorm. Please follow PhpStorm documentation in order to do it.