Beispiel #1
0
 /**
  * Prints outline example result.
  *
  * @param TableNode $examples  examples table
  * @param integer   $iteration example row
  * @param integer   $result    result code
  * @param boolean   $isSkipped is outline example skipped
  *
  * @uses printColorizedTableRow()
  * @uses printOutlineExampleResultExceptions()
  */
 protected function printOutlineExampleResult(TableNode $examples, $iteration, $result, $isSkipped)
 {
     if (!$this->getParameter('expand')) {
         $color = $this->getResultColorCode($result);
         $this->printColorizedTableRow($examples->getRowAsString($iteration + 1), $color);
         $this->printOutlineExampleResultExceptions($examples, $this->delayedStepEvents);
     } else {
         $this->write('      ' . $examples->getKeyword() . ': ');
         $this->writeln('| ' . implode(' | ', $examples->getRow($iteration + 1)) . ' |');
         $this->stepIndent = '        ';
         foreach ($this->delayedStepEvents as $event) {
             $this->printStep($event->getStep(), $event->getResult(), $event->getDefinition(), $event->getSnippet(), $event->getException());
         }
         $this->stepIndent = '    ';
         if ($iteration < count($examples->getRows()) - 2) {
             $this->writeln();
         }
     }
 }
Beispiel #2
0
 public function testGetRowAsString()
 {
     $table = new TableNode(array(5 => array('username', 'password'), 10 => array('everzet', 'qwerty'), 13 => array('antono', 'pa$sword')));
     $this->assertEquals('| username | password |', $table->getRowAsString(0));
     $this->assertEquals('| antono   | pa$sword |', $table->getRowAsString(2));
 }
 /**
  * Dumps table node.
  *
  * @param  TableNode $tableNode Table node
  * @param  integer   $indent    Indentation
  * @return string
  */
 public function dumpTableNode(TableNode $tableNode, $indent = 0)
 {
     $len = sizeof($tableNode->getRows());
     $content = '';
     for ($i = 0; $i < $len; $i++) {
         $content .= PHP_EOL . $this->dumpIndent($indent) . $tableNode->getRowAsString($i);
     }
     return $content;
 }
Beispiel #4
0
 /**
  * Prints outline example result.
  *
  * @param   Behat\Gherkin\Node\TableNode    $examples   examples table
  * @param   integer                         $iteration  example row
  * @param   integer                         $result     result code
  * @param   boolean                         $isSkipped  is outline example skipped
  *
  * @uses    printColorizedTableRow()
  * @uses    printOutlineExampleResultExceptions()
  */
 protected function printOutlineExampleResult(TableNode $examples, $iteration, $result, $isSkipped)
 {
     $color = $this->getResultColorCode($result);
     $this->printColorizedTableRow($examples->getRowAsString($iteration + 1), $color);
     $this->printOutlineExampleResultExceptions($examples, $this->delayedStepEvents);
 }