Пример #1
0
 public function testTokens()
 {
     $step = new StepNode('When', 'Some "<text>" in <string>');
     $step->setTokens(array('text' => 'change'));
     $this->assertEquals('Some "change" in <string>', $step->getText());
     $this->assertEquals('Some "<text>" in <string>', $step->getCleanText());
     $step->setTokens(array('text' => 'change', 'string' => 'browser'));
     $this->assertEquals('Some "change" in browser', $step->getText());
     $this->assertEquals('Some "<text>" in <string>', $step->getCleanText());
 }
Пример #2
0
 /**
  * Prints step definition path.
  *
  * @param StepNode            $step       step node
  * @param DefinitionInterface $definition definition (if found one)
  *
  * @uses printPathComment()
  */
 protected function printStepDefinitionPath(StepNode $step, DefinitionInterface $definition)
 {
     if ($this->getParameter('paths')) {
         $type = $step->getType();
         $text = $this->inOutlineSteps ? $step->getCleanText() : $step->getText();
         $indent = $this->stepIndent;
         $nameLength = mb_strlen("{$indent}{$type} {$text}");
         $indentCount = $nameLength > $this->maxLineLength ? 0 : $this->maxLineLength - $nameLength;
         $this->printPathComment($this->relativizePathsInString($definition->getPath()), $indentCount);
         if ($this->getParameter('expand')) {
             $this->maxLineLength = max($this->maxLineLength, $nameLength);
         }
     } else {
         $this->writeln();
     }
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 protected function printStepName(StepNode $step, DefinitionInterface $definition = null, $color)
 {
     $type = $step->getType();
     $text = $this->inOutlineSteps ? $step->getCleanText() : $step->getText();
     if (null !== $definition) {
         $text = $this->colorizeDefinitionArguments($text, $definition, $color);
     }
     $this->writeln('<span class="keyword">' . $type . ' </span>');
     $this->writeln('<span class="text">' . $text . '</span>');
 }
Пример #4
0
 /**
  * Prints step definition path.
  *
  * @param   Behat\Gherkin\Node\StepNode         $step       step node
  * @param   Behat\Behat\Definition\Definition   $definition definition (if found one)
  *
  * @uses    printPathComment()
  */
 protected function printStepDefinitionPath(StepNode $step, Definition $definition)
 {
     $type = $step->getType();
     $text = $this->inOutlineSteps ? $step->getCleanText() : $step->getText();
     $nameLength = mb_strlen("    {$type} {$text}");
     $indentCount = $nameLength > $this->maxLineLength ? 0 : $this->maxLineLength - $nameLength;
     $this->printPathComment($definition->getFile(), $definition->getLine(), $indentCount);
 }