Page MenuHomePhorge

final class PhpunitTestEngine
libphutil Technical Documentation ()

PHPUnit wrapper.

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

final public function __construct()
Inherited

This method is not documented.
Return
this//Implicit.//

public function getEngineConfigurationName()
Inherited

This method is not documented.
Return
wild

final public function setRunAllTests($run_all_tests)
Inherited

This method is not documented.
Parameters
$run_all_tests
Return
wild

final public function getRunAllTests()
Inherited

This method is not documented.
Return
wild

protected function supportsRunAllTests()
Inherited

This method is not documented.
Return
wild

final public function setConfigurationManager($configuration_manager)
Inherited

This method is not documented.
Parameters
ArcanistConfigurationManager$configuration_manager
Return
wild

final public function getConfigurationManager()
Inherited

This method is not documented.
Return
wild

final public function setWorkingCopy($working_copy)
Inherited

This method is not documented.
Parameters
ArcanistWorkingCopyIdentity$working_copy
Return
wild

final public function getWorkingCopy()
Inherited

This method is not documented.
Return
wild

final public function setPaths($paths)
Inherited

This method is not documented.
Parameters
array$paths
Return
wild

final public function getPaths()
Inherited

This method is not documented.
Return
wild

final public function setEnableCoverage($enable_coverage)
Inherited

This method is not documented.
Parameters
$enable_coverage
Return
wild

final public function getEnableCoverage()
Inherited

This method is not documented.
Return
wild

final public function setRenderer($renderer)
Inherited

This method is not documented.
Parameters
ArcanistUnitRenderer$renderer
Return
wild

public function run()

This method is not documented.
Return
wild

public function shouldEchoTestResults()
Inherited

ArcanistUnitTestEngine

Modify the return value of this function in the child class, if you do not need to echo the test results after all the tests have been run. This is the case for example when the child class prints the tests results while the tests are running.

Return
wild

private function parseTestResults($path, $json_tmp, $clover_tmp, $stderr)

Parse test results from phpunit json report.

Parameters
string$pathPath to test
string$json_tmpPath to phpunit json report
string$clover_tmpPath to phpunit clover report
string$stderrData written to stderr
Return
array

private function findTestFile($path)

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$pathPHP file to locate test cases for.
Return
string|nullPath to test cases, or null.

public static function getSearchLocationsForTests($path)

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$pathPHP file to locate test cases for.
Return
list<string>List of directories to search for tests in.

private function prepareConfigFile()

Tries to find and update phpunit configuration file based on phpunit_config option in .arcconfig.

Return
wild