/** * * @Then /^"([^"]*)" should precede "([^"]*)" for the query "([^"]*)"$/ */ public function shouldPrecedeForTheQuery($textBefore, $textAfter, $cssQuery) { // http://neverstopbuilding.net/simple-method-for-checking-for-order-with-behat/ $items = array_map(function ($element) { return $element->getText(); }, $this->getPage()->findAll('css', $cssQuery)); WebTestCase::assertTrue(in_array($textBefore, $items), 'The before text was not found!'); WebTestCase::assertTrue(in_array($textAfter, $items), 'The after text was not found!'); WebTestCase::assertGreaterThan(array_search($textBefore, $items), array_search($textAfter, $items), "{$textBefore} does not proceed {$textAfter}"); }