Esempio 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;
 }
Esempio n. 2
0
 /**
  * To execute callback if specified
  *
  * @param \PHPUnit_Framework_TestResult $result
  * @return \PHPUnit_Framework_TestResult
  */
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     if ($this->callback) {
         $processManager = ProcessManager::factory();
         if ($processManager->isParallelModeSupported()) {
             $processManager->applyAppState($this->callback, $this->callbackArguments);
         } else {
             call_user_func_array($this->callback, $this->callbackArguments);
         }
     }
     return parent::run($result);
 }