Esempio n. 1
0
 /**
  * Run this test suite
  *
  * @return  unittest.TestResult
  */
 public function run()
 {
     $this->notifyListeners('testRunStarted', [$this]);
     $result = new TestResult();
     try {
         foreach ($this->sources as $classname => $groups) {
             $class = new XPClass($classname);
             // Run all tests in this class
             try {
                 $this->beforeClass($class);
             } catch (PrerequisitesNotMetError $e) {
                 foreach ($groups as $group) {
                     foreach ($group->tests() as $test) {
                         $this->notifyListeners('testSkipped', [$result->setSkipped($test, $e, 0.0)]);
                     }
                 }
                 continue;
             }
             foreach ($groups as $group) {
                 foreach ($group->tests() as $test) {
                     $this->runInternal($test, $result);
                 }
             }
             $this->afterClass($class);
         }
         $this->notifyListeners('testRunFinished', [$this, $result, null]);
     } catch (StopTests $stop) {
         $this->notifyListeners('testRunFinished', [$this, $result, $stop]);
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Run this test suite
  *
  * @return  unittest.TestResult
  */
 public function run()
 {
     $this->notifyListeners('testRunStarted', [$this]);
     $result = new TestResult();
     foreach ($this->order as $classname => $tests) {
         $class = XPClass::forName($classname);
         // Run all tests in this class
         try {
             $this->beforeClass($class);
         } catch (PrerequisitesNotMetError $e) {
             foreach ($tests as $i) {
                 $this->notifyListeners('testSkipped', [$result->setSkipped($this->tests[$i], $e, 0.0)]);
             }
             continue;
         }
         foreach ($tests as $i) {
             $this->runInternal($this->tests[$i], $result);
         }
         $this->afterClass($class);
     }
     $this->notifyListeners('testRunFinished', [$this, $result]);
     return $result;
 }