/** * Visits & tests FeatureNode. * * @param Behat\Gherkin\Node\AbstractNode $feature * * @return integer * * @throws BehaviorException if unknown scenario type (neither Outline or Scenario) found in feature */ public function visit(AbstractNode $feature) { $result = 0; // If feature has scenario - run them if (count($scenarios = $feature->getScenarios())) { $this->dispatcher->dispatch('beforeFeature', new FeatureEvent($feature)); foreach ($scenarios as $scenario) { if ($scenario instanceof OutlineNode) { $tester = $this->container->get('behat.tester.outline'); } elseif ($scenario instanceof ScenarioNode) { $tester = $this->container->get('behat.tester.scenario'); } else { throw new BehaviorException('Unknown scenario type found: ' . get_class($scenario)); } $result = max($result, $scenario->accept($tester)); } $this->dispatcher->dispatch('afterFeature', new FeatureEvent($feature, $result)); } return $result; }
/** * Visits & tests FeatureNode. * * @param AbstractNode $feature * * @return integer * * @throws BehaviorException if unknown scenario type (neither Outline or Scenario) found in feature */ public function visit(AbstractNode $feature) { $this->dispatcher->dispatch('beforeFeature', new FeatureEvent($feature, $this->parameters)); $result = 0; $skip = false; // Visit & test scenarios foreach ($feature->getScenarios() as $scenario) { if ($scenario instanceof OutlineNode) { $tester = $this->container->get('behat.tester.outline'); } elseif ($scenario instanceof ScenarioNode) { $tester = $this->container->get('behat.tester.scenario'); } else { throw new BehaviorException('Unknown scenario type found: ' . get_class($scenario)); } $tester->setSkip($skip || $this->skip); $result = max($result, $scenario->accept($tester)); } $this->dispatcher->dispatch('afterFeature', new FeatureEvent($feature, $this->parameters, $result)); return $result; }