Exemplo n.º 1
0
 /**
  * Run with Process Manager
  *
  * @param \PHPUnit_Framework_TestResult $result
  * @return \PHPUnit_Framework_TestResult
  * @throws \Exception
  */
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     if ($this->isParallelRun) {
         $params = ['name' => $this->getName(false), 'data' => $this->data, 'dataName' => $this->dataName];
         $this->processManager->run($this, $result, $params);
     } else {
         try {
             parent::run($result);
             if ($this->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) {
                 $this->eventManager->dispatchEvent(['exception'], [$this->getStatusMessage()]);
             }
             /** @var \PHPUnit_Framework_TestFailure $failure */
             foreach ($result->failures() as $failure) {
                 $this->eventManager->dispatchEvent(['failure'], [$failure->exceptionMessage()]);
             }
         } catch (\PHPUnit_Framework_Exception $phpUnitException) {
             $this->eventManager->dispatchEvent(['exception'], [$phpUnitException->getMessage()]);
             throw $phpUnitException;
         } catch (\Exception $exception) {
             $this->eventManager->dispatchEvent(['exception'], [$exception->getMessage()]);
             $this->fail($exception);
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Persists Fixture Data into application
  *
  * @return void
  */
 public function persist()
 {
     $this->eventManager->dispatchEvent(['persist_before'], [get_class($this)]);
     if (!empty($this->handlerInterface)) {
         $result = $this->handlerFactory->create($this->handlerInterface)->persist($this);
         if (!empty($result)) {
             foreach ($result as $key => $value) {
                 $this->data[$key] = $value;
             }
         }
     }
     $this->eventManager->dispatchEvent(['persist_after'], [get_class($this)]);
 }