protected function TableDragTest::assertOrder in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/FunctionalJavascriptTests/TableDrag/TableDragTest.php \Drupal\FunctionalJavascriptTests\TableDrag\TableDragTest::assertOrder()
Asserts that several pieces of markup are in a given order in the page.
@todo Remove this and use the WebAssert method when #2817657 is done.
Parameters
string[] $items: An ordered list of strings.
Throws
\Behat\Mink\Exception\ExpectationException When any of the given string is not found.
1 call to TableDragTest::assertOrder()
- TableDragTest::testDragAndDrop in core/
tests/ Drupal/ FunctionalJavascriptTests/ TableDrag/ TableDragTest.php - Tests draggable table drag'n'drop.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ TableDrag/ TableDragTest.php, line 296
Class
- TableDragTest
- Tests draggable table.
Namespace
Drupal\FunctionalJavascriptTests\TableDragCode
protected function assertOrder(array $items) {
$session = $this
->getSession();
$text = $session
->getPage()
->getHtml();
$strings = [];
foreach ($items as $item) {
if (($pos = strpos($text, $item)) === FALSE) {
throw new ExpectationException("Cannot find '{$item}' in the page", $session
->getDriver());
}
$strings[$pos] = $item;
}
ksort($strings);
$this
->assertSame($items, array_values($strings), "Strings found on the page but incorrectly ordered.");
}