You are here

public function PermissionsByTermDrupalSubContext::seeNotMenuItemMatchingText in Permissions by Term 8.2

@Then /^I should not see menu item text matching "([^"]*)"$/

File

tests/src/Behat/Context/permissions_by_term.behat.inc, line 376

Class

PermissionsByTermDrupalSubContext
Class PermissionsByTermContext

Namespace

Drupal\Tests\permissions_by_term\Behat\PermissionsByTermDrupalSubContext

Code

public function seeNotMenuItemMatchingText(string $text) : void {
  $xpath = '//*/ul/li/a[text() = "' . $text . '"]';
  $session = $this
    ->getSession();

  // get the mink session
  $element = $session
    ->getPage()
    ->find('xpath', $session
    ->getSelectorsHandler()
    ->selectorToXpath('xpath', $xpath));
  if ($element !== NULL) {
    throw new \InvalidArgumentException(sprintf('Could not evaluate XPath: "%s"', $xpath));
  }
}