Captures scenario tested event.

@param ScenarioTested $event
771765
private function captureScenarioEvent(ScenarioTested $event)
    {
        if ($event instanceof AfterScenarioTested) {
            $this->afterScenarioTestedEvents[$event->getScenario()->getLine()] = array(
                'event'             => $event,
                'step_events'       => $this->afterStepTestedEvents,
                'step_setup_events' => $this->afterStepSetupEvents,
            );

            $this->afterStepTestedEvents = array();
            $this->afterStepSetupEvents = array();
        }
    }
1271859
private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event)
    {
        if (!$event instanceof BeforeFeatureTested) {
            return;
        }

        $this->currentFeaturePath = $event->getFeature()->getFile();
    }
1114730
public static function dump(Event $event)
    {
        $packages = array_keys($event->getComposer()->getPackage()->getRequires());
        if (!$packages) {
            return;
        }
    }
1226762
public function prepareDefaultDrupalDriver($event)
    {
        $feature = $event->getFeature();
        $scenario = $event instanceof ScenarioLikeTested ? $event->getScenario() : $event->getOutline();

        // Get the default driver.
        $driver = $this->parameters['default_driver'];

        foreach (array_merge($feature->getTags(), $scenario->getTags()) as $tag) {
            if (!empty($this->parameters[$tag . '_driver'])) {
                $driver = $this->parameters[$tag . '_driver'];
            }
        }

        // Set the default driver.
        $this->drupal->setDefaultDriverName($driver);

        // Set the environment.
        $environment = $event->getEnvironment();
        $this->drupal->setEnvironment($environment);
    }
250737
public function onSave(Event\Save $event)
    {
        $success = $event->getUser()->save();
        $event->setResult( (bool)$success );
        if( $event->getResult() === false )
        {
            $event->stopPropagation(true);
        }
        return $event;
    }
1071579
private function printFooterOnAfterEvent(Formatter $formatter, ScenarioLikeTested $event, $eventName)
    {
        if ($this->afterEventName !== $eventName || !$event instanceof AfterTested) {
            return;
        }

        if ($this->setupPrinter) {
            $this->setupPrinter->printTeardown($formatter, $event->getTeardown());
        }

        $this->scenarioPrinter->printFooter($formatter, $event->getTestResult());
    }
668155
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event)
    {
        if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) {
            return false;
        }

        return !$this->firstBackgroundEnded && $event->getFeature()->hasBackground();
    }
1158052
private function captureScenarioOrExampleStatsOnAfterEvent(Event $event)
    {
        if (!$event instanceof AfterScenarioTested) {
            return;
        }

        $scenario = $event->getScenario();
        $title = $scenario->getTitle();
        $path = sprintf('%s:%d', $this->currentFeaturePath, $scenario->getLine());
        $resultCode = $event->getTestResult()->getResultCode();

        $stat = new ScenarioStat($title, $path, $resultCode);
        $this->statistics->registerScenarioStat($stat);
    }
56948
public function onConsoleCommand(ConsoleCommandEvent $event)
    {
        $input = $event->getInput();
        if (!$input->hasOption($this->mockParamName)) {
            return;
        }

        $this->mock($input->getOption($this->mockParamName));
    }
322511
private function captureOutlineOnBeforeOutlineEvent(Event $event)
    {
        if (!$event instanceof BeforeOutlineTested) {
            return;
        }

        $outline = $event->getOutline();
        foreach ($outline->getExamples() as $example) {
            $this->lineScenarioMap[$example->getLine()] = $outline;
        }
    }
1161509
private function mutate($event)
    {
        $method = 'on' . (string) new EventName($event);

        if (method_exists($this, $method)) {
            $this->$method($event);
        } else {
            throw new \RuntimeException(sprintf('Method %s does not exist on aggregate %s', $method, get_class($this)));
        }
    }
412138
public function sendEvent(Event $event)
    {
        try {
            $this->eventFactory->addDefaultTagsToEntity($event);
            $this->sendEventThroughSenders($event);
        } catch (\Exception $exception) {
            $this->logException($exception);
        }
    }
1111225
public function eventTriggered($event)
    {
        $event = $this->normalizeEvent($event);

        foreach ($this->triggeredEvents as $triggeredEvent) {
            if ($event == $triggeredEvent || is_subclass_of($event, $triggeredEvent)) {
                return true;
            }
        }

        return false;
    }
550657
public function findHandlerScenarioFor(Dispatchable $event)
    {
        $eventName = $event->getEventName();

        $this->scenarioCache[$eventName] = $this->scenarioFactory->findHandlerScenarioFor($event);

        return $this->scenarioCache[$eventName];
    }
516421
public function afterStep($event)
    {
        $code = $event->getTestResult()->getResultCode();
        if(TestResult::FAILED === $code) {
            if ($event->getTestResult()->hasException()) {
                $failureNode = $this->currentTestcase->addChild('failure');

                $failureText = $event->getStep()->getKeyword() . " " . $event->getStep()->getText() . ":\n\n" . $event->getTestResult()->getException()->getMessage();

                // add cdata
                $node = dom_import_simplexml($failureNode);
                $no = $node->ownerDocument;
                $node->appendChild($no->createCDATASection($failureText));

                $failureNode->addAttribute('type', \get_class($event->getTestResult()->getException()));
            }
        }
    }
1338574
public function onReflectSuccess(GenericEvent $event)
    {
        $context = $event->getArguments();
        $this->logger->info('Analyze file "{file}" successful.', $context);
    }
638580
public function handle($event)
    {
        if ($event instanceof CExceptionEvent)
            $this->logExceptionEvent($event);
        else
            $this->logErrorEvent($event);
        parent::handle($event);
    }