mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-04-02 15:38:16 +02: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) {
|
if ($path == $library_root) {
|
||||||
continue;
|
$look_here[$library_name.':.'] = array(
|
||||||
}
|
'library' => $library_name,
|
||||||
|
'path' => '',
|
||||||
if (!Filesystem::isDescendant($path, $library_root)) {
|
);
|
||||||
|
} else if (!Filesystem::isDescendant($path, $library_root)) {
|
||||||
// We have encountered some kind of symlink maze -- for instance, $path
|
// We have encountered some kind of symlink maze -- for instance, $path
|
||||||
// is some symlink living outside the library that links into some file
|
// is some symlink living outside the library that links into some file
|
||||||
// inside the library. Just ignore these cases, since the affected file
|
// inside the library. Just ignore these cases, since the affected file
|
||||||
// does not actually lie within the library.
|
// does not actually lie within the library.
|
||||||
continue;
|
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
|
// Look for any class that extends ArcanistPhutilTestCase inside a
|
||||||
|
@ -171,7 +172,7 @@ final class PhutilUnitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||||
$symbols = id(new PhutilSymbolLoader())
|
$symbols = id(new PhutilSymbolLoader())
|
||||||
->setType('class')
|
->setType('class')
|
||||||
->setLibrary($library)
|
->setLibrary($library)
|
||||||
->setPathPrefix($path.'/__tests__/')
|
->setPathPrefix(($path ? $path.'/' : '').'__tests__/')
|
||||||
->setAncestorClass('ArcanistPhutilTestCase')
|
->setAncestorClass('ArcanistPhutilTestCase')
|
||||||
->setConcreteOnly(true)
|
->setConcreteOnly(true)
|
||||||
->selectAndLoadSymbols();
|
->selectAndLoadSymbols();
|
||||||
|
|
Loading…
Add table
Reference in a new issue