/**
  * @param  string $screenshot
  * @param  string $fileName
  */
 public function upload($screenshot, $fileName = 'failure.png')
 {
     foreach ($this->config->getImageDrivers() as $imageDriver) {
         $imageUrl = $imageDriver->upload($screenshot, $fileName);
         $this->printImageLocation($imageUrl);
     }
 }
 function it_does_not_take_a_screenshot_after_a_passed_step_if_not_enabled(Config $config, ScreenshotTaker $screenshotTaker, Environment $env, FeatureNode $feature, StepNode $step, StepResult $result, Teardown $tearDown)
 {
     $event = new AfterStepTested($env->getWrappedObject(), $feature->getWrappedObject(), $step->getWrappedObject(), $result->getWrappedObject(), $tearDown->getWrappedObject());
     $config->shouldRecordAllSteps()->willReturn(false);
     $result->getResultCode()->willReturn(TestResult::PASSED);
     $screenshotTaker->takeScreenshot()->shouldNotBeCalled();
     $this->takeScreenshot($event);
 }
 /**
  * @param  AfterTested $event
  *
  * @return boolean
  */
 private function shouldSaveScreenshot(AfterTested $event)
 {
     $hasScreenshot = $this->screenshotTaker->hasScreenshot();
     $isScenarioFailed = $event->getTestResult()->getResultCode() === TestResult::FAILED;
     $shouldRecordAllScenarios = $this->config->shouldRecordAllScenarios();
     return $hasScreenshot && ($isScenarioFailed || $shouldRecordAllScenarios);
 }
 private function configureExtensionParams(ArrayNodeDefinition $builder)
 {
     $builder->children()->booleanNode(Config::CONFIG_PARAM_EXTENSTION_ENABLED)->defaultTrue()->end()->enumNode(Config::CONFIG_PARAM_SCREENSHOT_TAKING_MODE)->values(Config::getScreenshotTakingModes())->defaultValue(Config::DEFAULT_SCREENSHOT_TAKING_MODE)->validate()->ifTrue(Config::getScreenshotTakingModeValidator())->thenInvalid(Config::ERROR_MESSAGE_IMAGICK_NOT_FOUND)->end()->end()->end();
 }
 /**
  * @return string
  */
 public function getImage()
 {
     return $this->config->shouldCombineImages() ? $this->getCombinedImage() : $this->getLastImage();
 }