/** * {@inheritdoc} */ public function getResultCode() { if (!$this->setup->isSuccessful()) { return self::FAILED; } if (!$this->teardown->isSuccessful()) { return self::FAILED; } return $this->result->getResultCode(); }
/** * update feature results based on step tests results * @param FeatureNode $feature object * @param TestResult $testResult object * @return null */ public function updateFeatureStatus(FeatureNode $feature, TestResult $testResult) { $featurePath = $feature->getFile(); $resultCode = $testResult->getResultCode(); if ($resultCode > $this->testResults[$featurePath]["testResultCode"]) { $this->testResults[$featurePath]["testResultCode"] = $resultCode; $this->testResults[$featurePath]["testResult"] = self::RESULT_CODES_MAPPING[$resultCode]; } }
/** * {@inheritdoc} */ public function isFailure(TestResult $result) { return TestResult::FAILED <= $result->getResultCode(); }
/** * Converts provided test result to a string. * * @param TestResult $result * * @return string */ public function convertResultToString(TestResult $result) { return $this->convertResultCodeToString($result->getResultCode()); }
function it_does_not_save_screenshot_if_there_isnt_any(ScreenshotTaker $screenshotTaker, ScreenshotUploader $screenshotUploader, FilenameGenerator $filenameGenerator, Environment $env, FeatureNode $feature, ScenarioInterface $scenario, TestResult $result, Teardown $tearDown) { $event = new AfterScenarioTested($env->getWrappedObject(), $feature->getWrappedObject(), $scenario->getWrappedObject(), $result->getWrappedObject(), $tearDown->getWrappedObject()); $result->getResultCode()->willReturn(TestResult::FAILED); $screenshotTaker->hasScreenshot()->willReturn(false)->shouldBeCalled(); $filenameGenerator->generateFileName($feature, $scenario)->shouldNotBeCalled(); $screenshotTaker->getImage()->shouldNotBeCalled(); $screenshotUploader->upload(Argument::any(), Argument::any())->shouldNotBeCalled(); $screenshotTaker->reset()->willReturn(null)->shouldBeCalled(); $this->saveScreenshot($event); }