You are here

public function PermissionsByTermDrupalSubContext::iShouldNotSeeTextAfterAWhile in Permissions by Term 8.2

@Then /^I should not see text matching "([^"]*)" after a while$/

File

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

Class

PermissionsByTermDrupalSubContext
Class PermissionsByTermContext

Namespace

Drupal\Tests\permissions_by_term\Behat\PermissionsByTermDrupalSubContext

Code

public function iShouldNotSeeTextAfterAWhile($text) {
  $startTime = time();
  do {
    $content = $this
      ->getSession()
      ->getPage()
      ->getText();
    if (substr_count($content, $text) === 0) {
      return true;
    }
  } while (time() - $startTime < self::MAX_SHORT_DURATION_SECONDS);
  throw new ResponseTextException(sprintf('Could find text %s after %s seconds', $text, self::MAX_SHORT_DURATION_SECONDS), $this
    ->getSession());
}