Add a new step: I should see “some text value” in the “Table Name” table.

The table name is generally specified by the <caption> element within the
<table> itself.
This commit is contained in:
madmatt 2014-02-05 12:22:15 +13:00
parent fe77d1dacb
commit b0faaac2a2

View File

@ -421,6 +421,24 @@ JS;
} }
} }
/**
* Finds a named <table> element. See {@link \Behat\Mink\Selector\NamedSelector} for ways to specify how to find
* the table. The easiest of these is adding a <caption> element to the table in question.
*
* @Then /^I should see "([^"]*)" in the "([^"]*)" table$/
*/
public function iShouldSeeInTheTable($value, $tableName) {
// Get table
$page = $this->getSession()->getPage();
$table = $page->find('named', array('table', "$tableName"));
if($table) {
assertContains($value, $table->getText(), "Couldn't find '$value' in the '$tableName' table");
} else {
throw new \InvalidArgumentException("Couldn't find a table called '$tableName'");
}
}
/** /**
* Transforms relative time statements compatible with strtotime(). * Transforms relative time statements compatible with strtotime().
* Example: "time of 1 hour ago" might return "22:00:00" if its currently "23:00:00". * Example: "time of 1 hour ago" might return "22:00:00" if its currently "23:00:00".