本文整理汇总了PHP中Behat\Gherkin\Node\TableNode::getTableAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP TableNode::getTableAsString方法的具体用法?PHP TableNode::getTableAsString怎么用?PHP TableNode::getTableAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Gherkin\Node\TableNode
的用法示例。
在下文中一共展示了TableNode::getTableAsString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetTableAsString
public function testGetTableAsString()
{
$table = new TableNode(array(5 => array('id', 'username', 'password'), 10 => array('42', 'everzet', 'qwerty'), 13 => array('2', 'antono', "pa\$sword")));
$expected = <<<TABLE
| id | username | password |
| 42 | everzet | qwerty |
| 2 | antono | pa\$sword |
TABLE;
$this->assertEquals($expected, $table->getTableAsString());
}
示例2: iShouldSeeTheFollowingInTheRepeatedElementWithinTheContextOfTheElement2
/**
* @Then I should see the following in the repeated :element element
*/
public function iShouldSeeTheFollowingInTheRepeatedElementWithinTheContextOfTheElement2($element, TableNode $table)
{
$elements = $this->getSession()->getPage()->findAll('css', $element);
$hash = $table->getHash();
/*foreach ( $elements as $index => $element ) {
try {
if ( ! $element->isVisible() ) {
unset( $elements[$index] );
}
} catch ( \Exception $e ) {
//do nothing.
}
}*/
$actual = array(array('text' => 'text'));
foreach ($elements as $n => $element) {
$actual[] = array('text' => $elements[$n]->getText());
}
$actual_table = new TableNode($actual);
if ($actual_table->getTableAsString() != $table->getTableAsString()) {
var_dump($table->table);
var_dump($actual_table->table);
throw new \Exception(sprintf("Found elements:\n %s", $actual_table->getTableAsString()));
}
}