mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 10:12:41 +01:00
Add support for 'phpunit_binary' config setting
Summary: If present, this will override the default phpunit path. Allows easy integration of Composer-provided installs of phpunit (ex. set phpunit_binary to vendor/bin/phpunit). If the path provided doesn't resolve to an executable it will assume the path is relative to the project root. fix line length issue Test Plan: Added phpunit_binary to .arcconfig in a simple project using Composer with phpunit/phpunit package as part of require-dev (installed to $ROOT/vendor/bin/phpunit). Phpunit not otherwise installed on the system. Set unit.engine to PhpunitTestEngine. Confirmed that 'arc unit' used the specified binary, both at project root and from subdirectories. Reviewers: epriestley CC: aurelijus, Korvin, aran Differential Revision: https://secure.phabricator.com/D6791
This commit is contained in:
parent
65c19ff0c0
commit
a28d4ff3e4
1 changed files with 11 additions and 2 deletions
|
@ -14,6 +14,7 @@
|
|||
final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||
|
||||
private $configFile;
|
||||
private $phpunitBinary = 'phpunit';
|
||||
private $affectedTests;
|
||||
private $projectRoot;
|
||||
|
||||
|
@ -70,8 +71,8 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
|
||||
$config = $this->configFile ? csprintf('-c %s', $this->configFile) : null;
|
||||
|
||||
$futures[$test_path] = new ExecFuture('phpunit %C --log-json %s %C %s',
|
||||
$config, $json_tmp, $clover, $test_path);
|
||||
$futures[$test_path] = new ExecFuture('%C %C --log-json %s %C %s',
|
||||
$this->phpunitBinary, $config, $json_tmp, $clover, $test_path);
|
||||
$tmpfiles[$test_path] = array(
|
||||
'json' => $json_tmp,
|
||||
'clover' => $clover_tmp,
|
||||
|
@ -265,5 +266,13 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
'found in ' . $project_root . $config);
|
||||
}
|
||||
}
|
||||
if ($bin = $this->getWorkingCopy()->getConfig('unit.phpunit.binary')) {
|
||||
if (Filesystem::binaryExists($bin)) {
|
||||
$this->phpunitBinary = $bin;
|
||||
}
|
||||
else {
|
||||
$this->phpunitBinary = Filesystem::resolvePath($bin, $project_root);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue