Exits if scenario is a failure and if stopper is enabled.

@param AfterScenarioTested $event
357550
public function exitOnFailure(AfterScenarioTested $event)
    {
        if (!$this->resultInterpretation->isFailure($event->getTestResult())) {
            return;
        }

        $this->eventDispatcher->dispatch(SuiteTested::AFTER, new AfterSuiteAborted($event->getEnvironment()));
        $this->eventDispatcher->dispatch(ExerciseCompleted::AFTER, new AfterExerciseAborted());

        exit(1);
    }
197810
@After
    public void afterScenario(Scenario scenario) throws InterruptedException {
        log.debug("Scenarion finished");
        ScenarioGlobals scenarioGlobals = getCucumberManager().getCurrentScenarioGlobals();
    	TestEnvironment testNev = getSeleniumManager().getAssociatedTestEnvironment();
    	if (testNev != null && scenarioGlobals != null) {
    		boolean scenarioUsedSelenium = testNev.isWebDriverAccessedSince(scenarioGlobals.getScenarioStart());
    		if (scenarioUsedSelenium) {
    			if (scenario.isFailed()) {
    				log.debug("Scenarion failed while using selenium, so capture screenshot");
    				TakesScreenshot seleniumDriver = (TakesScreenshot) SenBotContext.getSeleniumDriver();
					byte[] screenshotAs = seleniumDriver.getScreenshotAs(OutputType.BYTES);
					scenario.embed(screenshotAs, "image/png");
    			}
    		}
    	}
        getCucumberManager().stopNewScenario();
    }
981939
public static function onAfterRemove(Event $event)
    {
        $layout = $event->getTarget();
        if (!is_a($layout, 'BackBee\Site\Layout')) {
            return;
        }

        $dispatcher = $event->getDispatcher();
        if (null !== $dispatcher->getApplication()) {
            $dispatcher->getApplication()->getEntityManager()
                    ->getRepository('BackBee\Site\Layout')
                    ->removeThumbnail($layout, $dispatcher->getApplication());
        }

        $dispatcher->getApplication()->getRenderer()->removeLayout($layout);
    }
563016
private function isSkippableEvent(Event $event)
    {
        if (!$this->firstBackgroundEnded) {
            return false;
        }

        return $event instanceof BackgroundTested || $this->isNonFailingConsequentBackgroundStep($event);
    }
921565
public function afterPaginate(Event $event)
    {
        $event;
        if (!$this->_table()->behaviors()->has('Search')) {
            return;
        }

        $enabled = $this->getConfig('enabled') ?: !$this->_request()->is('api');
        if (!$enabled) {
            return;
        }

        $fields = $this->fields();
        $this->_controller()->set('searchInputs', $fields);
    }
323508
public function onInstallReleaseCompleteOrFailedShutdownSSHAgent(Event $event, $eventName, EventDispatcherInterface $eventDispatcher)
    {
        if ($this->host instanceof Host) {
            $connection = $this->ensureConnection($this->host);

            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Terminating SSH agent...', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_IN_PROGRESS)));

            $result = $connection->executeCommand('eval $(ssh-agent -k)');
            if ($result->isSuccessful()) {
                $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Terminated SSH agent.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_COMPLETED, 'output.resetLine' => true)));
            } else {
                $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::WARNING, 'Failed terminating SSH agent.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_FAILED, 'output.resetLine' => true)));
            }
        }
    }
149157
protected function silentRunActionTrigger($event)
    {
        try {
            $this->action->trigger($event, $this->control, $this->context);
        } catch (Exception $exception) {
            // Pokémon Exception Handling
        }
    }
907387
public function afterAction($event)
    {
        if ($this->schedule) {
            if ($event->result === false) {
                $exitCode = CronScheduleStatus::ERROR;
            } else {
                $exitCode = CronScheduleStatus::SUCCESS;
            }
            $this->schedule->endCronSchedule($exitCode);
            $this->schedule = null;
        }
    }
1117275
public function afterSave($event)
    {
        foreach ($this->relationKey as $from => $to) {
            $this->_relation[$to] = $this->owner[$from];
        }
        $this->_relation->save();
    }
747009
public function takeScreenshotAfterFailedStep(AfterStepScope $event)
    {
        if (!$event->getTestResult()->isPassed()) {
            if ($this->getSession()->getDriver() instanceof Selenium2Driver) {
                $stepLine = $event->getStep()->getLine();
                $time = time();
                $fileName = "./step-{$stepLine}-{$time}.png";
                if (is_writable('.')) {
                    $screenshot = $this->getSession()->getDriver()->getScreenshot();
                    $stepText = $event->getStep()->getText();
                    if (file_put_contents($fileName, $screenshot)) {
                        echo "Screenshot for '{$stepText}' placed in {$fileName}".PHP_EOL;
                    } else {
                        echo "Screenshot failed: {$fileName} is not writable.";
                    }
                }
            }
        }
    }
384387
public function afterDelete(Event $event, EntityInterface $entity) {
		if ($this->_checkEvent($event)) {
			$event->result = $this->_deleteFile($event);
			$event->stopPropagation();
		}
	}
263341
public function _after(TestInterface $test)
    {
        if ($this->sessionStatus() === PHP_SESSION_ACTIVE) {
            $this->sessionDestroy();
        }

        if (isset($this->client) && $this->client instanceof Connector) {
            $this->client->reset();
            
            if (isset($this->baseRequest)) {
                $this->baseRequest = $this->client->getBaseRequest();
            }
            
            if (isset($this->baseResponse)) {
                $this->baseResponse = $this->client->getBaseResponse();
            }
        }

        parent::_after($test);
    }
97569
public function afterSave(Event $event, EntityInterface $entity, ArrayObject $options = null)
    {
        if ($entity->isNew()) {
            snapshot();
        }
    }
1287997
public function onRunFailed(RunEvent $event)
    {
        $this->exceptions = array_merge($this->exceptions, $event->getRun()->getExceptions());
    }
1235217
public function _after(TestInterface $test)
    {
        if ($this->app['db'] && $this->config['cleanup']) {
            $this->app['db']->rollback();
        }

        // disconnect from DB to prevent "Too many connections" issue
        if ($this->app['db']) {
            $this->app['db']->disconnect();
        }
    }
1232869
public function beforeExample(ScenarioTested $event)
    {
        $this->currentTestcase = $this->currentTestsuite->addChild('testcase');
        $this->currentTestcase->addAttribute('name', $this->currentOutlineTitle . ' Line #' . $event->getScenario()->getLine());

        $this->testcaseTimer->start();
    }
1211729
public function deleteMenuLinks(AfterScenarioScope $event) {
    if ($this->menuLinks) {
      foreach ($this->menuLinks as $menu_link) {
        $this->getCore()->entityDelete($menu_link);
      }

      $this->getCore()->clearMenuCache();
    }
  }