This package contains unit, functional, and acceptance test suites powered by Codeception PHP Testing Framework.
Tests are located in the tests directory. They are developed with Codeception PHP Testing Framework.
By default, there are 3 test suites:
unitfunctionalacceptance
vendor/bin/codecept run --env php-builtinThe command above will execute all test suites (unit, functional, and acceptance). Unit tests verify system components, functional tests emulate web requests, and acceptance tests run against a real HTTP server.
The acceptance suite is configured in tests/acceptance.suite.yml.
By default, acceptance tests use the PhpBrowser module and run against the built-in PHP web server started via the
php-builtin environment.
# run all tests with built-in web server
composer tests
# run acceptance tests only
vendor/bin/codecept run acceptance --env php-builtinTo run acceptance tests in a real browser, switch the acceptance suite to use the WebDriver module.
tests/acceptance.suite.yml contains an example WebDriver configuration (commented).
- Download and start Selenium Server.
- Install the corresponding browser driver (for example GeckoDriver or ChromeDriver).
- Update
tests/acceptance.suite.ymlto enableWebDriverand disablePhpBrowser. - Run:
vendor/bin/codecept run acceptance --env php-builtindocker compose exec -T php vendor/bin/codecept build
docker compose exec -T php vendor/bin/codecept runCode coverage is configured in codeception.yml. Run your tests and collect coverage with:
# collect coverage for all tests
vendor/bin/codecept run --coverage --coverage-html --coverage-xml --env php-builtin
# collect coverage only for unit tests
vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env php-builtin
# collect coverage for unit and functional tests
vendor/bin/codecept run functional,unit --coverage --coverage-html --coverage-xml --env php-builtinYou can see code coverage output under the tests/support/output directory.
Run Easy Coding Standard with fixes:
composer ecsRun PHPStan:
composer staticComposer scripts support forwarding additional arguments using --.
Examples:
composer tests -- --filter LoginCest
composer static -- --memory-limit=1G