本文整理匯總了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()));
}
}