/** * @Given /^I should not be logged in$/ */ public function iShouldNotBeLoggedIn() { WebTestCase::assertFalse($this->kernel->getContainer()->get('security.context')->getToken()->getUser() instanceof \Symfony\Component\Security\Core\User\UserInterface); }
/** * * @Given /^I should not see "([^"]*)" for the query "([^"]*)"$/ */ public function iShouldNotSeeForTheQuery($text, $cssQuery) { // http://neverstopbuilding.net/simple-method-for-checking-for-order-with-behat/ $items = array_map(function ($element) { return strtolower($element->getText()); }, $this->getPage()->findAll('css', $cssQuery)); $didFindIt = false; $textLower = strtolower($text); foreach ($items as $item) { if (strpos($item, $textLower) !== false) { $didFindIt = true; break; } } WebTestCase::assertFalse($didFindIt, "{$text} was found but should not."); }