| Defined | src/unit/engine/PhpunitTestEngine.php:14 |
|---|---|
| Group | Unit Test Runners |
| Extends | ArcanistBaseUnitTestEngine |
PHPUnit wrapper
To use, set unit.engine in .arcconfig, or use --engine flag with arc unit. Currently supports only class & test files (no directory support). To use custom phpunit configuration, set phpunit_config in .arcconfig (e.g. app/phpunit.xml.dist).
| parameters | string | $path | PHP file to locate test cases for. |
| return | string|null | Path to test cases, or null. |
Search for test cases for a given file in a large number of "reasonable" locations. See getSearchLocationsForTests() for specifics.
TODO: Add support for finding tests in testsuite folders from phpunit.xml configuration.
| parameters | string | $path | PHP file to locate test cases for. |
| return | list<string> | List of directories to search for tests in. |
Get places to look for PHP Unit tests that cover a given file. For some file "/a/b/c/X.php", we look in the same directory:
/a/b/c/
We then look in all parent directories for a directory named "tests/" (or "Tests/"):
/a/b/c/tests/ /a/b/tests/ /a/tests/ /tests/
We also try to replace each directory component with "tests/":
/a/b/tests/ /a/tests/c/ /tests/b/c/
We also try to add "tests/" at each directory level:
/a/b/c/tests/ /a/b/tests/c/ /a/tests/b/c/ /tests/a/b/c/
This finds tests with a layout like:
docs/ src/ tests/
...or similar. This list will be further pruned by the caller; it is intentionally filesystem-agnostic to be unit testable.
| parameters | string | $path | $path Path to test |
| string | $json_tmp | $json_path Path to phpunit json report | |
| string | $clover_tmp | $clover_tmp Path to phpunit clover report | |
| return | array |
Parse test results from phpunit json report
| return | wild |
Tries to find and update phpunit configuration file based on phpunit_config option in .arcconfig
| return | wild |