コード例 #1
0
ファイル: FeatureListener.php プロジェクト: OverByThere/Behat
 /**
  * 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());
 }
コード例 #2
0
ファイル: SuiteListener.php プロジェクト: OverByThere/Behat
 /**
  * {@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());
     }
 }
コード例 #3
0
ファイル: OutlineListener.php プロジェクト: OverByThere/Behat
 /**
  * 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());
 }
コード例 #4
0
ファイル: StepListener.php プロジェクト: OverByThere/Behat
 /**
  * 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());
     }
 }
コード例 #5
0
 /**
  * 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());
 }
コード例 #6
0
 /**
  * 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();
 }
コード例 #7
0
 /**
  * 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();
 }