TestSuite::run PHP Méthode

run() public méthode

Invokes run() on all of the held test cases, instantiating them if necessary.
public run ( SimpleReporter $reporter )
$reporter SimpleReporter Current test reporter.
    public function run($reporter)
    {
        $reporter->paintGroupStart($this->getLabel(), $this->getSize());
        for ($i = 0, $count = count($this->test_cases); $i < $count; $i++) {
            if (is_string($this->test_cases[$i])) {
                $class = $this->test_cases[$i];
                $test = new $class();
                $test->run($reporter);
                unset($test);
            } else {
                $this->test_cases[$i]->run($reporter);
            }
        }
        $reporter->paintGroupEnd($this->getLabel());
        return $reporter->getStatus();
    }

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::run