diff --git a/review/simpletest/pifr_simpletest.client.inc b/review/simpletest/pifr_simpletest.client.inc index 39f7166..f363602 100644 --- a/review/simpletest/pifr_simpletest.client.inc +++ b/review/simpletest/pifr_simpletest.client.inc @@ -216,6 +216,18 @@ class pifr_client_review_pifr_simpletest extends pifr_client_review_pifr_drupal } return '--file ' . implode(',', $files); } + elseif (!($this->is_core_test())) { + $this->log("Not a core test. Scanning modules directory."); + // Not a core test? Scan the sites/all/modules directory for tests + $scan = file_scan_directory($this->checkout_directory . '/' . $this->module_directory, '\.test$'); + foreach ($scan as $file) { + $files[] = str_replace($this->checkout_directory . '/', '', $file->filename); + } + if (count($files) < 1) { + $this->set_error(array('@reason' => 'No valid tests specified. (Empty run-tests.sh --file argument.)')); + } + return '--file ' . implode(',', $files); + } elseif (PIFR_SHORTCUT_CORE_TEST) { return '--class NonDefaultBlockAdmin'; } @@ -223,6 +235,35 @@ class pifr_client_review_pifr_simpletest extends pifr_client_review_pifr_drupal } /** + * Attempt to identify whether a test is core + */ + public function is_core_test() { + // If project in vcs[main][repository][url] is not drupal, then this is not a core test + if (str_replace('.' . $this->vcs['main']['repository']['type'], '', array_pop(explode('/', $module['repository']['url']))) != 'drupal') { + return FALSE; + }; + // If above IS drupal, we need to check depedencies + foreach ($this->vcs['dependencies'] as $module) { + $project = str_replace('.' . $module['repository']['type'], '', array_pop(explode('/', $module['repository']['url']))); + switch ($this->argument['drupal.core.version']) { + case '7': + // D7 core has no required dependencies. If one exists, it's a module test + if ($project != 'drupal') { + return FALSE; + } + break; + case '6': + // D6 core has a dependency on simpletest. + if (!in_array($project, array('drupal', 'simpletest'))) { + return FALSE; + } + } + } + // If we get to this point, assume a core test + return TRUE; + } + + /** * Add the SimpleTest specific results. */ public function get_result() {