TestSuite::getBaseTestCase PHP Method

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.
    public static function getBaseTestCase($class)
    {
        while ($class = get_parent_class($class)) {
            $class = strtolower($class);
            if ($class === 'simpletestcase' || $class === 'testsuite') {
                return $class;
            }
        }
        return false;
    }

Usage Example

Ejemplo n.º 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;
     }
 }
All Usage Examples Of TestSuite::getBaseTestCase