TestSuite::add PHP Méthode

add() public méthode

The class will be instantiated if it's a test suite.
public add ( SimpleTestCase $test_case )
$test_case SimpleTestCase 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 (self::getBaseTestCase($test_case) === 'testsuite') {
            $this->test_cases[] = new $test_case();
        } else {
            $this->test_cases[] = $test_case;
        }
    }

Usage Example

 /**
  * Genereates a nice report of the test.
  *
  * It instantiate a SimpleTest TestSuite and launches a Reporter.
  * This method is typically called by a TestRunner.
  *
  * @return void
  * @see    KortTestRunner
  * @see    KortCliReporter
  * @see    KortHTMLReporter
  */
 public function report()
 {
     $test = new \TestSuite($this->getLabel());
     $test->add($this);
     if (\TextReporter::inCli()) {
         exit($test->run(new KortCliReporter()) ? 0 : 1);
     }
     $test->run(new KortHTMLReporter());
 }
All Usage Examples Of TestSuite::add