diff --git a/src/unit/engine/PhutilUnitTestEngine.php b/src/unit/engine/PhutilUnitTestEngine.php --- a/src/unit/engine/PhutilUnitTestEngine.php +++ b/src/unit/engine/PhutilUnitTestEngine.php @@ -17,16 +17,21 @@ } if (!$run_tests) { - throw new ArcanistNoEffectException('No tests to run.'); + throw new ArcanistNoEffectException(pht('No tests to run.')); } $enable_coverage = $this->getEnableCoverage(); + if ($enable_coverage !== false) { if (!function_exists('xdebug_start_code_coverage')) { if ($enable_coverage === true) { throw new ArcanistUsageException( - 'You specified --coverage but xdebug is not available, so '. - 'coverage can not be enabled for PhutilUnitTestEngine.'); + pht( + 'You specified %s but %s is not available, so '. + 'coverage can not be enabled for %s.', + '--coverage', + 'XDebug', + __CLASS__)); } } else { $enable_coverage = true; @@ -134,17 +139,15 @@ // does not actually lie within the library. continue; } else if (is_file($path) && preg_match('/\b__tests__\b/', $path)) { - $look_here[$library_name.':'.$library_path] = array( 'library' => $library_name, 'path' => $library_path, ); } else { do { - var_dump($library_path); $look_here[$library_name.':'.$library_path] = array( 'library' => $library_name, - 'path' => $library_path, + 'path' => $library_path == $library_root ? '' : $library_path, ); $library_path = dirname($library_path); } while ($library_path != '.' && $library_path == $library_root); @@ -159,7 +162,7 @@ // "infrastructure/". However, "infrastructure/concrete/rebar/__tests__/" // defines more specific tests that run only when rebar/ (or some // subdirectory) changes. -var_dump($look_here); + $run_tests = array(); foreach ($look_here as $path_info) { $library = $path_info['library']; @@ -168,7 +171,7 @@ $symbols = id(new PhutilSymbolLoader()) ->setType('class') ->setLibrary($library) - ->setPathPrefix(($path ? $path.'/' : '').'__tests__/') + ->setPathPrefix($path) ->setAncestorClass('ArcanistPhutilTestCase') ->setConcreteOnly(true) ->selectAndLoadSymbols();