Exemple #1
0
 public function run(Event\Test $event = null)
 {
     if ($event) {
         $event->preRun($this);
     }
     $this->setUp();
     $this->fixtures->install();
     foreach ($this->methods as $method) {
         $this->currentMethod = $method;
         $this->methodExceptions[$method] = new ArrayIterator();
         $this->methodAssertions[$method] = new AssertionArray();
         if ($event) {
             $event->preMethod($method, $this);
         }
         set_error_handler($this->generateErrorHandler($method));
         if ($this->benchmarks->has($method)) {
             $this->benchmarks->get($method)->start();
         }
         try {
             $this->{$method}();
         } catch (Exception $e) {
             $assertionException = new AssertionException($e);
             $this->exceptions->append($assertionException);
             $this->methodExceptions[$method]->append($assertionException);
         }
         if ($this->benchmarks->has($method)) {
             $this->benchmarks->get($method)->stop();
         }
         restore_error_handler();
         if ($event) {
             $event->postMethod($method, $this);
         }
     }
     $this->tearDown();
     $this->fixtures->uninstall();
     if ($event) {
         $event->postRun($this);
     }
     return $this;
 }