getBaseTestCase() public static method

Test to see if a class is derived from the SimpleTestCase class.
public static getBaseTestCase ( string $class )
$class string Class name.
Example #1
0
 /**
  *    Adds a test into the suite by instance or class. The class will
  *    be instantiated if it's a test suite.
  * @param SimpleTestCase $test_case Suite or individual test
  *                                      case implementing the
  *                                      runnable test interface.
  */
 public function add($test_case)
 {
     if (!is_string($test_case)) {
         $this->test_cases[] = $test_case;
     } elseif (TestSuite::getBaseTestCase($test_case) == 'testsuite') {
         $this->test_cases[] = new $test_case();
     } else {
         $this->test_cases[] = $test_case;
     }
 }
Example #2
0
 /**
  *    Adds a test into the suite by instance or class. The class will
  *    be instantiated if it's a test suite.
  *    @param SimpleTestCase $test_case  Suite or individual test
  *                                      case implementing the
  *                                      runnable test interface.
  *    @access public
  */
 function add(&$test_case) {
     if (! is_string($test_case)) {
         $this->_test_cases[] = &$test_case;
     } elseif (TestSuite::getBaseTestCase($class) == 'testsuite') {
         $this->_test_cases[] = new $class();
     } else {
         $this->_test_cases[] = $class;
     }
 }
Example #3
0
 /**
  *    Calculates the incoming test cases. Skips abstract
  *    and ignored classes.
  *
  *    @param array $candidates   Candidate classes.
  *
  *    @return array              New classes which are test
  *                               cases that shouldn't be ignored.
  */
 public function selectRunnableTests($candidates)
 {
     $classes = array();
     foreach ($candidates as $class) {
         if (TestSuite::getBaseTestCase($class)) {
             $reflection = new SimpleReflection($class);
             if ($reflection->isAbstract()) {
                 SimpleTest::ignore($class);
             } else {
                 $classes[] = $class;
             }
         }
     }
     return $classes;
 }