protected function MediaLibraryTestBase::waitForNoText in Drupal 9
Same name and namespace in other branches
- 8 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.
7 calls to MediaLibraryTestBase::waitForNoText()
- EntityReferenceWidgetTest::testWidget in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ EntityReferenceWidgetTest.php - Tests that the Media library's widget works as expected.
- MediaLibraryTestBase::pressInsertSelected in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ MediaLibraryTestBase.php - Presses the modal's "Insert selected" button.
- MediaOverviewTest::testAdministrationPage in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ MediaOverviewTest.php - Tests that the Media Library's administration page works as expected.
- WidgetOEmbedTest::testWidgetOEmbedAdvancedUi in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ WidgetOEmbedTest.php - Tests that oEmbed media can be added in the widget's advanced UI.
- WidgetUploadTest::testWidgetUpload in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ WidgetUploadTest.php - Tests that uploads in the Media library's widget works as expected.
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.");
}