/** * Prints feature footer on AFTER event. * * @param Formatter $formatter * @param Event $event */ private function printFooterOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); $this->featurePrinter->printFooter($formatter, $event->getTestResult()); }
/** * {@inheritdoc} */ public function listenEvent(Formatter $formatter, Event $event, $eventName) { if ($event instanceof AfterSuiteSetup) { $this->setupPrinter->printSetup($formatter, $event->getSetup()); } if ($event instanceof AfterSuiteTested) { $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); } }
/** * Prints example step on step AFTER event. * * @param Formatter $formatter * @param Event $event */ private function printStepOnAfterStepEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->example, $event->getStep(), $event->getTestResult()); $this->stepSetupPrinter->printTeardown($formatter, $event->getTeardown()); }
/** * Prints step on AFTER event. * * @param Formatter $formatter * @param Event $event */ private function printStepOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterStepTested) { return; } $this->stepPrinter->printStep($formatter, $this->scenario, $event->getStep(), $event->getTestResult()); if ($this->setupPrinter) { $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); } }
/** * Prints scenario/background footer on AFTER event. * * @param Formatter $formatter * @param ScenarioLikeTested|AfterTested $event * @param string $eventName */ 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()); }
/** * Prints example row on example AFTER event. * * @param Formatter $formatter * @param Event $event * @param string $eventName */ private function printExampleRowOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) { if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { return; } $example = $event->getScenario(); $this->exampleSetupPrinter->printSetup($formatter, $this->exampleSetup); foreach ($this->stepBeforeTestedEvents as $beforeEvent) { $this->stepSetupPrinter->printSetup($formatter, $beforeEvent->getSetup()); } $this->exampleRowPrinter->printExampleRow($formatter, $this->outline, $example, $this->stepAfterTestedEvents); foreach ($this->stepAfterTestedEvents as $afterEvent) { $this->stepSetupPrinter->printTeardown($formatter, $afterEvent->getTeardown()); } $this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown()); $this->exampleSetup = null; $this->stepBeforeTestedEvents = array(); $this->stepAfterTestedEvents = array(); }
/** * Prints the feature on AFTER event. * * @param Formatter $formatter * @param Event $event */ public function printFeatureOnAfterEvent(Formatter $formatter, Event $event) { if (!$event instanceof AfterFeatureTested) { return; } $this->featurePrinter->printHeader($formatter, $this->beforeFeatureTestedEvent); foreach ($this->afterScenarioTestedEvents as $afterScenario) { $afterScenarioTested = $afterScenario['event']; $this->scenarioPrinter->printOpenTag($formatter, $afterScenarioTested->getFeature(), $afterScenarioTested->getScenario(), $afterScenarioTested->getTestResult()); /** @var AfterStepSetup $afterStepSetup */ foreach ($afterScenario['step_setup_events'] as $afterStepSetup) { $this->setupPrinter->printSetup($formatter, $afterStepSetup->getSetup()); } foreach ($afterScenario['step_events'] as $afterStepTested) { $this->stepPrinter->printStep($formatter, $afterScenarioTested->getScenario(), $afterStepTested->getStep(), $afterStepTested->getTestResult()); $this->setupPrinter->printTeardown($formatter, $afterStepTested->getTeardown()); } } $this->featurePrinter->printFooter($formatter, $event->getTestResult()); $this->afterScenarioTestedEvents = array(); }