Exemplo n.º 1
0
 /**
  * Visits & tests OutlineNode example.
  *
  * @param   Behat\Gherkin\Node\OutlineNode  $outline
  * @param   integer                         $row        row number
  * @param   array                           $tokens     step replacements for tokens
  *
  * @return  integer
  */
 protected function visitOutlineExample(OutlineNode $outline, $row, array $tokens = array())
 {
     $environment = $this->container->get('behat.environment_builder')->build();
     $itResult = 0;
     $skip = false;
     $this->dispatcher->dispatch('beforeOutlineExample', new OutlineExampleEvent($outline, $row, $environment));
     // Visit & test background if has one
     if ($outline->getFeature()->hasBackground()) {
         $bgResult = $this->visitBackground($outline->getFeature()->getBackground(), $environment);
         if (0 !== $bgResult) {
             $skip = true;
         }
         $itResult = max($itResult, $bgResult);
     }
     // Visit & test steps
     foreach ($outline->getSteps() as $step) {
         $stResult = $this->visitStep($step, $environment, $tokens, $skip);
         if (0 !== $stResult) {
             $skip = true;
         }
         $itResult = max($itResult, $stResult);
     }
     $this->dispatcher->dispatch('afterOutlineExample', new OutlineExampleEvent($outline, $row, $environment, $itResult, $skip));
     return $itResult;
 }
 public function testFeature()
 {
     $outline = new OutlineNode();
     $this->assertNull($outline->getFeature());
     $outline->setFeature($feature = new FeatureNode());
     $this->assertSame($feature, $outline->getFeature());
 }