mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
Allow PhutilUnitTestEngine::getTestsForPaths
to return paths from the library root directory
Summary: Currently, running `arc unit -- src/` returns with `No tests to run`, even if there are test classes in `src/__tests__/`. This diff changes this behaviour so that `arc unit -- src/` executes unit tests in `src/__tests__/`. Test Plan: N/A. I suppose you could create a file `src/__tests__/SomeTestCase.php` and see for yourself. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7915
This commit is contained in:
parent
e2234a5be9
commit
66e3614f69
1 changed files with 15 additions and 14 deletions
|
@ -133,25 +133,26 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
}
|
||||
|
||||
if ($path == $library_root) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Filesystem::isDescendant($path, $library_root)) {
|
||||
$look_here[$library_name.':.'] = array(
|
||||
'library' => $library_name,
|
||||
'path' => '',
|
||||
);
|
||||
} else if (!Filesystem::isDescendant($path, $library_root)) {
|
||||
// We have encountered some kind of symlink maze -- for instance, $path
|
||||
// is some symlink living outside the library that links into some file
|
||||
// inside the library. Just ignore these cases, since the affected file
|
||||
// does not actually lie within the library.
|
||||
continue;
|
||||
} else {
|
||||
$library_path = Filesystem::readablePath($path, $library_root);
|
||||
do {
|
||||
$look_here[$library_name.':'.$library_path] = array(
|
||||
'library' => $library_name,
|
||||
'path' => $library_path,
|
||||
);
|
||||
$library_path = dirname($library_path);
|
||||
} while ($library_path != '.');
|
||||
}
|
||||
|
||||
$library_path = Filesystem::readablePath($path, $library_root);
|
||||
do {
|
||||
$look_here[$library_name.':'.$library_path] = array(
|
||||
'library' => $library_name,
|
||||
'path' => $library_path,
|
||||
);
|
||||
$library_path = dirname($library_path);
|
||||
} while ($library_path != '.');
|
||||
}
|
||||
|
||||
// Look for any class that extends ArcanistPhutilTestCase inside a
|
||||
|
@ -171,7 +172,7 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
|||
$symbols = id(new PhutilSymbolLoader())
|
||||
->setType('class')
|
||||
->setLibrary($library)
|
||||
->setPathPrefix($path.'/__tests__/')
|
||||
->setPathPrefix(($path ? $path.'/' : '').'__tests__/')
|
||||
->setAncestorClass('ArcanistPhutilTestCase')
|
||||
->setConcreteOnly(true)
|
||||
->selectAndLoadSymbols();
|
||||
|
|
Loading…
Reference in a new issue