Ejemplo n.º 1
0
 /**
  * Runs a specific group test file
  *
  * @param string $groupTestName
  * @param string $reporter
  * @return void
  * @access public
  */
 function runGroupTest($groupTestName, &$reporter)
 {
     $manager = new TestManager();
     $filePath = $manager->_getTestsPath('groups') . DS . strtolower($groupTestName) . $manager->_groupExtension;
     if (!file_exists($filePath)) {
         trigger_error("Group test {$groupTestName} cannot be found at {$filePath}", E_USER_ERROR);
     }
     require_once $filePath;
     $test = new TestSuite($groupTestName . ' group test');
     foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) {
         $testCase = new $groupTest();
         $test->addTestCase($testCase);
         if (isset($testCase->label)) {
             $test->_label = $testCase->label;
         }
     }
     return $test->run($reporter);
 }
Ejemplo n.º 2
0
 function runGroupTest($group_test_name, $group_test_directory, &$reporter)
 {
     $manager = new TestManager();
     $group_test_name = preg_replace('/[^a-zA-Z0-9_:]/', '', $group_test_name);
     $group_test_name = str_replace(':', DIRECTORY_SEPARATOR, $group_test_name);
     $file_path = $group_test_directory . DIRECTORY_SEPARATOR . strtolower($group_test_name) . $manager->_grouptest_extension;
     if (!file_exists($file_path)) {
         trigger_error("Group test {$group_test_name} cannot be found at {$file_path}", E_USER_ERROR);
     }
     require_once $file_path;
     $test = new GroupTest($group_test_name . ' group test');
     foreach ($manager->_getGroupTestClassNames($file_path) as $group_test) {
         $test->addTestCase(new $group_test());
     }
     $test->run($reporter);
 }