/**
  * Save screenshot after scanerio if required
  * 
  * @param  AfterScenarioTested $event
  */
 public function saveScreenshot(AfterScenarioTested $event)
 {
     if ($this->shouldSaveScreenshot($event)) {
         $fileName = $this->filenameGenerator->generateFileName($event->getFeature(), $event->getScenario());
         $image = $this->screenshotTaker->getImage();
         $this->screenshotUploader->upload($image, $fileName);
     }
     $this->screenshotTaker->reset();
 }
 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);
 }