/**
  * Adds steps to the scenario/background/outline.
  *
  * @param   Node\AbstractScenarioNode $scenario
  * @param   string                    $keywords
  * @param   string                    $text
  * @param   integer                   $line
  *
  * @return  integer
  */
 protected function addSteps(Node\AbstractScenarioNode $scenario, $keywords, $text, $line)
 {
     foreach (explode('|', mb_substr($keywords, 2)) as $keyword) {
         if (false !== mb_strpos($keyword, '<')) {
             $keyword = mb_substr($keyword, 0, -1);
         }
         $scenario->addStep(new Node\StepNode($keyword, $text, $line));
         $line += 1;
     }
     return $line;
 }
Example #2
0
 /**
  * Dump content for scenario and background nodes
  * 
  * @param AbstractScenarioNode $node
  * @return string
  */
 protected function _dumpSteppable(AbstractScenarioNode $node)
 {
     $newNode = array('title' => $node instanceof BackgroundNode ? '' : $node->getTitle(), 'steps' => array(), 'isOutline' => $node instanceof OutlineNode, 'examples' => array());
     if ($newNode['isOutline']) {
         $newNode['examples'] = $node->getExamples()->getRows();
     }
     //
     // Steps
     foreach ($node->getSteps() as $step) {
         $tmpStep = array('type' => $step->getType(), 'text' => $step->getText(), 'outline' => array());
         $args = $step->getArguments();
         if (sizeof($args) > 0) {
             $rows = $args[0]->getRows();
             $tmpStep['outline'] = $rows;
         }
         array_push($newNode['steps'], $tmpStep);
     }
     return $newNode;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 protected function printScenarioName(AbstractScenarioNode $scenario)
 {
     $this->writeln('<h3>');
     $this->writeln('<span class="keyword">' . $scenario->getKeyword() . ': </span>');
     if ($scenario->getTitle()) {
         if ($this->sauce_link !== null) {
             $this->writeln(sprintf('<span class="title"><a href="%s">%s</a></span>', $this->sauce_link, $scenario->getTitle()));
         } else {
             $this->writeln('<span class="title">' . $scenario->getTitle() . '</span>');
         }
     }
     $this->printScenarioPath($scenario);
     $this->writeln('</h3>');
     $this->writeln('<ol>');
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 protected function printScenarioName(AbstractScenarioNode $scenario)
 {
     $this->writeln('<h3>');
     $this->writeln('<span class="keyword">' . $scenario->getKeyword() . ': </span>');
     if ($scenario->getTitle()) {
         $this->writeln('<span class="title">' . $scenario->getTitle() . '</span>');
     }
     $this->printScenarioPath($scenario);
     $this->writeln('</h3>');
     $this->writeln('<ol>');
 }
Example #5
0
 /**
  * Prints scenario keyword and name.
  *
  * @param AbstractScenarioNode $scenario Current scenario object
  * @return [void]
  *
  * @uses getFeatureOrScenarioName()
  * @uses printScenarioPath()
  */
 protected function printScenarioName(AbstractScenarioNode $scenario)
 {
     $this->writeln($scenario->getTitle());
 }