Testing
Vortex ships three pre-configured test frameworks, each wired into the continuous integration pipeline: PHPUnit for unit, kernel, functional and functional JavaScript tests of custom PHP code, Behat for Behavior-Driven Development (BDD) end-to-end tests that drive a real browser, and Jest for JavaScript unit tests of custom module behaviors.
| Framework | Covers | Command |
|---|---|---|
| PHPUnit | Unit, kernel, functional and functional JavaScript tests | ahoy test |
| Behat | BDD end-to-end tests in a real browser | ahoy test-bdd |
| Jest | JavaScript unit tests | ahoy test-js |
Running
ahoy test # Run all PHPUnit test suites.
ahoy test-unit # Run PHPUnit unit tests.
ahoy test-kernel # Run PHPUnit kernel tests.
ahoy test-functional # Run PHPUnit functional tests.
ahoy test-functional-javascript # Run PHPUnit functional JavaScript tests.
ahoy test-bdd # Run Behat tests.
ahoy test-js # Run Jest tests.
Each framework page lists the Docker Compose equivalents and the options for running a single file, a tag or a filter.
Run unit, kernel and functional tests
ahoy test runs all the PHPUnit test suites: unit, kernel, functional and
functional JavaScript.
Run BDD tests
ahoy test-bdd runs the Behat tests against the provisioned site, driving a
real browser inside the container stack.
Reports and coverage
PHPUnit and Behat write JUnit
reports under .logs/test_results/<tool>/, and PHPUnit
and Jest write coverage reports under
.logs/coverage/<tool>/. The continuous integration pipeline stores them as
artifacts.
Continuous integration
Tests run in the build job of the continuous integration pipeline. PHPUnit
and Jest run on the first container, while Behat scenarios are distributed
across all containers, see
Test parallelism.
Each framework has a VORTEX_CI_<TOOL>_IGNORE_FAILURE variable
(VORTEX_CI_PHPUNIT_IGNORE_FAILURE, VORTEX_CI_BEHAT_IGNORE_FAILURE,
VORTEX_CI_JEST_IGNORE_FAILURE) that lets the build pass despite failures
while the tool still runs and reports them, see
Ignore tool failures.
Project conventions
Project-specific test writing conventions (user story format, standard user
types, test class structure, test data conventions) live in your project's
docs/testing.md file, scaffolded when you install Vortex and maintained
by your project team.