protected function printScenarioFail(ScenarioDriven $failedTest, $fail) { $feature = $failedTest->getFeature(); $failToString = \PHPUnit_Framework_TestFailure::exceptionToString($fail); $failMessage = $this->message($failedTest->getSignature())->style('bold')->append(' (')->append(codecept_relative_path($failedTest->getFileName()))->append(')'); if ($fail instanceof \PHPUnit_Framework_SkippedTest || $fail instanceof \PHPUnit_Framework_IncompleteTest) { $this->printSkippedTest($feature, $failedTest->getFileName(), $failToString); return; } if ($feature) { $failMessage->prepend("Failed to {$feature} in "); } $failMessage->writeln(); $failedStep = ""; foreach ($failedTest->getScenario()->getSteps() as $step) { if ($step->hasFailed()) { $failedStep = (string) $step; break; } } $this->printException($fail, $failedStep); $this->printScenarioTrace($failedTest, $failToString); if ($this->output->getVerbosity() == OutputInterface::VERBOSITY_DEBUG) { $this->printExceptionTrace($fail); return; } if (!$fail instanceof \PHPUnit_Framework_AssertionFailedError) { $this->printExceptionTrace($fail); return; } }
protected function printScenarioFail(ScenarioDriven $failedTest, $fail) { $feature = $failedTest->getFeature(); $failToString = \PHPUnit_Framework_TestFailure::exceptionToString($fail); $failMessage = $this->message($failedTest->getSignature()) ->style('bold') ->append(' (') ->append($failedTest->getFileName()) ->append(')'); if ($fail instanceof \PHPUnit_Framework_SkippedTest or $fail instanceof \PHPUnit_Framework_IncompleteTest ) { $this->printSkippedTest($feature, $failedTest->getFileName(), $failToString); return; } if ($feature) { $failMessage->prepend("Failed to $feature in "); } $failMessage->writeln(); $this->printScenarioTrace($failedTest, $failToString); if ($this->output->getVerbosity() == OutputInterface::VERBOSITY_DEBUG) { $this->printException($fail); return; } if (!$fail instanceof \PHPUnit_Framework_AssertionFailedError) { $this->printException($fail); return; } }