コード例 #1
0
    /**
     * Test getCleanRows from ExampleTableNode
     * @see Behat\Gherkin\Node\ExampleTableNode::getCleanRows()
     */
    public function testExampleTableNodeGetCleanRows()
    {
        $table = new TableNode(<<<TABLE
| <field1> | <value1> |
| <field2> | <value2> |
| test     | 123      |
TABLE
);
        $tokens = array("field1" => "lorem", "value1" => "ipsum", "field1" => "val", "value1" => "321");
        $exampleTable = new ExampleTableNode($table, $tokens);
        $this->assertEquals(array(array("<field1>", "<value1>"), array("<field2>", "<value2>"), array("test", "123")), $exampleTable->getCleanRows());
    }
コード例 #2
0
 /**
  * Prints examples table header.
  *
  * @param OutputPrinter    $printer
  * @param ExampleTableNode $table
  */
 private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table)
 {
     $printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword()));
     $rowNum = 0;
     $wrapper = $this->getWrapperClosure();
     $row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper);
     $printer->writeln(sprintf('%s%s', $this->subIndentText, $row));
 }