public function failed(FailEvent $e) { if (!$e->getTest() instanceof TestCase) { return; } foreach (SuiteManager::$modules as $module) { $module->_failed($e->getTest(), $e->getFail()); } }
public function failed(FailEvent $e) { if (!$e->getTest() instanceof TestInterface) { return; } foreach ($this->modules as $module) { $module->_failed($e->getTest(), $e->getFail()); } }
/** * @param TestEvent $testEvent * @param FailEvent $failEvent * @return string */ protected function getFailMessage(FailEvent $failEvent) { $test = $failEvent->getTest(); $failMessage = $failEvent->getFail()->getMessage(); if ($test instanceof ScenarioDriven) { $failingStep = $this->getFailingStep($test->getScenario()); $failMessage = 'Tried to ' . $test->getFeature() . ' but failed when I wanted to ' . $failingStep->getHumanizedAction() . ' (' . $failMessage . ')'; } return sprintf($this->message, $test->getName(), $failMessage, $failEvent->getFail()->getTraceAsString()); }
public function onFail(FailEvent $e) { $exception = $e->getFail(); $params = ['message' => $exception->getMessage(), 'details' => $exception->getTraceAsString()]; if ($exception instanceof \PHPUnit_Framework_ExpectationFailedException) { $comparisonFailure = $exception->getComparisonFailure(); if ($comparisonFailure !== null) { $params += ['type' => self::MESSAGE_COMPARISON_FAILURE, 'expected' => $comparisonFailure->getExpectedAsString(), 'actual' => $comparisonFailure->getActualAsString()]; } } $this->writeTestMessage(self::MESSAGE_TEST_FAILED, $e, $params); }
public function printFail(FailEvent $e) { $failedTest = $e->getTest(); $fail = $e->getFail(); $this->output->write($e->getCount() . ") "); $this->writeCurrentTest($failedTest, false); $this->output->writeln(''); $this->message("<error> Test </error> ")->append(codecept_relative_path(Descriptor::getTestFullName($failedTest)))->write(); if ($failedTest instanceof ScenarioDriven) { $this->printScenarioFail($failedTest, $fail); return; } $this->printException($fail); $this->printExceptionTrace($fail); }
public function printFail(FailEvent $e) { $failedTest = $e->getTest(); $fail = $e->getFail(); $this->output->write($e->getCount() . ") "); if ($failedTest instanceof ScenarioDriven) { $this->printScenarioFail($failedTest, $fail); return; } $this->getTestMessage($failedTest)->write(); $this->printException($fail); $this->printExceptionTrace($fail); }
public function testError(FailEvent $e) { $this->logger->alert($e->getFail()->getMessage()); $this->logger->info("# ERROR #"); }
public function printFail(FailEvent $e) { $failedTest = $e->getTest(); $fail = $e->getFail(); $this->output->write($e->getCount() . ") "); if ($e->getTest() instanceof ScenarioDriven) { $this->printScenarioFail($failedTest, $fail); return; } $failToString = \PHPUnit_Framework_TestFailure::exceptionToString($fail); $this->message(get_class($failedTest)) ->append('::') ->append($failedTest->getName()) ->style('bold') ->append("\n") ->append($failToString) ->writeln(); $this->printException($fail); }
public function testError(FailEvent $e) { Debugger::log($e->getFail()); }
/** * @param FailEvent $failEvent */ public function testSkipped(FailEvent $failEvent) { $event = new TestCaseCanceledEvent(); $e = $failEvent->getFail(); $message = $e->getMessage(); $this->getLifecycle()->fire($event->withException($e)->withMessage($message)); }