protected function MediaLibraryTestBase::waitForNoText in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::waitForNoText()
- 9 core/modules/media_library/tests/src/FunctionalJavascript/MediaLibraryTestBase.php \Drupal\Tests\media_library\FunctionalJavascript\MediaLibraryTestBase::waitForNoText()
Asserts that text does not appear on page after a wait.
@todo replace with whatever gets added in https://www.drupal.org/node/3061852
Parameters
string $text: The text that should not be on the page.
int $timeout: Timeout in milliseconds, defaults to 10000.
File
- core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ MediaLibraryTestBase.php, line 79
Class
- MediaLibraryTestBase
- Base class for functional tests of Media Library functionality.
Namespace
Drupal\Tests\media_library\FunctionalJavascriptCode
protected function waitForNoText($text, $timeout = 10000) {
$page = $this
->getSession()
->getPage();
$result = $page
->waitFor($timeout / 1000, function ($page) use ($text) {
$actual = preg_replace('/\\s+/u', ' ', $page
->getText());
$regex = '/' . preg_quote($text, '/') . '/ui';
return (bool) (!preg_match($regex, $actual));
});
$this
->assertNotEmpty($result, "\"{$text}\" was found but shouldn't be there.");
}