Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/PhutilUnitTestEngine.php
| Show All 19 Lines | if (!$run_tests) { | ||||
| throw new ArcanistNoEffectException('No tests to run.'); | throw new ArcanistNoEffectException('No tests to run.'); | ||||
| } | } | ||||
| $enable_coverage = $this->getEnableCoverage(); | $enable_coverage = $this->getEnableCoverage(); | ||||
| if ($enable_coverage !== false) { | if ($enable_coverage !== false) { | ||||
| if (!function_exists('xdebug_start_code_coverage')) { | if (!function_exists('xdebug_start_code_coverage')) { | ||||
| if ($enable_coverage === true) { | if ($enable_coverage === true) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| 'You specified --coverage but xdebug is not available, so '. | pht( | ||||
| 'coverage can not be enabled for PhutilUnitTestEngine.'); | 'You specified %s but xdebug is not available, so '. | ||||
| 'coverage can not be enabled for %s.', | |||||
| '--coverage', | |||||
| __CLASS__)); | |||||
| } | } | ||||
| } else { | } else { | ||||
| $enable_coverage = true; | $enable_coverage = true; | ||||
| } | } | ||||
| } | } | ||||
| $project_root = $this->getWorkingCopy()->getProjectRoot(); | $project_root = $this->getWorkingCopy()->getProjectRoot(); | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | foreach ($this->getPaths() as $path) { | ||||
| $library_root = phutil_get_library_root_for_path($path); | $library_root = phutil_get_library_root_for_path($path); | ||||
| if (!$library_root) { | if (!$library_root) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $library_name = phutil_get_library_name_for_root($library_root); | $library_name = phutil_get_library_name_for_root($library_root); | ||||
| if (!$library_name) { | if (!$library_name) { | ||||
| throw new Exception( | throw new Exception( | ||||
| "Attempting to run unit tests on a libphutil library which has not ". | sprintf( | ||||
| "been loaded, at:\n\n". | "%s\n\n %s\n\n%s\n\n - %s\n - %s\n", | ||||
| " {$library_root}\n\n". | pht( | ||||
| "This probably means one of two things:\n\n". | 'Attempting to run unit tests on a libphutil library '. | ||||
| " - You may need to add this library to .arcconfig.\n". | 'which has not been loaded, at:'), | ||||
| " - You may be running tests on a copy of libphutil or arcanist\n". | $library_root, | ||||
| " using a different copy of libphutil or arcanist. This\n". | pht('This probably means one of two things:'), | ||||
| " operation is not supported."); | pht( | ||||
| 'You may need to add this library to %s.', | |||||
| '.arcconfig.'), | |||||
| pht( | |||||
| 'You may be running tests on a copy of libphutil or '. | |||||
| 'arcanist using a different copy of libphutil or arcanist. '. | |||||
| 'This operation is not supported.'))); | |||||
| } | } | ||||
| $path = Filesystem::resolvePath($path, $project_root); | $path = Filesystem::resolvePath($path, $project_root); | ||||
| if (!is_dir($path)) { | if (!is_dir($path)) { | ||||
| $path = dirname($path); | $path = dirname($path); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines | |||||