Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.16 KB

testing.md

File metadata and controls

53 lines (39 loc) · 2.16 KB

Testing

This document describing how you can run tests within this environment.

General

This environment contains next types of tests:

  • Application tests
  • Integration tests
  • Unit tests

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.

Commands to run tests

You can run tests using following local shell command(s):

make phpunit    # Run all tests

After execution above local shell command you are able to check code coverage report. Please open reports/coverage/index.html with your browser.

If you want to run single test or all tests in specified directory you can use 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 this directory

Separate environment for testing

By default this environment is using 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.

Metrics

This environment contains PhpMetrics to make some code analysis. Use next local shell command in order to run it:

make phpmetrics

Note: You need run tests before this local shell command.

After execution above local shell command please open reports/phpmetrics/index.html with your browser.

PhpStorm

You can run tests directly from your IDE PhpStorm. Please follow PhpStorm documentation in order to do it.