From 068f00c4c9837dbdc048c3d5db06f3b1ec3c5647 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Wed, 28 Jul 2021 14:41:19 +0100 Subject: [PATCH] Issue #3191935 by mondrake, tedbow, xjm, alexpott, longwave: Replace usages of AssertLegacyTrait::assertNoText, which is deprecated --- .../src/Functional/ConfigurationTest.php | 4 +-- .../Functional/AggregatorRenderingTest.php | 2 +- .../src/Functional/FeedAdminDisplayTest.php | 18 +++++------ .../tests/src/Functional/BasicAuthTest.php | 4 +-- .../tests/src/Functional/BlockCacheTest.php | 8 ++--- .../tests/src/Functional/BlockInstallTest.php | 2 +- .../src/Functional/BlockLanguageTest.php | 14 ++++----- .../block/tests/src/Functional/BlockTest.php | 18 +++++------ .../tests/src/Functional/BlockUiTest.php | 4 +-- .../Functional/BlockContentCreationTest.php | 2 +- .../Functional/BlockContentRevisionsTest.php | 2 +- .../src/Functional/BlockContentTypeTest.php | 2 +- .../book/tests/src/Functional/BookTest.php | 4 +-- .../tests/src/Functional/CommentAdminTest.php | 2 +- .../tests/src/Functional/CommentBlockTest.php | 4 +-- .../tests/src/Functional/CommentBookTest.php | 2 +- .../src/Functional/CommentFieldsTest.php | 2 +- .../src/Functional/CommentInterfaceTest.php | 2 +- .../src/Functional/CommentNonNodeTest.php | 4 +-- .../tests/src/Functional/CommentPagerTest.php | 4 +-- .../tests/src/Functional/CommentTypeTest.php | 2 +- .../src/Functional/Views/CommentAdminTest.php | 2 +- .../Views/CommentRestExportTest.php | 4 +-- ...yMetadataConfigOverrideIntegrationTest.php | 2 +- .../Functional/ConfigDependencyWebTest.php | 12 +++---- .../ConfigEntityFormOverrideTest.php | 6 ++-- .../tests/src/Functional/ConfigEntityTest.php | 6 ++-- .../Functional/ConfigExportImportUITest.php | 14 ++++----- .../src/Functional/ConfigImportUITest.php | 18 +++++------ .../ConfigLanguageOverrideWebTest.php | 2 +- .../TransformedConfigExportImportUITest.php | 4 +-- .../ConfigTranslationOverviewTest.php | 2 +- .../Functional/ConfigTranslationUiTest.php | 16 +++++----- .../src/Functional/ContactPersonalTest.php | 2 +- .../src/Functional/ContactSitewideTest.php | 6 ++-- .../src/Functional/ContactStorageTest.php | 2 +- .../src/Functional/ModerationFormTest.php | 4 +-- .../Functional/ModerationStateNodeTest.php | 2 +- ...kspaceContentModerationIntegrationTest.php | 4 +-- .../ContentTranslationSettingsTest.php | 2 +- .../ContentTranslationUITestBase.php | 4 +-- .../Functional/Boolean/BooleanFieldTest.php | 2 +- ...erenceFieldTranslatedReferenceViewTest.php | 4 +-- .../EntityReferenceXSSTest.php | 2 +- .../tests/src/Functional/FieldAccessTest.php | 2 +- .../FieldImportDeleteUninstallUiTest.php | 2 +- .../field/tests/src/Functional/FormTest.php | 4 +-- .../Functional/ReEnableModuleFieldTest.php | 4 +-- .../src/Functional/FieldUIDeleteTest.php | 9 +++--- .../src/Functional/ManageDisplayTest.php | 2 +- .../FileFieldAnonymousSubmissionTest.php | 2 +- .../src/Functional/FileFieldDisplayTest.php | 2 +- .../src/Functional/FileFieldValidateTest.php | 2 +- .../Functional/FileManagedFileElementTest.php | 8 ++--- .../src/Functional/SaveUploadFormTest.php | 2 +- .../tests/src/Functional/FilterAdminTest.php | 2 +- .../src/Functional/FilterFormatAccessTest.php | 10 +++--- .../src/Functional/FilterSecurityTest.php | 4 +-- .../tests/src/Functional/ForumBlockTest.php | 6 ++-- .../tests/src/Functional/ForumIndexTest.php | 2 +- .../src/Functional/ForumNodeAccessTest.php | 2 +- .../forum/tests/src/Functional/ForumTest.php | 6 ++-- .../src/Functional/ExperimentalHelpTest.php | 2 +- .../tests/src/Functional/HelpBlockTest.php | 2 +- .../help/tests/src/Functional/HelpTest.php | 2 +- .../help/tests/src/Functional/NoHelpTest.php | 2 +- .../src/Functional/ImageAdminStylesTest.php | 2 +- .../src/Functional/ImageFieldValidateTest.php | 8 ++--- .../src/Functional/ImageFieldWidgetTest.php | 2 +- .../Functional/LanguageConfigurationTest.php | 2 +- .../tests/src/Functional/LinkFieldTest.php | 4 +-- .../Functional/LocaleImportFunctionalTest.php | 4 +-- .../src/Functional/LocalePluralFormatTest.php | 4 +-- .../Functional/LocaleTranslationUiTest.php | 16 +++++----- .../Functional/LocaleUpdateInterfaceTest.php | 2 +- .../tests/src/Functional/LocaleUpdateTest.php | 4 +-- .../tests/src/Functional/MenuUiNodeTest.php | 2 +- .../tests/src/Functional/MenuUiTest.php | 6 ++-- .../src/Functional/MigrateAccessTest.php | 2 +- .../NodeActionsConfigurationTest.php | 4 +-- .../Functional/NodeBlockFunctionalTest.php | 8 ++--- .../tests/src/Functional/NodeCreationTest.php | 4 +-- .../tests/src/Functional/NodeEditFormTest.php | 6 ++-- .../NodeEntityViewModeAlterTest.php | 2 +- .../src/Functional/NodeRSSContentTest.php | 4 +-- .../src/Functional/NodeRevisionsTest.php | 8 ++--- .../src/Functional/NodeTranslationUITest.php | 4 +-- .../tests/src/Functional/NodeTypeTest.php | 2 +- .../tests/src/Functional/PagePreviewTest.php | 4 +-- .../src/Functional/Views/BulkFormTest.php | 4 +-- .../Functional/Views/FilterNodeAccessTest.php | 8 ++--- .../src/Functional/Views/NodeLanguageTest.php | 24 +++++++------- .../src/Functional/Views/StatusExtraTest.php | 16 +++++----- .../tests/src/Functional/PathAliasTest.php | 14 ++++----- .../src/Functional/PathTaxonomyTermTest.php | 4 +-- .../Functional/ResponsiveImageAdminUITest.php | 2 +- .../Functional/Views/StyleSerializerTest.php | 2 +- .../SearchAdvancedSearchFormTest.php | 2 +- .../tests/src/Functional/SearchBlockTest.php | 6 ++-- .../SearchCommentCountToggleTest.php | 6 ++-- .../src/Functional/SearchCommentTest.php | 2 +- .../SearchConfigSettingsFormTest.php | 11 ++++--- .../src/Functional/SearchEmbedFormTest.php | 2 +- .../tests/src/Functional/SearchExactTest.php | 4 +-- .../SearchKeywordsConditionsTest.php | 2 +- .../SearchNodeUpdateAndDeletionTest.php | 2 +- .../Functional/SearchNumberMatchingTest.php | 2 +- .../src/Functional/SearchNumbersTest.php | 2 +- .../src/Functional/SearchPageTextTest.php | 12 +++---- .../src/Functional/SearchQueryAlterTest.php | 2 +- .../src/Functional/StatisticsAdminTest.php | 2 +- .../Bootstrap/DrupalMessengerServiceTest.php | 2 +- .../DrupalKernel/ContentNegotiationTest.php | 2 +- .../Functional/Entity/EntityRevisionsTest.php | 4 +-- .../tests/src/Functional/File/ConfigTest.php | 2 +- .../Functional/Form/ElementsAccessTest.php | 12 +++---- .../Form/FormStoragePageCacheTest.php | 4 +-- .../tests/src/Functional/Form/FormTest.php | 2 +- .../Form/ModulesListFormWebTest.php | 4 +-- .../src/Functional/Form/ValidationTest.php | 24 +++++++------- .../src/Functional/Menu/MenuRouterTest.php | 6 ++-- .../src/Functional/Module/ClassLoaderTest.php | 4 +-- .../Module/ExperimentalModuleTest.php | 20 ++++++------ .../Module/PrepareUninstallTest.php | 6 ++-- .../src/Functional/Module/UninstallTest.php | 6 ++-- .../Functional/Session/SessionHttpsTest.php | 2 +- .../src/Functional/Session/SessionTest.php | 8 ++--- .../Functional/System/AccessDeniedTest.php | 2 +- .../src/Functional/System/CronRunTest.php | 2 +- .../System/DateFormatsLockedTest.php | 2 +- .../src/Functional/System/DateTimeTest.php | 2 +- .../src/Functional/System/FrontPageTest.php | 4 +-- .../Functional/System/PageNotFoundTest.php | 4 +-- .../Functional/System/SiteMaintenanceTest.php | 4 +-- .../src/Functional/System/StatusTest.php | 2 +- .../Functional/System/SystemAuthorizeTest.php | 2 +- .../tests/src/Functional/System/ThemeTest.php | 12 +++---- .../Theme/ExperimentalThemeTest.php | 18 +++++------ .../tests/src/Functional/Theme/FastTest.php | 2 +- .../tests/src/Functional/Theme/ThemeTest.php | 2 +- .../src/Functional/Theme/ThemeUiTest.php | 6 ++-- .../Functional/Theme/TwigExtensionTest.php | 2 +- .../src/Functional/Theme/TwigTransTest.php | 2 +- .../UpdatePathTestBaseFilledTest.php | 4 +-- .../UpdateSystem/UpdateScriptTest.php | 10 +++--- .../tests/src/Functional/TermTest.php | 8 ++--- .../TermTranslationFieldViewTest.php | 4 +-- .../Functional/Views/TaxonomyParentUITest.php | 2 +- .../Functional/Views/TaxonomyTermViewTest.php | 4 +-- .../Views/TaxonomyVocabularyArgumentTest.php | 2 +- .../src/Functional/ToolbarAdminMenuTest.php | 2 +- .../Functional/ToolbarMenuTranslationTest.php | 2 +- .../tests/src/Functional/TourHelpPageTest.php | 4 +-- .../src/Functional/TrackerNodeAccessTest.php | 4 +-- .../tests/src/Functional/TrackerTest.php | 10 +++--- .../FileTransferAuthorizeFormTest.php | 2 +- .../src/Functional/UpdateContribTest.php | 17 +++++----- .../src/Functional/UpdateSemverCoreTest.php | 24 +++++++------- .../tests/src/Functional/UpdateTestBase.php | 2 +- .../tests/src/Functional/UpdateUploadTest.php | 14 ++++----- .../tests/src/Functional/UserAdminTest.php | 31 +++++++++++++------ .../tests/src/Functional/UserBlocksTest.php | 10 +++--- .../tests/src/Functional/UserCancelTest.php | 2 +- .../src/Functional/UserCreateFailMailTest.php | 2 +- .../tests/src/Functional/UserCreateTest.php | 2 +- .../src/Functional/UserPasswordResetTest.php | 6 ++-- .../src/Functional/UserRegistrationTest.php | 2 +- .../src/Functional/UserRoleAdminTest.php | 4 +-- .../Views/FilterPermissionUiTest.php | 4 +-- .../Functional/Views/HandlerFieldRoleTest.php | 2 +- .../Views/UserFieldsAccessChangeTest.php | 6 ++-- .../Functional/Entity/BaseFieldAccessTest.php | 2 +- .../src/Functional/Plugin/DisplayTest.php | 6 ++-- .../Plugin/ExposedFormCheckboxesTest.php | 6 ++-- .../src/Functional/Plugin/ExposedFormTest.php | 14 ++++++--- .../src/Functional/Plugin/FilterTest.php | 2 +- .../src/Functional/Plugin/MenuLinkTest.php | 2 +- .../src/Functional/Plugin/MiniPagerTest.php | 24 +++++++------- .../src/Functional/Plugin/ViewsBulkTest.php | 4 +-- .../tests/src/Functional/Wizard/BasicTest.php | 16 +++++----- .../Functional/Wizard/ItemsPerPageTest.php | 10 +++--- .../src/Functional/Wizard/TaggedWithTest.php | 6 ++-- .../tests/src/Functional/DefaultViewsTest.php | 2 +- .../src/Functional/DisplayAttachmentTest.php | 2 +- .../tests/src/Functional/DisplayCRUDTest.php | 2 +- .../tests/src/Functional/DisplayTest.php | 12 ++++--- .../src/Functional/FilterNumericWebTest.php | 20 ++++++------ .../tests/src/Functional/HandlerTest.php | 4 +-- .../src/Functional/OverrideDisplaysTest.php | 22 ++++++------- .../tests/src/Functional/StyleUITest.php | 2 +- .../src/Functional/TranslatedViewTest.php | 2 +- .../tests/src/Functional/StandardTest.php | 10 +++--- .../FunctionalTests/BrowserTestBaseTest.php | 3 +- ...istributionProfileExistingSettingsTest.php | 2 +- .../Installer/DistributionProfileTest.php | 2 +- ...istributionProfileTranslationQueryTest.php | 4 +-- .../DistributionProfileTranslationTest.php | 4 +-- .../InstallerExistingConfigNoConfigTest.php | 2 +- ...nstallerExistingConfigNoSystemSiteTest.php | 2 +- ...ConfigSyncDriectoryProfileMismatchTest.php | 2 +- ...stallerTranslationMultipleLanguageTest.php | 2 +- .../InstallerTranslationQueryTest.php | 2 +- .../Installer/InstallerTranslationTest.php | 2 +- .../MultipleDistributionsProfileTest.php | 2 +- .../Listeners/DeprecationListenerTrait.php | 1 - .../Drupal/Tests/RequirementsPageTrait.php | 4 +-- 206 files changed, 565 insertions(+), 543 deletions(-) diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php index 98b79c55eb7c..2a8d1b421980 100644 --- a/core/modules/action/tests/src/Functional/ConfigurationTest.php +++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php @@ -71,7 +71,7 @@ public function testActionConfiguration() { // Make sure that the action updated properly. $this->assertSession()->pageTextContains('The action has been successfully saved.'); // The old action label does NOT appear on the configuration page. - $this->assertNoText($action_label); + $this->assertSession()->pageTextNotContains($action_label); // The action label appears on the configuration page after we've updated // the complex action. $this->assertSession()->pageTextContains($new_action_label); @@ -93,7 +93,7 @@ public function testActionConfiguration() { $this->drupalGet('admin/config/system/actions'); $this->assertSession()->statusCodeEquals(200); // The action label does not appear on the overview page. - $this->assertNoText($new_action_label); + $this->assertSession()->pageTextNotContains($new_action_label); $action = Action::load($action_id); $this->assertNull($action, 'Make sure the action is gone after being deleted.'); diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php index ecf7e5e15be5..f5bc4d77660c 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorRenderingTest.php @@ -80,7 +80,7 @@ public function testBlockLinks() { $block->save(); // Check that the block is no longer displayed. $this->drupalGet('test-page'); - $this->assertNoText($block->label()); + $this->assertSession()->pageTextNotContains($block->label()); } /** diff --git a/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php index 6cb4a774736e..91650bda2aba 100644 --- a/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php +++ b/core/modules/aggregator/tests/src/Functional/FeedAdminDisplayTest.php @@ -28,16 +28,16 @@ public function testFeedUpdateFields() { // scheduled. $this->assertSession()->pageTextContains('never'); $this->assertSession()->pageTextContains('imminently'); - $this->assertNoText('ago'); - $this->assertNoText('left'); + $this->assertSession()->pageTextNotContains('ago'); + $this->assertSession()->pageTextNotContains('left'); $this->updateFeedItems($scheduled_feed); $this->drupalGet('admin/config/services/aggregator'); // After the update, an interval should be displayed on both last updated // and next update. - $this->assertNoText('never'); - $this->assertNoText('imminently'); + $this->assertSession()->pageTextNotContains('never'); + $this->assertSession()->pageTextNotContains('imminently'); $this->assertSession()->pageTextContains('ago'); $this->assertSession()->pageTextContains('left'); @@ -50,9 +50,9 @@ public function testFeedUpdateFields() { $this->drupalGet('admin/config/services/aggregator'); // The non scheduled feed shows that it has not been updated yet. $this->assertSession()->pageTextContains('never'); - $this->assertNoText('imminently'); - $this->assertNoText('ago'); - $this->assertNoText('left'); + $this->assertSession()->pageTextNotContains('imminently'); + $this->assertSession()->pageTextNotContains('ago'); + $this->assertSession()->pageTextNotContains('left'); $this->updateFeedItems($non_scheduled_feed); $this->drupalGet('admin/config/services/aggregator'); @@ -60,9 +60,9 @@ public function testFeedUpdateFields() { // After the feed update, we still need to see "never" as next update label. // Last update will show an interval. $this->assertSession()->pageTextContains('never'); - $this->assertNoText('imminently'); + $this->assertSession()->pageTextNotContains('imminently'); $this->assertSession()->pageTextContains('ago'); - $this->assertNoText('left'); + $this->assertSession()->pageTextNotContains('left'); } /** diff --git a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php index 7a2f13fb3a8d..39eddebf86d2 100644 --- a/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php +++ b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php @@ -57,7 +57,7 @@ public function testBasicAuth() { // Ensure that invalid authentication details give access denied. $this->basicAuthGet($url, $account->getAccountName(), $this->randomMachineName()); - $this->assertNoText($account->getAccountName()); + $this->assertSession()->pageTextNotContains($account->getAccountName()); $this->assertSession()->statusCodeEquals(403); $this->mink->resetSessions(); @@ -179,7 +179,7 @@ public function testUnauthorizedErrorMessage() { // unauthorized message is displayed. $this->drupalGet($url); $this->assertSession()->statusCodeEquals(401); - $this->assertNoText('Exception'); + $this->assertSession()->pageTextNotContains('Exception'); $this->assertSession()->pageTextContains('Please log in to access this page.'); // Case when empty credentials are passed, a user friendly access denied diff --git a/core/modules/block/tests/src/Functional/BlockCacheTest.php b/core/modules/block/tests/src/Functional/BlockCacheTest.php index 9ed66f3ed627..827c13ab0ed7 100644 --- a/core/modules/block/tests/src/Functional/BlockCacheTest.php +++ b/core/modules/block/tests/src/Functional/BlockCacheTest.php @@ -97,7 +97,7 @@ public function testCachePerRole() { // Clear the cache and verify that the stale data is no longer there. Cache::invalidateTags(['block_view']); $this->drupalGet(''); - $this->assertNoText($old_content); + $this->assertSession()->pageTextNotContains($old_content); // Fresh block content is displayed after clearing the cache. $this->assertSession()->pageTextContains($current_content); @@ -108,7 +108,7 @@ public function testCachePerRole() { $this->drupalLogout(); $this->drupalGet(''); // Anonymous user does not see content cached per-role for normal user. - $this->assertNoText($old_content); + $this->assertSession()->pageTextNotContains($old_content); // User with the same roles sees per-role cached content. $this->drupalLogin($this->normalUserAlt); @@ -118,7 +118,7 @@ public function testCachePerRole() { // Admin user does not see content cached per-role for normal user. $this->drupalLogin($this->adminUser); $this->drupalGet(''); - $this->assertNoText($old_content); + $this->assertSession()->pageTextNotContains($old_content); // Block is served from the per-role cache. $this->drupalLogin($this->normalUser); @@ -227,7 +227,7 @@ public function testCachePerPage() { $this->assertSession()->statusCodeEquals(200); // Verify that block content cached for the test page does not show up // for the user page. - $this->assertNoText($old_content); + $this->assertSession()->pageTextNotContains($old_content); $this->drupalGet('test-page'); $this->assertSession()->statusCodeEquals(200); // Verify that the block content is cached for the test page. diff --git a/core/modules/block/tests/src/Functional/BlockInstallTest.php b/core/modules/block/tests/src/Functional/BlockInstallTest.php index ad79cb59fdbc..32b6855a1dab 100644 --- a/core/modules/block/tests/src/Functional/BlockInstallTest.php +++ b/core/modules/block/tests/src/Functional/BlockInstallTest.php @@ -19,7 +19,7 @@ class BlockInstallTest extends BrowserTestBase { public function testCacheTagInvalidationUponInstallation() { // Warm the page cache. $this->drupalGet(''); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:block_list'); // Install the block module, and place the "Powered by Drupal" block. diff --git a/core/modules/block/tests/src/Functional/BlockLanguageTest.php b/core/modules/block/tests/src/Functional/BlockLanguageTest.php index c8ec72d0b879..a55a0f47b716 100644 --- a/core/modules/block/tests/src/Functional/BlockLanguageTest.php +++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php @@ -84,7 +84,7 @@ public function testLanguageBlockVisibility() { // Check that a page doesn't has a block for the current language anymore. $this->drupalGet('fr'); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); } /** @@ -162,7 +162,7 @@ public function testMultipleLanguageTypes() { // Interface negotiation depends on request arguments. $this->drupalGet('node', ['query' => ['language' => 'en']]); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->drupalGet('node', ['query' => ['language' => 'fr']]); $this->assertSession()->pageTextContains('Powered by Drupal'); @@ -174,9 +174,9 @@ public function testMultipleLanguageTypes() { // Content language does not depend on session/request arguments. // It will fall back on English (site default) and not display the block. $this->drupalGet('en'); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->drupalGet('fr'); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); // Change visibility to now depend on content language for this block. $edit = [ @@ -188,13 +188,13 @@ public function testMultipleLanguageTypes() { // Content language negotiation does not depend on request arguments. // It will fall back on English (site default) and not display the block. $this->drupalGet('node', ['query' => ['language' => 'en']]); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->drupalGet('node', ['query' => ['language' => 'fr']]); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); // Content language negotiation depends on path prefix. $this->drupalGet('en'); - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->drupalGet('fr'); $this->assertSession()->pageTextContains('Powered by Drupal'); } diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index 262985eff01b..dce57b896d3e 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -56,15 +56,15 @@ public function testBlockVisibility() { // Confirm that the block is not displayed according to block visibility // rules. $this->drupalGet('user'); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); // Confirm that the block is not displayed to anonymous users. $this->drupalLogout(); $this->drupalGet(''); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); // Confirm that an empty block is not displayed. - $this->assertNoText('Powered by Drupal'); + $this->assertSession()->pageTextNotContains('Powered by Drupal'); $this->assertNoRaw('sidebar-first'); } @@ -129,17 +129,17 @@ public function testBlockVisibilityListedEmpty() { // Confirm that block was not displayed according to block visibility // rules. $this->drupalGet('user'); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); // Confirm that block was not displayed according to block visibility // rules regardless of path case. $this->drupalGet('USER'); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); // Confirm that the block is not displayed to anonymous users. $this->drupalLogout(); $this->drupalGet(''); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } /** @@ -235,7 +235,7 @@ public function testBlock() { // Confirm that the block instance title and markup are not displayed. $this->drupalGet('node'); - $this->assertNoText($block['settings[label]']); + $this->assertSession()->pageTextNotContains($block['settings[label]']); // Check for <div id="block-my-block-instance-name"> if the machine name // is my_block_instance_name. $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/*', [':id' => 'block-' . str_replace('_', '-', strtolower($block['id']))]); @@ -324,7 +324,7 @@ public function testHideBlockTitle() { // Confirm that the block is not displayed by default. $this->drupalGet('user'); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); $edit = [ 'settings[label_display]' => TRUE, @@ -532,7 +532,7 @@ public function testBlockAccess() { $this->drupalPlaceBlock('test_access', ['region' => 'help']); $this->drupalGet('<front>'); - $this->assertNoText('Hello test world'); + $this->assertSession()->pageTextNotContains('Hello test world'); \Drupal::state()->set('test_block_access', TRUE); $this->drupalGet('<front>'); diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php index c55d62fd41ef..a8d0b5c2982e 100644 --- a/core/modules/block/tests/src/Functional/BlockUiTest.php +++ b/core/modules/block/tests/src/Functional/BlockUiTest.php @@ -216,7 +216,7 @@ public function testContextAwareUnsatisfiedBlocks() { public function testContextAwareBlocks() { $expected_text = '<div id="test_context_aware--username">' . \Drupal::currentUser()->getAccountName() . '</div>'; $this->drupalGet(''); - $this->assertNoText('Test context-aware block'); + $this->assertSession()->pageTextNotContains('Test context-aware block'); $this->assertNoRaw($expected_text); $block_url = 'admin/structure/block/add/test_context_aware/classy'; @@ -260,7 +260,7 @@ public function testContextAwareBlocks() { $this->submitForm($edit, 'Save block'); $this->drupalGet(''); $this->assertSession()->pageTextContains('No context mapping selected.'); - $this->assertNoText('User context found.'); + $this->assertSession()->pageTextNotContains('User context found.'); // Tests that conditions with missing context are not displayed. $this->drupalGet('admin/structure/block/manage/testcontextawareblock'); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index b6f4398cfdf6..ebe9fcd98887 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -285,7 +285,7 @@ public function testBlockDelete() { // Show the delete confirm form. $this->drupalGet('block/3/delete'); - $this->assertNoText('This will also remove'); + $this->assertSession()->pageTextNotContains('This will also remove'); } /** diff --git a/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php index 7762fc1e4c40..59c556ca5b13 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php @@ -98,7 +98,7 @@ public function testRevisions() { // Confirm that revision body text is not present on default version of // block. $this->drupalGet('block/' . $loaded->id()); - $this->assertNoText($loaded->body->value); + $this->assertSession()->pageTextNotContains($loaded->body->value); // Verify that the non-default revision id is greater than the default // revision id. diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index 937a63c488f4..44fff904e0c9 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -178,7 +178,7 @@ public function testBlockContentTypeDeletion() { $this->assertRaw( t('%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', ['%label' => $type->label()]) ); - $this->assertNoText('This action cannot be undone.'); + $this->assertSession()->pageTextNotContains('This action cannot be undone.'); // Delete the block. $block->delete(); diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php index da9ee82ec0a5..5160ce303138 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -310,7 +310,7 @@ public function testBookNavigationBlock() { // Link to book root. $this->assertSession()->pageTextContains($this->book->label()); // No links to individual book pages. - $this->assertNoText($nodes[0]->label()); + $this->assertSession()->pageTextNotContains($nodes[0]->label()); // Ensure that an unpublished node does not appear in the navigation for a // user without access. By unpublishing a parent page, child pages should @@ -419,7 +419,7 @@ public function testNavigationBlockOnAccessModuleInstalled() { // Test the 'book pages' block_mode setting. $this->drupalGet('<front>'); - $this->assertNoText($block->label()); + $this->assertSession()->pageTextNotContains($block->label()); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/CommentAdminTest.php index cb0ef684945f..cbc3991f7032 100644 --- a/core/modules/comment/tests/src/Functional/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAdminTest.php @@ -116,7 +116,7 @@ public function testApprovalAdminInterface() { $this->assertSession()->pageTextContains(Html::escape($this->node->label())); $this->node->setUnpublished()->save(); $this->drupalGet('admin/content/comment'); - $this->assertNoText(Html::escape($this->node->label())); + $this->assertSession()->pageTextNotContains(Html::escape($this->node->label())); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/core/modules/comment/tests/src/Functional/CommentBlockTest.php index 29ebe8f9c87b..1392b0556e9a 100644 --- a/core/modules/comment/tests/src/Functional/CommentBlockTest.php +++ b/core/modules/comment/tests/src/Functional/CommentBlockTest.php @@ -60,7 +60,7 @@ public function testRecentCommentBlock() { $this->drupalLogout(); user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']); $this->drupalGet(''); - $this->assertNoText('Recent comments'); + $this->assertSession()->pageTextNotContains('Recent comments'); user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access comments']); // Test that a user with the 'access comments' permission can see the @@ -70,7 +70,7 @@ public function testRecentCommentBlock() { $this->assertSession()->pageTextContains('Recent comments'); // Test the only the 10 latest comments are shown and in the proper order. - $this->assertNoText($comments[10]->getSubject()); + $this->assertSession()->pageTextNotContains($comments[10]->getSubject()); for ($i = 0; $i < 10; $i++) { $this->assertSession()->pageTextContains($comments[$i]->getSubject()); if ($i > 1) { diff --git a/core/modules/comment/tests/src/Functional/CommentBookTest.php b/core/modules/comment/tests/src/Functional/CommentBookTest.php index b9be39d688e1..cb66313edd82 100644 --- a/core/modules/comment/tests/src/Functional/CommentBookTest.php +++ b/core/modules/comment/tests/src/Functional/CommentBookTest.php @@ -81,7 +81,7 @@ public function testBookCommentPrint() { $this->assertSession()->pageTextContains($comment_subject); $this->assertSession()->pageTextContains($comment_body); - $this->assertNoText('Add new comment'); + $this->assertSession()->pageTextNotContains('Add new comment'); // Verify that the comment form subject field is not found. $this->assertSession()->fieldNotExists('subject[0][value]'); } diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php index 63da6fba76d0..71780ada8786 100644 --- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php @@ -183,7 +183,7 @@ public function testCommentFieldCreate() { $this->drupalGet('admin/config/people/accounts/fields/user.user.field_user_comment/storage'); $this->submitForm($edit, 'Save field settings'); // We shouldn't get an error message. - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index 8be8687d1c63..ceb2108c1334 100644 --- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -198,7 +198,7 @@ public function testCommentInterface() { $this->node = $this->drupalCreateNode(['type' => 'article', 'promote' => 1, 'comment' => [['status' => CommentItemInterface::OPEN]]]); $this->assertNotNull($this->node, 'Article node created.'); $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment'); - $this->assertNoText('This discussion is closed'); + $this->assertSession()->pageTextNotContains('This discussion is closed'); // Ensure that the comment body field exists. $this->assertSession()->fieldExists('edit-comment-body-0-value'); diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php index 68ab4a9af727..6f9a9691bf93 100644 --- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php @@ -341,7 +341,7 @@ public function testCommentFunctionality() { ]); $this->drupalLogin($limited_user); $this->drupalGet('admin/content/comment'); - $this->assertNoText($this->entity->label()); + $this->assertSession()->pageTextNotContains($this->entity->label()); $this->drupalLogout(); @@ -396,7 +396,7 @@ public function testCommentFunctionality() { $this->drupalGet('comment/reply/entity_test/' . $this->entity->id() . '/comment/' . $comment1->id()); $this->assertSession()->statusCodeEquals(403); - $this->assertNoText($comment1->getSubject()); + $this->assertSession()->pageTextNotContains($comment1->getSubject()); // Test comment field widget changes. $limited_user = $this->drupalCreateUser([ diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 9c11fef7a3eb..cca715da3e74 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -344,7 +344,7 @@ public function testTwoPagers() { $this->drupalLogin($account); $this->drupalGet('admin/structure/types/manage/article/display'); // No summary for standard pager. - $this->assertNoText('Pager ID: 0'); + $this->assertSession()->pageTextNotContains('Pager ID: 0'); $this->assertSession()->pageTextContains('Pager ID: 1'); $this->submitForm([], 'comment_settings_edit'); // Change default pager to 2. @@ -354,7 +354,7 @@ public function testTwoPagers() { $this->submitForm([], 'comment_settings_edit'); $this->submitForm(['fields[comment][settings_edit_form][settings][pager_id]' => 0], 'Save'); // No summary for standard pager. - $this->assertNoText('Pager ID: 0'); + $this->assertSession()->pageTextNotContains('Pager ID: 0'); $this->drupalLogin($this->adminUser); diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 2b9bc2efd2a1..a4a72a901833 100644 --- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -170,7 +170,7 @@ public function testCommentTypeDeletion() { '%field' => 'node.foo', ]) ); - $this->assertNoText('This action cannot be undone.'); + $this->assertSession()->pageTextNotContains('This action cannot be undone.'); // Delete the comment and the field. $comment->delete(); diff --git a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php index f754e84c7de2..9dd27c14bbb6 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php @@ -170,7 +170,7 @@ public function testApprovalAdminInterface() { $this->assertFalse($this->node->isPublished(), 'Node is unpublished now.'); $this->drupalGet('admin/content/comment'); // Verify that comment admin cannot see the title of an unpublished node. - $this->assertNoText(Html::escape($this->node->label())); + $this->assertSession()->pageTextNotContains(Html::escape($this->node->label())); $this->drupalLogout(); $node_access_user = $this->drupalCreateUser([ 'administer comments', diff --git a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php index eb327eb036e6..8253dcb43b90 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php @@ -70,8 +70,8 @@ public function testCommentRestExport() { // Ensure field-level access is respected - user shouldn't be able to see // mail or hostname fields. - $this->assertNoText('someone@example.com'); - $this->assertNoText('public.example.com'); + $this->assertSession()->responseNotContains('someone@example.com'); + $this->assertSession()->responseNotContains('public.example.com'); } } diff --git a/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php index e3aa2b7215c4..81a70d1b2d41 100644 --- a/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php +++ b/core/modules/config/tests/src/Functional/CacheabilityMetadataConfigOverrideIntegrationTest.php @@ -48,7 +48,7 @@ public function testConfigOverride() { // Check the default (disabled) state of the cache context. The block label // should not be overridden. $this->drupalGet('<front>'); - $this->assertNoText('Overridden block label'); + $this->assertSession()->pageTextNotContains('Overridden block label'); // Both the cache context and tag should be present. $this->assertCacheContext('config_override_integration_test'); diff --git a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php index 578d12700245..9007de192dfa 100644 --- a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php @@ -66,10 +66,10 @@ public function testConfigDependencyDeleteFormTrait() { $entity2->save(); $this->drupalGet($entity2->toUrl('delete-form')); - $this->assertNoText('Configuration updates'); - $this->assertNoText('Configuration deletions'); + $this->assertSession()->pageTextNotContains('Configuration updates'); + $this->assertSession()->pageTextNotContains('Configuration deletions'); $this->drupalGet($entity1->toUrl('delete-form')); - $this->assertNoText('Configuration updates'); + $this->assertSession()->pageTextNotContains('Configuration updates'); $this->assertSession()->pageTextContains('Configuration deletions'); $this->assertSession()->pageTextContains($entity2->id()); $this->drupalGet($entity1->toUrl('delete-form')); @@ -119,10 +119,10 @@ public function testConfigDependencyDeleteFormTrait() { $this->drupalGet($entity1->toUrl('delete-form')); $this->assertSession()->pageTextContains('Configuration updates'); - $this->assertNoText('Configuration deletions'); - $this->assertNoText($entity2->id()); + $this->assertSession()->pageTextNotContains('Configuration deletions'); + $this->assertSession()->pageTextNotContains($entity2->id()); $this->assertSession()->pageTextContains($entity2->label()); - $this->assertNoText($entity3->id()); + $this->assertSession()->pageTextNotContains($entity3->id()); $this->drupalGet($entity1->toUrl('delete-form')); $this->submitForm([], 'Delete'); $storage->resetCache(); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php index a363649a4965..bd2fcdece8f0 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php @@ -48,12 +48,12 @@ public function testFormsWithOverrides() { // Test that the original label on the listing page is intact. $this->drupalGet('admin/structure/config_test'); $this->assertSession()->pageTextContains($original_label); - $this->assertNoText($overridden_label); + $this->assertSession()->pageTextNotContains($overridden_label); // Test that the original label on the editing page is intact. $this->drupalGet('admin/structure/config_test/manage/dotted.default'); $this->assertSession()->fieldValueEquals('label', $original_label); - $this->assertNoText($overridden_label); + $this->assertSession()->pageTextNotContains($overridden_label); // Change to a new label and test that the listing now has the edited label. $edit = [ @@ -61,7 +61,7 @@ public function testFormsWithOverrides() { ]; $this->submitForm($edit, 'Save'); $this->drupalGet('admin/structure/config_test'); - $this->assertNoText($overridden_label); + $this->assertSession()->pageTextNotContains($overridden_label); $this->assertSession()->pageTextContains($edited_label); // Test that the editing page now has the edited label. diff --git a/core/modules/config/tests/src/Functional/ConfigEntityTest.php b/core/modules/config/tests/src/Functional/ConfigEntityTest.php index e170c3e14c1c..0520b2052634 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php @@ -273,7 +273,7 @@ public function testCRUDUI() { $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw($message_update); $this->assertRaw($message_delete); - $this->assertNoText($label1); + $this->assertSession()->pageTextNotContains($label1); $this->assertSession()->linkByHrefNotExists("admin/structure/config_test/manage/$id"); // Re-create a configuration entity. @@ -297,8 +297,8 @@ public function testCRUDUI() { $this->submitForm($edit, 'Save'); $this->assertSession()->addressEquals('admin/structure/config_test'); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText($label1); - $this->assertNoText($label2); + $this->assertSession()->pageTextNotContains($label1); + $this->assertSession()->pageTextNotContains($label2); $this->assertSession()->pageTextContains($label3); $this->assertSession()->linkByHrefNotExists("admin/structure/config_test/manage/$id"); $id = $edit['id']; diff --git a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php index 7f4553f18f71..73858fd7aaee 100644 --- a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php @@ -91,7 +91,7 @@ protected function setUp(): void { public function testExportImport() { // After installation there is no snapshot and nothing to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('Warning message'); + $this->assertSession()->pageTextNotContains('Warning message'); $this->assertSession()->pageTextContains('There are no configuration changes to import.'); $this->originalSlogan = $this->config('system.site')->get('slogan'); @@ -170,13 +170,13 @@ public function testExportImport() { $this->drupalGet('admin/config/development/configuration/full/import'); $this->submitForm(['files[import_tarball]' => $filename], 'Upload'); // There is no snapshot yet because an import has never run. - $this->assertNoText('Warning message'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('Warning message'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); $this->assertSession()->pageTextContains($this->contentType->label()); $this->submitForm([], 'Import all'); // After importing the snapshot has been updated and there are no warnings. - $this->assertNoText('Warning message'); + $this->assertSession()->pageTextNotContains('Warning message'); $this->assertSession()->pageTextContains('There are no configuration changes to import.'); $this->assertEquals($this->newSlogan, $this->config('system.site')->get('slogan')); @@ -197,8 +197,8 @@ public function testExportImport() { // active and snapshot should no longer exist. \Drupal::service('config.storage.sync')->deleteAll(); $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('Warning message'); - $this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); + $this->assertSession()->pageTextNotContains('Warning message'); + $this->assertSession()->pageTextNotContains('The following items in your active configuration have changes since the last import that may be lost on the next import.'); $this->assertSession()->pageTextContains('There are no configuration changes to import.'); // Write a file to sync. The warning about differences between the active // and snapshot should now exist. @@ -282,7 +282,7 @@ public function testExportImportCollections() { $this->submitForm(['files[import_tarball]' => $filename], 'Upload'); // Verify that there are configuration differences to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); $this->assertSession()->pageTextContains('collection.test1 configuration collection'); $this->assertSession()->pageTextContains('collection.test2 configuration collection'); $this->assertSession()->pageTextContains('config_test.create'); diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php index c4a60fdef00a..dd89f258307c 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -236,7 +236,7 @@ public function testImportLock() { // Verify that there are configuration differences to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); // Acquire a fake-lock on the import mechanism. $config_importer = $this->configImporter(); @@ -360,7 +360,7 @@ public function testImportValidation() { $this->prepareSiteNameUpdate($new_site_name); $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); $this->submitForm([], 'Import all'); // Verify that the validation messages appear. @@ -437,13 +437,13 @@ public function testImportErrorLog() { $sync->write($name_secondary, $values_secondary); // Verify that there are configuration differences to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); // Attempt to import configuration and verify that an error message appears. $this->submitForm([], 'Import all'); $this->assertSession()->pageTextContains('Deleted and replaced configuration entity "' . $name_secondary . '"'); $this->assertSession()->pageTextContains('The configuration was imported with errors.'); - $this->assertNoText('The configuration was imported successfully.'); + $this->assertSession()->pageTextNotContains('The configuration was imported successfully.'); $this->assertSession()->pageTextContains('There are no configuration changes to import.'); } @@ -484,11 +484,11 @@ public function testEntityBundleDelete() { $this->submitForm([], 'Import all'); $this->assertNoRaw($validation_message); $this->assertSession()->pageTextContains('There are no configuration changes to import.'); - $this->assertNoText('node.type.' . $node_type->id()); - $this->assertNoText('field.field.node.' . $node_type->id() . '.body'); - $this->assertNoText('core.entity_view_display.node.' . $node_type->id() . '.teaser'); - $this->assertNoText('core.entity_view_display.node.' . $node_type->id() . '.default'); - $this->assertNoText('core.entity_form_display.node.' . $node_type->id() . '.default'); + $this->assertSession()->pageTextNotContains('node.type.' . $node_type->id()); + $this->assertSession()->pageTextNotContains('field.field.node.' . $node_type->id() . '.body'); + $this->assertSession()->pageTextNotContains('core.entity_view_display.node.' . $node_type->id() . '.teaser'); + $this->assertSession()->pageTextNotContains('core.entity_view_display.node.' . $node_type->id() . '.default'); + $this->assertSession()->pageTextNotContains('core.entity_form_display.node.' . $node_type->id() . '.default'); } /** diff --git a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php index 7e6507b8fd8b..48df2cdfb09c 100644 --- a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php @@ -69,7 +69,7 @@ public function testSiteNameTranslation() { // The home page in English should not have the override. $this->drupalGet(''); - $this->assertNoText('XX site name'); + $this->assertSession()->pageTextNotContains('XX site name'); // During path resolution the system.site configuration object is used to // determine the front page. This occurs before language negotiation causing diff --git a/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php b/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php index c60850f61a9e..e42a5888e632 100644 --- a/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php +++ b/core/modules/config/tests/src/Functional/TransformedConfigExportImportUITest.php @@ -48,8 +48,8 @@ protected function setUp(): void { public function testTransformedExportImport() { // After installation there is no snapshot but a new site name. $this->drupalGet('admin/config/development/configuration'); - $this->assertNoText('Warning message'); - $this->assertNoText('There are no configuration changes to import.'); + $this->assertSession()->pageTextNotContains('Warning message'); + $this->assertSession()->pageTextNotContains('There are no configuration changes to import.'); // Tests changes of system.site. $this->drupalGet('admin/config/development/configuration/sync/diff/system.site'); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php index 0a8dc7959e96..535f7e4e33da 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php @@ -173,7 +173,7 @@ public function testListingPageWithOverrides() { // Test that the original label on the listing page is intact. $this->drupalGet('admin/config/regional/config-translation/config_test'); $this->assertSession()->pageTextContains($original_label); - $this->assertNoText($overridden_label); + $this->assertSession()->pageTextNotContains($overridden_label); } /** diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index 79f676676ae8..ddf6500921b5 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -217,18 +217,18 @@ public function testSiteInformationTranslationUi() { // Ensure that the label is in French (and not in English). $this->drupalGet("fr/$translation_base_url/fr/edit"); $this->assertSession()->pageTextContains($fr_site_name_label); - $this->assertNoText($site_name_label); + $this->assertSession()->pageTextNotContains($site_name_label); // Ensure that the label is also in French (and not in English) // when editing another language with the interface in French. $this->drupalGet("fr/$translation_base_url/ta/edit"); $this->assertSession()->pageTextContains($fr_site_name_label); - $this->assertNoText($site_name_label); + $this->assertSession()->pageTextNotContains($site_name_label); // Ensure that the label is not translated when the interface is in English. $this->drupalGet("$translation_base_url/fr/edit"); $this->assertSession()->pageTextContains($site_name_label); - $this->assertNoText($fr_site_name_label); + $this->assertSession()->pageTextNotContains($fr_site_name_label); } /** @@ -267,8 +267,8 @@ public function testSourceValueDuplicateSave() { $this->drupalGet("$translation_base_url/fr/edit"); // Assert that the language configuration does not leak outside of the // translation form into the actual site name and slogan. - $this->assertNoText('FR ' . $site_name); - $this->assertNoText('FR ' . $site_slogan); + $this->assertSession()->pageTextNotContains('FR ' . $site_name); + $this->assertSession()->pageTextNotContains('FR ' . $site_slogan); $edit = [ 'translation[config_names][system.site][name]' => $site_name, 'translation[config_names][system.site][slogan]' => 'FR ' . $site_slogan, @@ -283,7 +283,7 @@ public function testSourceValueDuplicateSave() { // Case 3: Keep default value for site name and slogan. $this->drupalGet("$translation_base_url/fr/edit"); - $this->assertNoText('FR ' . $site_slogan); + $this->assertSession()->pageTextNotContains('FR ' . $site_slogan); $edit = [ 'translation[config_names][system.site][name]' => $site_name, 'translation[config_names][system.site][slogan]' => $site_slogan, @@ -911,8 +911,8 @@ public function testAlterInfo() { // Check if the translation page does not have the altered out settings. $this->drupalGet('admin/config/people/accounts/translate/fr/add'); $this->assertSession()->pageTextContains('Name'); - $this->assertNoText('Account cancellation confirmation'); - $this->assertNoText('Password recovery'); + $this->assertSession()->pageTextNotContains('Account cancellation confirmation'); + $this->assertSession()->pageTextNotContains('Password recovery'); } /** diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index f8a50dd2ab10..90b1583643a1 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -277,7 +277,7 @@ public function testPersonalContactFlood() { // Test that the admin user can still access the contact form even though // the flood limit was reached. $this->drupalLogin($this->adminUser); - $this->assertNoText('Try again later.'); + $this->assertSession()->pageTextNotContains('Try again later.'); } /** diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 586e6203edd6..336b7b78ad39 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -214,7 +214,7 @@ public function testSiteWideContact() { $this->drupalLogout(); $this->drupalGet('contact'); $this->assertSession()->pageTextContains('Your email address'); - $this->assertNoText('Form'); + $this->assertSession()->pageTextNotContains('Form'); $this->drupalLogin($admin_user); // Add more forms. @@ -226,7 +226,7 @@ public function testSiteWideContact() { // Try adding a form that already exists. $this->addContactForm($name, $label, '', '', FALSE); - $this->assertNoText("Contact form $label has been added."); + $this->assertSession()->pageTextNotContains("Contact form $label has been added."); $this->assertRaw(t('The machine-readable name is already in use. It must be unique.')); $this->drupalLogout(); @@ -489,7 +489,7 @@ public function testAutoReply() { ->removeComponent('mail') ->save(); $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'foo', $this->randomString(128)); - $this->assertNoText('Unable to send email. Contact the site administrator if the problem persists.'); + $this->assertSession()->pageTextNotContains('Unable to send email. Contact the site administrator if the problem persists.'); $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]); $this->assertCount(0, $captured_emails); $this->drupalLogin($admin_user); diff --git a/core/modules/contact/tests/src/Functional/ContactStorageTest.php b/core/modules/contact/tests/src/Functional/ContactStorageTest.php index a2671caf15d8..ae67387b7758 100644 --- a/core/modules/contact/tests/src/Functional/ContactStorageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactStorageTest.php @@ -61,7 +61,7 @@ public function testContactStorage() { $this->drupalLogout(); $this->drupalGet('contact'); $this->assertSession()->pageTextContains('Your email address'); - $this->assertNoText('Form'); + $this->assertSession()->pageTextNotContains('Form'); $this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomMachineName(16), $id, $message = $this->randomMachineName(64)); $this->assertSession()->pageTextContains('Your message has been sent.'); diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php index 109dcc1fa247..391d3a0e51e5 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php @@ -215,7 +215,7 @@ public function testNonBundleModerationForm() { // default revision. $this->drupalGet('entity_test_mulrevpub/manage/1'); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('Status'); + $this->assertSession()->pageTextNotContains('Status'); // The latest version page should not show, because there is still no // pending revision. @@ -230,7 +230,7 @@ public function testNonBundleModerationForm() { // default revision. $this->drupalGet('entity_test_mulrevpub/manage/1'); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('Status'); + $this->assertSession()->pageTextNotContains('Status'); // The latest version page should show the moderation form and have "Draft" // status, because the pending revision is in "Draft". diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php index ab8ed697f4eb..6b39d4ea67f4 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php @@ -53,7 +53,7 @@ public function testCreatingContent() { $this->assertEquals('published', $node->moderation_state->value); // Verify that the state field is not shown. - $this->assertNoText('Published'); + $this->assertSession()->pageTextNotContains('Published'); // Delete the node. $this->drupalGet('node/' . $node->id() . '/delete'); diff --git a/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php b/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php index 9ee3d2434e74..4a292e5f9c66 100644 --- a/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php +++ b/core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php @@ -67,8 +67,8 @@ public function testModerationInWorkspace() { // Check that neither of them are visible in Live. $this->switchToLive(); $this->drupalGet('<front>'); - $this->assertNoText('First article'); - $this->assertNoText('Second article'); + $this->assertSession()->pageTextNotContains('First article'); + $this->assertSession()->pageTextNotContains('Second article'); // Switch back to Stage. $this->switchToWorkspace($stage); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index 91ec56987aa6..8a0ac44701ff 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -302,7 +302,7 @@ public function testFieldTranslatableSettingsUI() { $this->drupalGet($path); $this->assertSession()->fieldEnabled('edit-translatable'); $this->assertSession()->checkboxChecked('edit-translatable'); - $this->assertNoText('To enable translation of this field, enable language support for this type.'); + $this->assertSession()->pageTextNotContains('To enable translation of this field, enable language support for this type.'); } /** diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php index ea90c595f5b8..c0e6b5837c48 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php @@ -90,7 +90,7 @@ protected function doTestBasicTranslation() { $this->assertCacheContexts($this->defaultCacheContexts); $this->drupalGet($entity->toUrl('drupal:content-translation-overview')); - $this->assertNoText('Source language'); + $this->assertSession()->pageTextNotContains('Source language'); $translation = $this->getTranslation($entity, $default_langcode); foreach ($values[$default_langcode] as $property => $value) { @@ -164,7 +164,7 @@ protected function doTestBasicTranslation() { $storage->resetCache([$this->entityId]); $entity = $storage->load($this->entityId); $this->drupalGet($entity->toUrl('drupal:content-translation-overview')); - $this->assertNoText('Source language'); + $this->assertSession()->pageTextNotContains('Source language'); // Switch the source language. $langcode = 'fr'; diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php index 8d33d364e9a4..ef4efa877429 100644 --- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php +++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php @@ -137,7 +137,7 @@ public function testBooleanField() { $this->drupalGet('entity_test/add'); $this->assertSession()->fieldValueEquals("{$field_name}[value]", ''); $this->assertRaw($on); - $this->assertNoText($this->field->label()); + $this->assertSession()->pageTextNotContains($this->field->label()); // Test if we can change the on label. $on = $this->randomMachineName(); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php index 51e633cb4727..58b51dc7e0b7 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -183,10 +183,10 @@ protected function assertEntityReferenceDisplay() { $this->drupalGet($url); $this->assertSession()->pageTextContains($this->labelOfNotTranslatedReference); $this->assertSession()->pageTextContains($this->originalLabel); - $this->assertNoText($this->translatedLabel); + $this->assertSession()->pageTextNotContains($this->translatedLabel); $this->drupalGet($translation_url); $this->assertSession()->pageTextContains($this->labelOfNotTranslatedReference); - $this->assertNoText($this->originalLabel); + $this->assertSession()->pageTextNotContains($this->originalLabel); $this->assertSession()->pageTextContains($this->translatedLabel); } diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php index 2f0010360338..e45a903dad36 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php @@ -77,7 +77,7 @@ public function testEntityReferenceXSS() { $this->drupalGet('node/add/article'); $this->assertSession()->assertEscaped($referenced_node->getTitle()); // options_buttons does not support optgroups. - $this->assertNoText('bundle with markup'); + $this->assertSession()->pageTextNotContains('bundle with markup'); } } diff --git a/core/modules/field/tests/src/Functional/FieldAccessTest.php b/core/modules/field/tests/src/Functional/FieldAccessTest.php index ee3a469419f2..d96eb4f681a3 100644 --- a/core/modules/field/tests/src/Functional/FieldAccessTest.php +++ b/core/modules/field/tests/src/Functional/FieldAccessTest.php @@ -92,7 +92,7 @@ public function testFieldAccess() { // specifically target the 'test_view_field' field. $this->drupalLogout(); $this->drupalGet('node/' . $this->node->id()); - $this->assertNoText($this->testViewFieldValue); + $this->assertSession()->pageTextNotContains($this->testViewFieldValue); } } diff --git a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php index c2f9a51ba24d..38ed9b0d7fa6 100644 --- a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php +++ b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php @@ -117,7 +117,7 @@ public function testImportDeleteUninstall() { // This will purge all the data, delete the field and uninstall the // Telephone and Text modules. $this->submitForm([], 'Import all'); - $this->assertNoText('Field data will be deleted by this synchronization.'); + $this->assertSession()->pageTextNotContains('Field data will be deleted by this synchronization.'); $this->rebuildContainer(); $this->assertFalse(\Drupal::moduleHandler()->moduleExists('telephone')); $this->assertNull(\Drupal::service('entity.repository')->loadEntityByUuid('field_storage_config', $field_storage->uuid()), 'The telephone field has been deleted by the configuration synchronization'); diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index c1eeb7f2f16c..ed5e9983530e 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -128,10 +128,10 @@ public function testFieldFormSingle() { // Check that hook_field_widget_single_element_form_alter() does not believe // this is the default value form. - $this->assertNoText('From hook_field_widget_single_element_form_alter(): Default form is true.'); + $this->assertSession()->pageTextNotContains('From hook_field_widget_single_element_form_alter(): Default form is true.'); // Check that hook_field_widget_single_element_form_alter() does not believe // this is the default value form. - $this->assertNoText('From hook_field_widget_complete_form_alter(): Default form is true.'); + $this->assertSession()->pageTextNotContains('From hook_field_widget_complete_form_alter(): Default form is true.'); // Submit with invalid value (field-level validation). $edit = [ diff --git a/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php b/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php index 0225e4ff91d5..7c30d465e5fd 100644 --- a/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php +++ b/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php @@ -129,8 +129,8 @@ public function testReEnabledField() { $this->drupalGet('admin/modules/uninstall'); $this->assertSession()->pageTextContains('Fields pending deletion'); $this->cronRun(); - $this->assertNoText("The Telephone number field type is used in the following field: node.field_telephone"); - $this->assertNoText('Fields pending deletion'); + $this->assertSession()->pageTextNotContains("The Telephone number field type is used in the following field: node.field_telephone"); + $this->assertSession()->pageTextNotContains('Fields pending deletion'); } } diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php index 1feba737135e..00746fc6e41a 100644 --- a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php +++ b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php @@ -107,9 +107,9 @@ public function testDeleteField() { // Check the config dependencies of the first field, the field storage must // not be shown as being deleted yet. $this->drupalGet("$bundle_path1/fields/node.$type_name1.$field_name/delete"); - $this->assertNoText('The listed configuration will be deleted.'); - $this->assertNoText('View'); - $this->assertNoText('test_view_field_delete'); + $this->assertSession()->pageTextNotContains('The listed configuration will be deleted.'); + $this->assertSession()->elementNotExists('xpath', '//ul[@data-drupal-selector="edit-view"]'); + $this->assertSession()->pageTextNotContains('test_view_field_delete'); // Delete the first field. $this->fieldUIDeleteField($bundle_path1, "node.$type_name1.$field_name", $field_label, $type_name1); @@ -122,8 +122,7 @@ public function testDeleteField() { // Check the config dependencies of the first field. $this->drupalGet("$bundle_path2/fields/node.$type_name2.$field_name/delete"); $this->assertSession()->pageTextContains('The listed configuration will be updated.'); - $this->assertSession()->pageTextContains('View'); - $this->assertSession()->pageTextContains('test_view_field_delete'); + $this->assertSession()->elementTextEquals('xpath', '//ul[@data-drupal-selector="edit-view"]', 'test_view_field_delete'); $xml = $this->cssSelect('#edit-entity-deletes'); // Test that nothing is scheduled for deletion. diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index 8397d28d0c59..b64ca43fb769 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -193,7 +193,7 @@ public function testNonInitializedFields() { */ public function testSingleViewMode() { $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/display'); - $this->assertNoText('Use custom display settings for the following view modes'); + $this->assertSession()->pageTextNotContains('Use custom display settings for the following view modes'); // This may not trigger a notice when 'view_modes_custom' isn't available. $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display'); diff --git a/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php index af12289bbc2e..3fada0cc8d6a 100644 --- a/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldAnonymousSubmissionTest.php @@ -148,7 +148,7 @@ protected function doTestNodeWithFileWithoutTitle() { $this->submitForm($edit, $label); $this->assertSession()->statusCodeEquals(200); $t_args = ['@type' => $bundle_label, '%title' => $node_title]; - $this->assertNoText(strip_tags(t('@type %title has been created.', $t_args))); + $this->assertSession()->pageTextNotContains(strip_tags(t('@type %title has been created.', $t_args))); $this->assertSession()->pageTextContains('Title field is required.'); // Submit the form again but this time with the missing title field. This diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index ec960527e238..4299fff0410e 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -57,7 +57,7 @@ public function testNodeDisplay() { $this->submitForm($edit, 'Save'); $this->drupalGet('node/' . $node->id()); // Verify that the field label is hidden when no file is attached. - $this->assertNoText($field_name); + $this->assertSession()->pageTextNotContains($field_name); } $this->generateFile('escaped-&-text', 64, 10, 'text'); diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index fc16645a984a..97884b6a8b7d 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -191,7 +191,7 @@ public function testFileRemoval() { // Check that the file can still be removed. $this->removeNodeFile($nid); - $this->assertNoText('Only files with the following extensions are allowed: txt.'); + $this->assertSession()->pageTextNotContains('Only files with the following extensions are allowed: txt.'); $this->assertSession()->pageTextContains('Article ' . $node->getTitle() . ' has been updated.'); } diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php index 95cce218c77a..91390dc165fa 100644 --- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php +++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php @@ -215,7 +215,7 @@ public function testUnusedPermanentFileValidation() { // allowed to reference an unused file. $this->drupalGet('file/test/1/0/1/' . $file->id()); $this->submitForm([], 'Save'); - $this->assertNoText('The file used in the Managed file & butter field may not be referenced.'); + $this->assertSession()->pageTextNotContains('The file used in the Managed file & butter field may not be referenced.'); $this->assertSession()->pageTextContains('The file ids are ' . $file->id()); // Enable marking unused files as temporary, unused permanent files must not @@ -226,7 +226,7 @@ public function testUnusedPermanentFileValidation() { $this->drupalGet('file/test/1/0/1/' . $file->id()); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains('The file used in the Managed file & butter field may not be referenced.'); - $this->assertNoText('The file ids are ' . $file->id()); + $this->assertSession()->pageTextNotContains('The file ids are ' . $file->id()); // Make the file temporary, now using it is allowed. $file->setTemporary(); @@ -234,7 +234,7 @@ public function testUnusedPermanentFileValidation() { $this->drupalGet('file/test/1/0/1/' . $file->id()); $this->submitForm([], 'Save'); - $this->assertNoText('The file used in the Managed file & butter field may not be referenced.'); + $this->assertSession()->pageTextNotContains('The file used in the Managed file & butter field may not be referenced.'); $this->assertSession()->pageTextContains('The file ids are ' . $file->id()); // Make the file permanent again and add a usage from itself, referencing is @@ -248,7 +248,7 @@ public function testUnusedPermanentFileValidation() { $this->drupalGet('file/test/1/0/1/' . $file->id()); $this->submitForm([], 'Save'); - $this->assertNoText('The file used in the Managed file & butter field may not be referenced.'); + $this->assertSession()->pageTextNotContains('The file used in the Managed file & butter field may not be referenced.'); $this->assertSession()->pageTextContains('The file ids are ' . $file->id()); } diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index 9c0e7f5e193f..82646348e6c5 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -536,7 +536,7 @@ public function testErrorMessagesAreNotChanged() { // Ensure the error message is not present and the counts before and after // calling _file_save_upload_from_form() are correct. - $this->assertNoText($error); + $this->assertSession()->pageTextNotContains($error); $this->assertRaw('Number of error messages before _file_save_upload_from_form(): 0'); $this->assertRaw('Number of error messages after _file_save_upload_from_form(): 0'); } diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php index 84a2f4daec42..2643881ab0f9 100644 --- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php +++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -457,7 +457,7 @@ public function testDisabledFormat() { $this->drupalGet($node->toUrl()); // The format is not used anymore. - $this->assertNoText('filtered text'); + $this->assertSession()->pageTextNotContains('filtered text'); // The text is not displayed unfiltered or escaped. $this->assertNoRaw($body_value); $this->assertSession()->assertNoEscaped($body_value); diff --git a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php index 4d2284b80256..f3c513b2373e 100644 --- a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php +++ b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php @@ -241,7 +241,7 @@ public function testFormatWidgetPermissions() { // Save and verify that only the title was changed. $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($new_edit, 'Save'); - $this->assertNoText($edit['title[0][value]']); + $this->assertSession()->pageTextNotContains($edit['title[0][value]']); $this->assertSession()->pageTextContains($new_edit['title[0][value]']); $this->assertSession()->pageTextContains($edit[$body_value_key]); @@ -285,7 +285,7 @@ public function testFormatWidgetPermissions() { $this->assertSession()->pageTextContains('Text format field is required.'); $this->drupalGet('node/' . $node->id()); $this->assertSession()->pageTextContains($old_title); - $this->assertNoText($new_title); + $this->assertSession()->pageTextNotContains($new_title); // Now select a new text format and make sure the node can be saved. $edit[$body_format_key] = filter_fallback_format(); @@ -293,7 +293,7 @@ public function testFormatWidgetPermissions() { $this->submitForm($edit, 'Save'); $this->assertSession()->addressEquals('node/' . $node->id()); $this->assertSession()->pageTextContains($new_title); - $this->assertNoText($old_title); + $this->assertSession()->pageTextNotContains($old_title); // Switch the text format to a new one, then disable that format and all // other formats on the site (leaving only the fallback format). @@ -323,13 +323,13 @@ public function testFormatWidgetPermissions() { $this->assertSession()->pageTextContains('Text format field is required.'); $this->drupalGet('node/' . $node->id()); $this->assertSession()->pageTextContains($old_title); - $this->assertNoText($new_title); + $this->assertSession()->pageTextNotContains($new_title); $edit[$body_format_key] = filter_fallback_format(); $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); $this->assertSession()->addressEquals('node/' . $node->id()); $this->assertSession()->pageTextContains($new_title); - $this->assertNoText($old_title); + $this->assertSession()->pageTextNotContains($old_title); } /** diff --git a/core/modules/filter/tests/src/Functional/FilterSecurityTest.php b/core/modules/filter/tests/src/Functional/FilterSecurityTest.php index 3d8edb2af94a..76433f854f93 100644 --- a/core/modules/filter/tests/src/Functional/FilterSecurityTest.php +++ b/core/modules/filter/tests/src/Functional/FilterSecurityTest.php @@ -77,7 +77,7 @@ public function testDisableFilterModule() { // Verify that filter_test_replace filter replaced the content. $this->drupalGet('node/' . $node->id()); - $this->assertNoText($body_raw); + $this->assertSession()->pageTextNotContains($body_raw); $this->assertSession()->pageTextContains('Filter: Testing filter'); // Disable the text format entirely. @@ -86,7 +86,7 @@ public function testDisableFilterModule() { // Verify that the content is empty, because the text format does not exist. $this->drupalGet('node/' . $node->id()); - $this->assertNoText($body_raw); + $this->assertSession()->pageTextNotContains($body_raw); } /** diff --git a/core/modules/forum/tests/src/Functional/ForumBlockTest.php b/core/modules/forum/tests/src/Functional/ForumBlockTest.php index 01084cfcc085..426ddc4fcd22 100644 --- a/core/modules/forum/tests/src/Functional/ForumBlockTest.php +++ b/core/modules/forum/tests/src/Functional/ForumBlockTest.php @@ -78,7 +78,7 @@ public function testNewForumTopicsBlock() { $this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]])); } else { - $this->assertNoText($topics[$index]); + $this->assertSession()->pageTextNotContains($topics[$index]); } } } @@ -124,7 +124,7 @@ public function testActiveForumTopicsBlock() { $this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "Active forum topics" block.', ['@topic' => $topics[$index]])); } else { - $this->assertNoText($topics[$index]); + $this->assertSession()->pageTextNotContains($topics[$index]); } } @@ -141,7 +141,7 @@ public function testActiveForumTopicsBlock() { $this->assertSession()->linkExists($topics[$index], 0, 'Forum topic found in the "Active forum topics" block.'); } else { - $this->assertNoText($topics[$index]); + $this->assertSession()->pageTextNotContains($topics[$index]); } } } diff --git a/core/modules/forum/tests/src/Functional/ForumIndexTest.php b/core/modules/forum/tests/src/Functional/ForumIndexTest.php index cdc7a71d7611..d90c73d31ce6 100644 --- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php +++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php @@ -92,7 +92,7 @@ public function testForumIndexStatus() { // Verify that the node no longer appears on the index. $this->drupalGet('forum/' . $tid); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } } diff --git a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php index 50b29e1502fe..1ca15cb687c7 100644 --- a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php +++ b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php @@ -98,7 +98,7 @@ public function testForumNodeAccess() { $this->drupalGet(''); // Ensure private node is not found but public is found. - $this->assertNoText($private_node->getTitle()); + $this->assertSession()->pageTextNotContains($private_node->getTitle()); $this->assertSession()->pageTextContains($public_node->getTitle()); } diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php index eb212ad92a94..9a1847a2fee3 100644 --- a/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -491,8 +491,8 @@ public function deleteForum($tid) { $this->drupalGet('admin/structure/forum/edit/forum/' . $tid); $this->clickLink('Delete'); $this->assertSession()->pageTextContains('Are you sure you want to delete the forum'); - $this->assertNoText('Add forum'); - $this->assertNoText('Add forum container'); + $this->assertSession()->pageTextNotContains('Add forum'); + $this->assertSession()->pageTextNotContains('Add forum container'); $this->submitForm([], 'Delete'); // Assert that the forum no longer exists. @@ -585,7 +585,7 @@ public function createForumTopic($forum, $container = FALSE) { $type = t('Forum topic'); if ($container) { - $this->assertNoText("$type $title has been created."); + $this->assertSession()->pageTextNotContains("$type $title has been created."); $this->assertRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']])); return; } diff --git a/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php b/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php index 502557bb7365..b451ae62f5b4 100644 --- a/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php +++ b/core/modules/help/tests/src/Functional/ExperimentalHelpTest.php @@ -55,7 +55,7 @@ public function testExperimentalHelp() { // Regular modules should not display the message. $this->drupalGet('admin/help/help_page_test'); - $this->assertNoText('This module is experimental.'); + $this->assertSession()->pageTextNotContains('This module is experimental.'); // Ensure the actual help page is displayed to avoid a false positive. $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/help/tests/src/Functional/HelpBlockTest.php b/core/modules/help/tests/src/Functional/HelpBlockTest.php index 4e56e40f626e..590d45cccba8 100644 --- a/core/modules/help/tests/src/Functional/HelpBlockTest.php +++ b/core/modules/help/tests/src/Functional/HelpBlockTest.php @@ -48,7 +48,7 @@ public function testHelp() { $this->drupalGet('help_page_test/no_help'); // The help block should not appear when there is no help. - $this->assertNoText($this->helpBlock->label()); + $this->assertSession()->pageTextNotContains($this->helpBlock->label()); // Ensure that if two hook_help() implementations both return a render array // the output is as expected. diff --git a/core/modules/help/tests/src/Functional/HelpTest.php b/core/modules/help/tests/src/Functional/HelpTest.php index 05eac025809c..9e0e14c96ad2 100644 --- a/core/modules/help/tests/src/Functional/HelpTest.php +++ b/core/modules/help/tests/src/Functional/HelpTest.php @@ -123,7 +123,7 @@ protected function verifyHelp($response = 200) { $this->assertSession()->pageTextContains('This page shows you all available administration tasks for each module.'); } else { - $this->assertNoText('This page shows you all available administration tasks for each module.'); + $this->assertSession()->pageTextNotContains('This page shows you all available administration tasks for each module.'); } foreach ($this->getModuleList() as $module => $name) { diff --git a/core/modules/help/tests/src/Functional/NoHelpTest.php b/core/modules/help/tests/src/Functional/NoHelpTest.php index 1201f4743581..8d343f096dec 100644 --- a/core/modules/help/tests/src/Functional/NoHelpTest.php +++ b/core/modules/help/tests/src/Functional/NoHelpTest.php @@ -47,7 +47,7 @@ public function testMainPageNoHelp() { $this->assertFalse(\Drupal::moduleHandler()->implementsHook('menu_test', 'help'), 'The menu_test module does not implement hook_help'); // Make sure the test module menu_test does not display a help link on // admin/help. - $this->assertNoText(\Drupal::moduleHandler()->getName('menu_test')); + $this->assertSession()->pageTextNotContains(\Drupal::moduleHandler()->getName('menu_test')); // Ensure that the module overview help page for a module that does not // implement hook_help() results in a 404. diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php index 875135057e02..32ea357ba955 100644 --- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -397,7 +397,7 @@ public function testEditEffect() { $this->assertSession()->pageTextContains('Scale and crop 360×240'); // Check that the previous effect is replaced. - $this->assertNoText('Scale and crop 300×200'); + $this->assertSession()->pageTextNotContains('Scale and crop 300×200'); // Add another scale effect. $this->drupalGet('admin/config/media/image-styles/add'); diff --git a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php index cbb47a56057e..3f63813f59f8 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php @@ -197,8 +197,8 @@ public function testRequiredAttributes() { $this->drupalGet('node/add/article'); $this->submitForm($edit, 'Save'); - $this->assertNoText('Alternative text field is required.'); - $this->assertNoText('Title field is required.'); + $this->assertSession()->pageTextNotContains('Alternative text field is required.'); + $this->assertSession()->pageTextNotContains('Title field is required.'); $instance->setSetting('required', 0); $instance->setSetting('alt_field_required', 1); @@ -211,8 +211,8 @@ public function testRequiredAttributes() { $this->drupalGet('node/add/article'); $this->submitForm($edit, 'Save'); - $this->assertNoText('Alternative text field is required.'); - $this->assertNoText('Title field is required.'); + $this->assertSession()->pageTextNotContains('Alternative text field is required.'); + $this->assertSession()->pageTextNotContains('Title field is required.'); } /** diff --git a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php index b60b1d4c11bc..fb25470433f8 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php @@ -35,7 +35,7 @@ public function testWidgetElement() { $this->assertSession()->elementExists('xpath', '//div[contains(@class, "field--widget-image-image")]'); // Verify that the image field widget limits accepted files. $this->assertSession()->elementExists('xpath', '//input[contains(@accept, "image/*")]'); - $this->assertNoText('Image test on [site:name]'); + $this->assertSession()->pageTextNotContains('Image test on [site:name]'); // Check for allowed image file extensions - default. $this->assertSession()->pageTextContains('Allowed types: png gif jpg jpeg.'); diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php index 2e0292da0ac5..31db7e47af5c 100644 --- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php @@ -101,7 +101,7 @@ public function testLanguageConfiguration() { 'prefix[fr]' => '', ]; $this->submitForm($edit, 'Save configuration'); - $this->assertNoText('The prefix may only be left blank for the selected detection fallback language.'); + $this->assertSession()->pageTextNotContains('The prefix may only be left blank for the selected detection fallback language.'); // Change default negotiation language. $this->config('language.negotiation')->set('selected_langcode', 'fr')->save(); diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 2bc8656d2274..c6712dbec0c3 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -327,7 +327,7 @@ public function testLinkTitle() { "{$field_name}[0][uri]" => '', ]; $this->submitForm($edit, 'Save'); - $this->assertNoText('Link text field is required.'); + $this->assertSession()->pageTextNotContains('Link text field is required.'); // Verify that a URL and link text meets requirements. $this->drupalGet('entity_test/add'); @@ -336,7 +336,7 @@ public function testLinkTitle() { "{$field_name}[0][title]" => 'Example', ]; $this->submitForm($edit, 'Save'); - $this->assertNoText('Link text field is required.'); + $this->assertSession()->pageTextNotContains('Link text field is required.'); } } } diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php index 902e080cea2f..8b666737d6e7 100644 --- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php @@ -188,7 +188,7 @@ public function testStandalonePoFile() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // This import should have changed number of plural forms. $locale_plurals = \Drupal::service('locale.plural.formula')->reset()->getNumberOfPlurals('fr'); $this->assertEquals(3, $locale_plurals, 'Plural numbers changed.'); @@ -249,7 +249,7 @@ public function testStandalonePoFile() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); } diff --git a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php index 3cae3436e87e..160fe866b604 100644 --- a/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php +++ b/core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php @@ -280,7 +280,7 @@ public function testPluralEditExport() { $this->assertSession()->pageTextContains('Singular form'); $this->assertSession()->pageTextContains('First plural form'); $this->assertSession()->pageTextContains('2. plural form'); - $this->assertNoText('3. plural form'); + $this->assertSession()->pageTextNotContains('3. plural form'); // Plural values for langcode hr. $this->assertSession()->pageTextContains('@count sat'); @@ -309,7 +309,7 @@ public function testPluralEditExport() { // Plural values for the langcode fr. $this->assertSession()->pageTextContains('@count heure'); $this->assertSession()->pageTextContains('@count heures'); - $this->assertNoText('2. plural form'); + $this->assertSession()->pageTextNotContains('2. plural form'); // Edit langcode fr translations and see if that took effect. $edit = [ diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index d0ea227b8052..a5583aba0f93 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -243,7 +243,7 @@ public function testStringTranslation() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); } /** @@ -373,7 +373,7 @@ public function testStringValidation() { // Check for a form error on the textarea, which means the string was // rejected as unsafe. $this->assertSession()->elementAttributeContains('xpath', '//form[@id="locale-translate-edit-form"]//textarea', 'class', 'error'); - $this->assertNoText('The string has been saved.'); + $this->assertSession()->pageTextNotContains('The string has been saved.'); } } @@ -434,9 +434,9 @@ public function testStringSearch() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - // assertText() seems to remove the input field where $name always could be - // found, so this is not a false assert. See how assertNoText succeeds - // later. + // pageTextContains() seems to remove the input field where $name always + // could be found, so this is not a false assert. See how + // pageTextNotContains succeeds later. $this->assertSession()->pageTextContains($name); // Ensure untranslated string doesn't appear if searching on 'only @@ -459,7 +459,7 @@ public function testStringSearch() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // Add translation. // Assume this is the only result, given the random name. @@ -481,7 +481,7 @@ public function testStringSearch() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // Ensure translated source string doesn't appear if searching on 'only // untranslated strings'. @@ -513,7 +513,7 @@ public function testStringSearch() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // Ensure translated string doesn't appear if searching in System (English). $search = [ diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php index 1df2655a79cc..cebe7b445b41 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @@ -49,7 +49,7 @@ public function testInterface() { // No language added. // Check status page and Available translation updates page. $this->drupalGet('admin/reports/status'); - $this->assertNoText('Translation update status'); + $this->assertSession()->pageTextNotContains('Translation update status'); $this->drupalGet('admin/reports/translations'); $this->assertRaw(t('No translatable languages available. <a href=":add_language">Add a language</a> first.', [':add_language' => Url::fromRoute('entity.configurable_language.collection')->toString()])); diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php index 00cd4568c8cc..ffb6083e8af9 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php @@ -454,7 +454,7 @@ public function testEnableCustomLanguage() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // Ensure the multiline string was imported. $search = [ @@ -477,7 +477,7 @@ public function testEnableCustomLanguage() { $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); $this->assertSession()->pageTextContains('Allowed HTML source string'); - $this->assertNoText('Another allowed HTML source string'); + $this->assertSession()->pageTextNotContains('Another allowed HTML source string'); } } diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php index dde78653f75f..496cee07c25d 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php @@ -95,7 +95,7 @@ public function testMenuNodeFormWidget() { // Verify that no menu settings are displayed and nodes can be created. $this->drupalGet('node/add/page'); $this->assertSession()->pageTextContains('Create Basic page'); - $this->assertNoText('Menu settings'); + $this->assertSession()->pageTextNotContains('Menu settings'); $node_title = $this->randomMachineName(); $edit = [ 'title[0][value]' => $node_title, diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php index 665c937f4883..b1f89dd2f841 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -615,7 +615,7 @@ public function testUnpublishedNodeMenuItem() { $this->drupalLogout(); $this->drupalLogin($this->adminUser); $this->drupalGet('admin/structure/menu/manage/' . $item->getMenuName()); - $this->assertNoText($item->getTitle()); + $this->assertSession()->pageTextNotContains($item->getTitle()); // The cache contexts associated with the (in)accessible menu links are // bubbled. See DefaultMenuLinkTreeManipulators::menuLinkCheckAccess(). $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Contexts', 'user.permissions'); @@ -850,7 +850,7 @@ public function deleteMenuLink(MenuLinkContent $item) { // Verify deletion. $this->drupalGet(''); - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } /** @@ -864,7 +864,7 @@ public function toggleMenuLink(MenuLinkContent $item) { // Verify menu link is absent. $this->drupalGet(''); - $this->assertNoText($item->getTitle()); + $this->assertSession()->pageTextNotContains($item->getTitle()); $this->enableMenuLink($item); // Verify menu link is displayed. diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php index edb64265cb71..25be88e921e5 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php @@ -36,7 +36,7 @@ public function testAccess() { $this->drupalLogin($user); $this->drupalGet('upgrade'); $this->assertSession()->statusCodeEquals(403); - $this->assertNoText('Upgrade'); + $this->assertSession()->pageTextNotContains('Upgrade'); } } diff --git a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php index c069dbdcbadd..cc595be962f2 100644 --- a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php +++ b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php @@ -72,7 +72,7 @@ public function testAssignOwnerNodeActionConfiguration() { $this->assertSession()->pageTextContains('The action has been successfully saved.'); // Check that the old label for the node_assign_owner_action action does not // appear on the actions administration page after updating. - $this->assertNoText($action_label); + $this->assertSession()->pageTextNotContains($action_label); // Check that the new label for the node_assign_owner_action action appears // on the actions administration page after updating. $this->assertSession()->pageTextContains($new_action_label); @@ -91,7 +91,7 @@ public function testAssignOwnerNodeActionConfiguration() { $this->assertSession()->statusCodeEquals(200); // Check that the label for the node_assign_owner_action action does not // appear on the actions administration page after deleting. - $this->assertNoText($new_action_label); + $this->assertSession()->pageTextNotContains($new_action_label); $action = Action::load($action_id); $this->assertNull($action, 'The node_assign_owner_action action is not available after being deleted.'); diff --git a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php index 5bad6e6d6f19..3fa78eb20094 100644 --- a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php +++ b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php @@ -110,11 +110,11 @@ public function testRecentNodeBlock() { // see the block. $this->drupalLogout(); $this->drupalGet(''); - $this->assertNoText($block->label()); + $this->assertSession()->pageTextNotContains($block->label()); // Test that only the 2 latest nodes are shown. $this->drupalLogin($this->webUser); - $this->assertNoText($node1->label()); + $this->assertSession()->pageTextNotContains($node1->label()); $this->assertSession()->pageTextContains($node2->label()); $this->assertSession()->pageTextContains($node3->label()); @@ -166,7 +166,7 @@ public function testRecentNodeBlock() { $this->drupalGet(''); $label = $block->label(); // Check that block is not displayed on the front page. - $this->assertNoText($label); + $this->assertSession()->pageTextNotContains($label); $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route']); // Ensure that a page that does not have a node context can still be cached, @@ -194,7 +194,7 @@ public function testRecentNodeBlock() { $this->drupalGet('node/' . $node5->id()); // Check that block is not displayed on the node page when node is of type // 'page'. - $this->assertNoText($label); + $this->assertSession()->pageTextNotContains($label); $this->assertCacheContexts(['languages:language_content', 'languages:language_interface', 'theme', 'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT, 'url.site', 'user', 'route', 'timezone']); $this->assertSession()->responseHeaderEquals('X-Drupal-Dynamic-Cache', 'MISS'); $this->drupalGet('node/' . $node5->id()); diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php index d50df5f0d92f..5184c20bc28e 100644 --- a/core/modules/node/tests/src/Functional/NodeCreationTest.php +++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php @@ -87,8 +87,8 @@ public function testNodeCreation() { // Verify that pages do not show submitted information by default. $this->drupalGet('node/' . $node->id()); - $this->assertNoText($node->getOwner()->getAccountName()); - $this->assertNoText($this->container->get('date.formatter')->format($node->getCreatedTime())); + $this->assertSession()->pageTextNotContains($node->getOwner()->getAccountName()); + $this->assertSession()->pageTextNotContains($this->container->get('date.formatter')->format($node->getCreatedTime())); // Change the node type setting to show submitted by information. /** @var \Drupal\node\NodeTypeInterface $node_type */ diff --git a/core/modules/node/tests/src/Functional/NodeEditFormTest.php b/core/modules/node/tests/src/Functional/NodeEditFormTest.php index 305eb8cb5404..3a674a905a7a 100644 --- a/core/modules/node/tests/src/Functional/NodeEditFormTest.php +++ b/core/modules/node/tests/src/Functional/NodeEditFormTest.php @@ -225,7 +225,7 @@ public function testNodeMetaInformation() { // can not see the meta information. $this->drupalLogin($this->webUser); $this->drupalGet('node/add/page'); - $this->assertNoText('Not saved yet'); + $this->assertSession()->pageTextNotContains('Not saved yet'); // Create node to edit. $edit['title[0][value]'] = $this->randomMachineName(8); @@ -234,8 +234,8 @@ public function testNodeMetaInformation() { $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->drupalGet("node/" . $node->id() . "/edit"); - $this->assertNoText('Published'); - $this->assertNoText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short')); + $this->assertSession()->pageTextNotContains('Published'); + $this->assertSession()->pageTextNotContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short')); // Check that users with the 'administer nodes' permission can see the meta // information. diff --git a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php index 0d086163c26d..e1357d705bfa 100644 --- a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php +++ b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php @@ -52,7 +52,7 @@ public function testNodeViewModeChange() { // Check that teaser mode is viewed. $this->assertSession()->pageTextContains('Extra data that should appear only in the teaser for the node.'); // Make sure body text is not present. - $this->assertNoText('Data that should appear only in the body for the node.'); + $this->assertSession()->pageTextNotContains('Data that should appear only in the body for the node.'); // Test that the correct build mode has been set. $build = $this->buildEntityView($node); diff --git a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php index 45bea1374b09..ad4aa767d5d6 100644 --- a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php +++ b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php @@ -57,7 +57,7 @@ public function testNodeRSSContent() { // Check that content added in view modes other than 'rss' doesn't // appear in RSS feed. $non_rss_content = 'Extra data that should appear everywhere except the RSS feed for node ' . $node->id() . '.'; - $this->assertNoText($non_rss_content); + $this->assertSession()->responseNotContains($non_rss_content); // Check that extra RSS elements and namespaces are added to RSS feed. $test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>'; @@ -68,7 +68,7 @@ public function testNodeRSSContent() { // Check that content added in 'rss' view mode doesn't appear when // viewing node. $this->drupalGet('node/' . $node->id()); - $this->assertNoText($rss_only_content); + $this->assertSession()->responseNotContains($rss_only_content); } /** diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php index 0cb8c991a8b4..66e91c011a4e 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php @@ -236,7 +236,7 @@ public function testRevisions() { // Verify that revision body text is not present on default version of node. $this->drupalGet('node/' . $node->id()); - $this->assertNoText($new_body); + $this->assertSession()->pageTextNotContains($new_body); // Verify that the new body text is present on the revision. $this->drupalGet("node/" . $node->id() . "/revisions/" . $new_node_revision->getRevisionId() . "/view"); @@ -308,17 +308,17 @@ public function testRevisions() { // View the revision UI in 'IT', only the original node revision is shown. $this->drupalGet("it/node/" . $node->id() . "/revisions"); $this->assertSession()->pageTextContains('Simple revision message (EN)'); - $this->assertNoText('New revision message (DE)'); + $this->assertSession()->pageTextNotContains('New revision message (DE)'); // View the revision UI in 'DE', only the translated node revision is shown. $this->drupalGet("de/node/" . $node->id() . "/revisions"); - $this->assertNoText('Simple revision message (EN)'); + $this->assertSession()->pageTextNotContains('Simple revision message (EN)'); $this->assertSession()->pageTextContains('New revision message (DE)'); // View the revision UI in 'EN', only the original node revision is shown. $this->drupalGet("node/" . $node->id() . "/revisions"); $this->assertSession()->pageTextContains('Simple revision message (EN)'); - $this->assertNoText('New revision message (DE)'); + $this->assertSession()->pageTextNotContains('New revision message (DE)'); } /** diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php index 6a09d92230cb..f8d4c023b21c 100644 --- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php +++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php @@ -538,7 +538,7 @@ public function testRevisionTranslationRendering() { // Contents should be in English, of correct revision. $this->assertSession()->pageTextContains('First rev en title'); - $this->assertNoText('First rev fr title'); + $this->assertSession()->pageTextNotContains('First rev fr title'); // Get a French view. $url_fr = $original_revision->getTranslation('fr')->toUrl('revision')->toString(); @@ -551,7 +551,7 @@ public function testRevisionTranslationRendering() { // Contents should be in French, of correct revision. $this->assertSession()->pageTextContains('First rev fr title'); - $this->assertNoText('First rev en title'); + $this->assertSession()->pageTextNotContains('First rev en title'); } /** diff --git a/core/modules/node/tests/src/Functional/NodeTypeTest.php b/core/modules/node/tests/src/Functional/NodeTypeTest.php index a4c3154ff05f..8c8e8b26588a 100644 --- a/core/modules/node/tests/src/Functional/NodeTypeTest.php +++ b/core/modules/node/tests/src/Functional/NodeTypeTest.php @@ -193,7 +193,7 @@ public function testNodeTypeDeletion() { $this->assertRaw( t('%type is used by 1 piece of content on your site. You can not remove this content type until you have removed all of the %type content.', ['%type' => $type->label()]) ); - $this->assertNoText('This action cannot be undone.'); + $this->assertSession()->pageTextNotContains('This action cannot be undone.'); // Delete the node. $node->delete(); diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php index c57a276c7307..01275ec02110 100644 --- a/core/modules/node/tests/src/Functional/PagePreviewTest.php +++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php @@ -231,7 +231,7 @@ public function testPagePreview() { $this->drupalGet('node/preview/' . $uuid . '/full'); $this->submitForm($view_mode_edit, 'Switch'); $this->assertRaw('view-mode-teaser'); - $this->assertNoText($edit[$body_key]); + $this->assertSession()->pageTextNotContains($edit[$body_key]); // Check that the title, body and term fields are displayed with the // values after going back to the content edit page. @@ -300,7 +300,7 @@ public function testPagePreview() { $this->assertRaw('>' . $newterm1 . '<'); $this->assertRaw('>' . $newterm2 . '<'); $this->assertRaw('>' . $newterm3 . '<'); - $this->assertNoText($this->term->getName()); + $this->assertSession()->pageTextNotContains($this->term->getName()); $this->assertSession()->linkExists($newterm1); $this->assertSession()->linkExists($newterm2); $this->assertSession()->linkNotExists($newterm3); diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php index b86663687e12..0415f1ad69b7 100644 --- a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php @@ -259,10 +259,10 @@ public function testBulkDeletion() { $this->assertSession()->pageTextContains("$label (Original translation) - The following content item translations will be deleted:"); $label = $this->loadNode(3)->getTranslation('en')->label(); $this->assertSession()->pageTextContains($label); - $this->assertNoText("$label (Original translation) - The following content item translations will be deleted:"); + $this->assertSession()->pageTextNotContains("$label (Original translation) - The following content item translations will be deleted:"); $label = $this->loadNode(4)->label(); $this->assertSession()->pageTextContains($label); - $this->assertNoText("$label (Original translation) - The following content item translations will be deleted:"); + $this->assertSession()->pageTextNotContains("$label (Original translation) - The following content item translations will be deleted:"); $this->submitForm([], 'Delete'); diff --git a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php index 399ba9e05a43..a7b8b7f37854 100644 --- a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php +++ b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php @@ -89,7 +89,7 @@ public function testFilterNodeAccess() { // Test that the private node of the current user is shown. $this->assertSession()->pageTextContains('Private Article created by ' . $this->users[0]->getAccountName()); // Test that the private node of the other use isn't shown. - $this->assertNoText('Private Article created by ' . $this->users[1]->getAccountName()); + $this->assertSession()->pageTextNotContains('Private Article created by ' . $this->users[1]->getAccountName()); // Test that both public nodes are shown. $this->assertSession()->pageTextContains('Public Article created by ' . $this->users[0]->getAccountName()); $this->assertSession()->pageTextContains('Public Article created by ' . $this->users[1]->getAccountName()); @@ -100,7 +100,7 @@ public function testFilterNodeAccess() { // Test that the private node of the current user is shown. $this->assertSession()->pageTextContains('Private Article created by ' . $this->users[1]->getAccountName()); // Test that the private node of the other use isn't shown. - $this->assertNoText('Private Article created by ' . $this->users[0]->getAccountName()); + $this->assertSession()->pageTextNotContains('Private Article created by ' . $this->users[0]->getAccountName()); // Test that a user with administer nodes permission can't see all nodes. $administer_nodes_user = $this->drupalCreateUser([ @@ -109,8 +109,8 @@ public function testFilterNodeAccess() { ]); $this->drupalLogin($administer_nodes_user); $this->drupalGet('test_filter_node_access'); - $this->assertNoText('Private Article created by ' . $this->users[0]->getAccountName()); - $this->assertNoText('Private Article created by ' . $this->users[1]->getAccountName()); + $this->assertSession()->pageTextNotContains('Private Article created by ' . $this->users[0]->getAccountName()); + $this->assertSession()->pageTextNotContains('Private Article created by ' . $this->users[1]->getAccountName()); $this->assertSession()->pageTextContains('Public Article created by ' . $this->users[0]->getAccountName()); $this->assertSession()->pageTextContains('Public Article created by ' . $this->users[1]->getAccountName()); diff --git a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php index 029ab634e955..986f59cbc09f 100644 --- a/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php +++ b/core/modules/node/tests/src/Functional/Views/NodeLanguageTest.php @@ -121,7 +121,7 @@ public function testLanguages() { foreach ($this->nodeTitles as $langcode => $list) { foreach ($list as $title) { if ($langcode == 'en') { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } else { $this->assertSession()->pageTextContains($title); @@ -130,7 +130,7 @@ public function testLanguages() { } // Test that the language field value is shown. - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); $this->assertSession()->pageTextContains('French'); $this->assertSession()->pageTextContains('Spanish'); @@ -151,8 +151,8 @@ public function testLanguages() { $this->drupalGet('test-language/es'); // This time, test just the language field. $message = 'Spanish argument page'; - $this->assertNoText('English'); - $this->assertNoText('French'); + $this->assertSession()->pageTextNotContains('English'); + $this->assertSession()->pageTextNotContains('French'); $this->assertSession()->pageTextContains('Spanish'); // Test the front page view filter. Only node titles in the current language @@ -169,7 +169,7 @@ public function testLanguages() { foreach ($this->nodeTitles as $control_langcode => $control_titles) { if ($langcode != $control_langcode) { foreach ($control_titles as $title) { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } } } @@ -191,7 +191,7 @@ public function testLanguages() { foreach ($this->nodeTitles as $control_langcode => $control_titles) { if ($langcode != $control_langcode) { foreach ($control_titles as $title) { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } } } @@ -214,7 +214,7 @@ public function testLanguages() { $this->assertSession()->pageTextContains($title); } else { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } } } @@ -242,7 +242,7 @@ public function testLanguages() { $this->assertSession()->pageTextContains($title); } else { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); } } } @@ -287,12 +287,12 @@ protected function assertLanguageNames($native = FALSE) { if ($native) { $this->assertSession()->pageTextContains('Français'); $this->assertSession()->pageTextContains('Español'); - $this->assertNoText('French'); - $this->assertNoText('Spanish'); + $this->assertSession()->pageTextNotContains('French'); + $this->assertSession()->pageTextNotContains('Spanish'); } else { - $this->assertNoText('Français'); - $this->assertNoText('Español'); + $this->assertSession()->pageTextNotContains('Français'); + $this->assertSession()->pageTextNotContains('Español'); $this->assertSession()->pageTextContains('French'); $this->assertSession()->pageTextContains('Spanish'); } diff --git a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php index 2c9a54c0a984..6580dd42a877 100644 --- a/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php +++ b/core/modules/node/tests/src/Functional/Views/StatusExtraTest.php @@ -70,26 +70,26 @@ public function testStatusExtra() { $this->drupalLogin($node_author); $this->drupalGet('test_status_extra'); $this->assertSession()->pageTextContains($node_published->label()); - $this->assertNoText($node_unpublished->label()); + $this->assertSession()->pageTextNotContains($node_unpublished->label()); $this->assertSession()->pageTextContains($node_unpublished2->label()); - $this->assertNoText($node_unpublished3->label()); + $this->assertSession()->pageTextNotContains($node_unpublished3->label()); // The normal user should just see the published node. $this->drupalLogin($normal_user); $this->drupalGet('test_status_extra'); $this->assertSession()->pageTextContains($node_published->label()); - $this->assertNoText($node_unpublished->label()); - $this->assertNoText($node_unpublished2->label()); - $this->assertNoText($node_unpublished3->label()); + $this->assertSession()->pageTextNotContains($node_unpublished->label()); + $this->assertSession()->pageTextNotContains($node_unpublished2->label()); + $this->assertSession()->pageTextNotContains($node_unpublished3->label()); // The author without the permission to see their own unpublished node should // just see the published node. $this->drupalLogin($node_author_not_unpublished); $this->drupalGet('test_status_extra'); $this->assertSession()->pageTextContains($node_published->label()); - $this->assertNoText($node_unpublished->label()); - $this->assertNoText($node_unpublished2->label()); - $this->assertNoText($node_unpublished3->label()); + $this->assertSession()->pageTextNotContains($node_unpublished->label()); + $this->assertSession()->pageTextNotContains($node_unpublished2->label()); + $this->assertSession()->pageTextNotContains($node_unpublished3->label()); } } diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php index 439ef2570614..18f518eb1040 100644 --- a/core/modules/path/tests/src/Functional/PathAliasTest.php +++ b/core/modules/path/tests/src/Functional/PathAliasTest.php @@ -135,7 +135,7 @@ public function testAdminAlias() { $this->container->get('path_alias.manager')->cacheClear(); // Confirm that previous alias no longer works. $this->drupalGet($previous); - $this->assertNoText($node1->label()); + $this->assertSession()->pageTextNotContains($node1->label()); $this->assertSession()->statusCodeEquals(404); // Create second test node. @@ -167,7 +167,7 @@ public function testAdminAlias() { // Confirm that the alias no longer works. $this->drupalGet($edit['alias[0][value]']); - $this->assertNoText($node1->label()); + $this->assertSession()->pageTextNotContains($node1->label()); $this->assertSession()->statusCodeEquals(404); // Create a really long alias. @@ -180,7 +180,7 @@ public function testAdminAlias() { $this->drupalGet('admin/config/search/path/add'); $this->submitForm($edit, 'Save'); // The untruncated alias should not be found. - $this->assertNoText($alias); + $this->assertSession()->pageTextNotContains($alias); // The 'truncated' alias will always be found. $this->assertSession()->pageTextContains($truncated_alias); @@ -207,7 +207,7 @@ public function testAdminAlias() { $this->submitForm($edit, 'Save'); // Confirm that the alias with trailing slash is not found. - $this->assertNoText($edit['alias[0][value]']); + $this->assertSession()->pageTextNotContains($edit['alias[0][value]']); // The alias without trailing flash is found. $this->assertSession()->pageTextContains(trim($edit['alias[0][value]'], '/')); @@ -221,7 +221,7 @@ public function testAdminAlias() { $this->assertSession()->pageTextContains('The alias has been saved.'); $this->drupalGet($edit['alias[0][value]']); // Previous alias should no longer work. - $this->assertNoText($node4->label()); + $this->assertSession()->pageTextNotContains($node4->label()); // Alias should work. $this->assertSession()->pageTextContains($node2->label()); $this->assertSession()->statusCodeEquals(200); @@ -303,7 +303,7 @@ public function testNodeAlias() { // Make sure that previous alias no longer works. $this->drupalGet($previous); - $this->assertNoText($node1->label()); + $this->assertSession()->pageTextNotContains($node1->label()); $this->assertSession()->statusCodeEquals(404); // Create second test node. @@ -323,7 +323,7 @@ public function testNodeAlias() { // Confirm that the alias no longer works. $this->drupalGet($edit['path[0][alias]']); - $this->assertNoText($node1->label()); + $this->assertSession()->pageTextNotContains($node1->label()); $this->assertSession()->statusCodeEquals(404); // Create third test node. diff --git a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php index 297a22258ac9..1a5cfb93498b 100644 --- a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php +++ b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php @@ -85,7 +85,7 @@ public function testTermAlias() { // Confirm that the old alias no longer works. $this->drupalGet(trim($edit['path[0][alias]'], '/')); - $this->assertNoText($description); + $this->assertSession()->pageTextNotContains($description); $this->assertSession()->statusCodeEquals(404); // Remove the term's URL alias. @@ -96,7 +96,7 @@ public function testTermAlias() { // Confirm that the alias no longer works. $this->drupalGet(trim($edit2['path[0][alias]'], '/')); - $this->assertNoText($description); + $this->assertSession()->pageTextNotContains($description); $this->assertSession()->statusCodeEquals(404); } diff --git a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php index cfb05a30a0a3..9cbbad433b5f 100644 --- a/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php +++ b/core/modules/responsive_image/tests/src/Functional/ResponsiveImageAdminUITest.php @@ -64,7 +64,7 @@ public function testResponsiveImageAdmin() { // Check if the new group is created. $this->assertSession()->statusCodeEquals(200); $this->drupalGet('admin/config/media/responsive-image-style'); - $this->assertNoText('There are no responsive image styles yet.'); + $this->assertSession()->pageTextNotContains('There are no responsive image styles yet.'); $this->assertSession()->pageTextContains('Style One'); // Edit the group. diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index d49d8f2ab4a3..bcbf57e6da0c 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -589,7 +589,7 @@ public function testFieldRawOutput() { } // Test that the excluded field is not shown in the row options. $this->drupalGet('admin/structure/views/nojs/display/test_serializer_display_field/rest_export_1/row_options'); - $this->assertNoText('created'); + $this->assertSession()->pageTextNotContains('created'); } /** diff --git a/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php b/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php index fe3b102363d6..1189a5e93ac8 100644 --- a/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchAdvancedSearchFormTest.php @@ -61,7 +61,7 @@ public function testNodeType() { // Search for the dummy title with a GET query. $this->drupalGet('search/node', ['query' => ['keys' => $dummy_title]]); - $this->assertNoText($this->node->label()); + $this->assertSession()->pageTextNotContains($this->node->label()); // Search for the title of the node with a GET query. $this->drupalGet('search/node', ['query' => ['keys' => $this->node->label()]]); diff --git a/core/modules/search/tests/src/Functional/SearchBlockTest.php b/core/modules/search/tests/src/Functional/SearchBlockTest.php index 0eeab4d6f2d1..c1c18c7b919b 100644 --- a/core/modules/search/tests/src/Functional/SearchBlockTest.php +++ b/core/modules/search/tests/src/Functional/SearchBlockTest.php @@ -119,16 +119,16 @@ public function testSearchFormBlock() { $this->drupalGet('node'); $this->submitForm(['keys' => $this->randomMachineName(1)], 'Search'); $this->assertSession()->pageTextContains('You must include at least one keyword to match in the content'); - $this->assertNoText('Please enter some keywords'); + $this->assertSession()->pageTextNotContains('Please enter some keywords'); $this->submitForm(['keys' => $this->randomMachineName()], 'Search', 'search-block-form'); - $this->assertNoText('You must include at least one keyword to match in the content'); + $this->assertSession()->pageTextNotContains('You must include at least one keyword to match in the content'); // Same test again, using the search page form for the second search this // time. $this->drupalGet('node'); $this->submitForm(['keys' => $this->randomMachineName(1)], 'Search'); $this->submitForm(['keys' => $this->randomMachineName()], 'Search', 'search-form'); - $this->assertNoText('You must include at least one keyword to match in the content'); + $this->assertSession()->pageTextNotContains('You must include at least one keyword to match in the content'); // Edit the block configuration so that it searches users instead of nodes, // and test. diff --git a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php index 2560e2f8de62..b95a74ec5a7a 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php @@ -106,7 +106,7 @@ public function testSearchCommentCountToggle() { $this->searchableNodes['1 comment']->save(); $this->submitForm($edit, 'Search'); - $this->assertNoText('0 comments'); + $this->assertSession()->pageTextNotContains('0 comments'); $this->assertSession()->pageTextContains('1 comment'); // Test comment count display for nodes with comment status set to Hidden @@ -116,8 +116,8 @@ public function testSearchCommentCountToggle() { $this->searchableNodes['1 comment']->save(); $this->submitForm($edit, 'Search'); - $this->assertNoText('0 comments'); - $this->assertNoText('1 comment'); + $this->assertSession()->pageTextNotContains('0 comments'); + $this->assertSession()->pageTextNotContains('1 comment'); } } diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php index 44a77dae5fd7..ab237c402343 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -375,7 +375,7 @@ public function testAddNewComment() { $this->drupalGet('search/node'); $this->submitForm(['keys' => 'short'], 'Search'); $this->assertSession()->pageTextContains($node->label()); - $this->assertNoText('Add new comment'); + $this->assertSession()->pageTextNotContains('Add new comment'); } } diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php index 27dcbcfffb97..8518df08055c 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -111,7 +111,7 @@ public function testSearchSettingsPage() { ]; $this->drupalGet('admin/config/search/pages'); $this->submitForm($edit, 'Save configuration'); - $this->assertNoText('The configuration options have been saved.'); + $this->assertSession()->pageTextNotContains('The configuration options have been saved.'); // Test logging setting. It should be off by default. $text = $this->randomMachineName(5); @@ -190,14 +190,14 @@ public function testSearchModuleDisabling() { $info = $plugin_info[$entity_id]; $this->drupalGet('search/' . $entity->getPath(), ['query' => ['keys' => $info['keys']]]); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('no results'); + $this->assertSession()->pageTextNotContains('no results'); $this->assertSession()->pageTextContains($info['text']); // Verify that other plugin search tab labels are not visible. foreach ($plugins as $other) { if ($other != $entity_id) { - $label = $entities[$other]->label(); - $this->assertNoText($label); + $path = 'search/' . $entities[$other]->getPath(); + $this->assertSession()->elementNotExists('xpath', '//ul[@class="tabs primary"]/li/a[@data-drupal-link-system-path="' . $path . '"]'); } } @@ -236,8 +236,9 @@ public function testSearchModuleDisabling() { foreach ($paths as $item) { $this->drupalGet($item['path'], $item['options']); foreach ($plugins as $entity_id) { + $path = 'search/' . $entities[$entity_id]->getPath(); $label = $entities[$entity_id]->label(); - $this->assertSession()->pageTextContains($label); + $this->assertSession()->elementTextContains('xpath', '//ul[@class="tabs primary"]/li/a[@data-drupal-link-system-path="' . $path . '"]', $label); } } } diff --git a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php index 3d1400709395..22fac2017680 100644 --- a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php @@ -82,7 +82,7 @@ public function testEmbeddedForm() { // our form being submitted. $this->drupalGet('search'); $this->submitForm(['keys' => 'foo'], 'Search'); - $this->assertNoText('Test form was submitted'); + $this->assertSession()->pageTextNotContains('Test form was submitted'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); $this->assertEquals($this->submitCount, $count, 'Form submission count is correct'); $this->submitCount = $count; diff --git a/core/modules/search/tests/src/Functional/SearchExactTest.php b/core/modules/search/tests/src/Functional/SearchExactTest.php index 5a29c77249f7..8ae6cc1d3787 100644 --- a/core/modules/search/tests/src/Functional/SearchExactTest.php +++ b/core/modules/search/tests/src/Functional/SearchExactTest.php @@ -89,8 +89,8 @@ public function testExactQuery() { $edit = ['keys' => 'Druplicon']; $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertNoText($user->getAccountName()); - $this->assertNoText($this->container->get('date.formatter')->format($node->getChangedTime(), 'short')); + $this->assertSession()->pageTextNotContains($user->getAccountName()); + $this->assertSession()->pageTextNotContains($this->container->get('date.formatter')->format($node->getChangedTime(), 'short')); } diff --git a/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php b/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php index 563fcedf65ee..dbc42e2d3e3a 100644 --- a/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php +++ b/core/modules/search/tests/src/Functional/SearchKeywordsConditionsTest.php @@ -58,7 +58,7 @@ protected function setUp(): void { public function testSearchKeywordsConditions() { // No keys, not conditions - no results. $this->drupalGet('search/dummy_path'); - $this->assertNoText('Dummy search snippet to display'); + $this->assertSession()->pageTextNotContains('Dummy search snippet to display'); // With keys - get results. $keys = 'bike shed ' . $this->randomMachineName(); $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]); diff --git a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php index 564a3fb13261..649bbfe6f05e 100644 --- a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php +++ b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php @@ -126,7 +126,7 @@ public function testSearchIndexUpdateOnNodeDeletion() { // Search again to verify the node doesn't appear anymore. $this->drupalGet('search/node'); $this->submitForm($edit, 'Search'); - $this->assertNoText($node->label()); + $this->assertSession()->pageTextNotContains($node->label()); } } diff --git a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php index f3b874c76566..f2aab18eabda 100644 --- a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php +++ b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php @@ -98,7 +98,7 @@ public function testNumberSearching() { // with a dummy search. $this->drupalGet('search/node'); $this->submitForm(['keys' => 'foo'], 'Search'); - $this->assertNoText($node->label()); + $this->assertSession()->pageTextNotContains($node->label()); // Now verify that we can find node i by searching for any of the // numbers. diff --git a/core/modules/search/tests/src/Functional/SearchNumbersTest.php b/core/modules/search/tests/src/Functional/SearchNumbersTest.php index 91bd8f81dbee..d8c335b1ef90 100644 --- a/core/modules/search/tests/src/Functional/SearchNumbersTest.php +++ b/core/modules/search/tests/src/Functional/SearchNumbersTest.php @@ -111,7 +111,7 @@ public function testNumberSearching() { // with a dummy search. $this->drupalGet('search/node'); $this->submitForm(['keys' => 'foo'], 'Search'); - $this->assertNoText($node->label()); + $this->assertSession()->pageTextNotContains($node->label()); // Verify that the node title does appear as a link on the search page // when searching for the number. diff --git a/core/modules/search/tests/src/Functional/SearchPageTextTest.php b/core/modules/search/tests/src/Functional/SearchPageTextTest.php index 258ef6d504ae..91d568d795ef 100644 --- a/core/modules/search/tests/src/Functional/SearchPageTextTest.php +++ b/core/modules/search/tests/src/Functional/SearchPageTextTest.php @@ -84,8 +84,8 @@ public function testSearchText() { $this->assertSession()->pageTextContains('Search'); $title_source = 'Search for @keywords | Drupal'; $this->assertSession()->titleEquals('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal'); - $this->assertNoText('Node'); - $this->assertNoText('Node'); + $this->assertSession()->pageTextNotContains('Node'); + $this->assertSession()->pageTextNotContains('Node'); $this->assertSession()->pageTextContains('Content'); $this->clickLink('About searching'); @@ -155,12 +155,12 @@ public function testSearchText() { $this->submitForm([ 'or' => $this->randomMachineName() . ' ' . $this->randomMachineName(), ], 'edit-submit--2'); - $this->assertNoText('Please enter some keywords'); + $this->assertSession()->pageTextNotContains('Please enter some keywords'); $this->drupalGet('search/node'); $this->submitForm([ 'phrase' => '"' . $this->randomMachineName() . '" "' . $this->randomMachineName() . '"', ], 'edit-submit--2'); - $this->assertNoText('Please enter some keywords'); + $this->assertSession()->pageTextNotContains('Please enter some keywords'); // Verify that if you search for a too-short keyword, you get the right // message, and that if after that you search for a longer keyword, you @@ -168,9 +168,9 @@ public function testSearchText() { $this->drupalGet('search/node'); $this->submitForm(['keys' => $this->randomMachineName(1)], 'Search'); $this->assertSession()->pageTextContains('You must include at least one keyword'); - $this->assertNoText('Please enter some keywords'); + $this->assertSession()->pageTextNotContains('Please enter some keywords'); $this->submitForm(['keys' => $this->randomMachineName()], 'Search'); - $this->assertNoText('You must include at least one keyword'); + $this->assertSession()->pageTextNotContains('You must include at least one keyword'); // Test that if you search for a URL with .. in it, you still end up at // the search page. See issue https://www.drupal.org/node/890058. diff --git a/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php b/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php index 9a03c8177360..3ae77f196968 100644 --- a/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php +++ b/core/modules/search/tests/src/Functional/SearchQueryAlterTest.php @@ -55,7 +55,7 @@ public function testQueryAlter() { $this->submitForm(['keys' => 'pizza'], 'Search'); // The article should be there but not the page. $this->assertSession()->pageTextContains('article'); - $this->assertNoText('page'); + $this->assertSession()->pageTextNotContains('page'); } } diff --git a/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php b/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php index 0b9418ab14ab..445a53d15a5d 100644 --- a/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php +++ b/core/modules/statistics/tests/src/Functional/StatisticsAdminTest.php @@ -174,7 +174,7 @@ public function testExpiredLogs() { // Verify that no hit URL is found. $this->drupalGet('admin/reports/pages'); - $this->assertNoText('node/' . $this->testNode->id()); + $this->assertSession()->pageTextNotContains('node/' . $this->testNode->id()); $result = Database::getConnection()->select('node_counter', 'nc') ->fields('nc', ['daycount']) diff --git a/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php index c86611197a4a..32faab1b34c1 100644 --- a/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php +++ b/core/modules/system/tests/src/Functional/Bootstrap/DrupalMessengerServiceTest.php @@ -31,7 +31,7 @@ public function testDrupalMessengerService() { // The page at system_test.messenger_service route sets two messages and // then removes the first before it is displayed. $this->drupalGet(Url::fromRoute('system_test.messenger_service')); - $this->assertNoText('First message (removed).'); + $this->assertSession()->pageTextNotContains('First message (removed).'); $this->assertRaw(t('Second message with <em>markup!</em> (not removed).')); // Ensure duplicate messages are handled as expected. diff --git a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php index acea9d9bac4c..f500f78b533b 100644 --- a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php +++ b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php @@ -42,7 +42,7 @@ public function testBogusAcceptHeader() { ]; foreach ($tests as $case => $header) { $this->drupalGet('', [], ['Accept: ' . $header]); - $this->assertNoText('Unsupported Media Type'); + $this->assertSession()->pageTextNotContains('Unsupported Media Type'); $this->assertSession()->pageTextContains('Log in'); } } diff --git a/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php b/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php index 9e0d26f57a18..ed0e74d31fba 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityRevisionsTest.php @@ -212,11 +212,11 @@ public function testEntityRevisionParamConverter() { $this->drupalGet($revision_url); $this->assertSession()->pageTextContains('pending revision - en'); - $this->assertNoText('pending revision - de'); + $this->assertSession()->pageTextNotContains('pending revision - de'); $this->drupalGet('de/' . $revision_url); $this->assertSession()->pageTextContains('pending revision - de'); - $this->assertNoText('pending revision - en'); + $this->assertSession()->pageTextNotContains('pending revision - en'); } /** diff --git a/core/modules/system/tests/src/Functional/File/ConfigTest.php b/core/modules/system/tests/src/Functional/File/ConfigTest.php index 313a118d7012..3fb94889f007 100644 --- a/core/modules/system/tests/src/Functional/File/ConfigTest.php +++ b/core/modules/system/tests/src/Functional/File/ConfigTest.php @@ -57,7 +57,7 @@ public function testFileConfigurationPage() { $this->drupalGet('admin/config/media/file-system'); $this->assertSession()->pageTextContains('Public local files served by the webserver.'); - $this->assertNoText('Private local files served by Drupal.'); + $this->assertSession()->pageTextNotContains('Private local files served by Drupal.'); } } diff --git a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php index 7f90505dc8fd..3eac1b6cd539 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php @@ -29,12 +29,12 @@ class ElementsAccessTest extends BrowserTestBase { public function testAccessFalse() { $this->drupalGet('form_test/vertical-tabs-access'); $this->submitForm([], 'Submit'); - $this->assertNoText('This checkbox inside a vertical tab does not have its default value.'); - $this->assertNoText('This textfield inside a vertical tab does not have its default value.'); - $this->assertNoText('This checkbox inside a fieldset does not have its default value.'); - $this->assertNoText('This checkbox inside a container does not have its default value.'); - $this->assertNoText('This checkbox inside a nested container does not have its default value.'); - $this->assertNoText('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'); + $this->assertSession()->pageTextNotContains('This checkbox inside a vertical tab does not have its default value.'); + $this->assertSession()->pageTextNotContains('This textfield inside a vertical tab does not have its default value.'); + $this->assertSession()->pageTextNotContains('This checkbox inside a fieldset does not have its default value.'); + $this->assertSession()->pageTextNotContains('This checkbox inside a container does not have its default value.'); + $this->assertSession()->pageTextNotContains('This checkbox inside a nested container does not have its default value.'); + $this->assertSession()->pageTextNotContains('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'); $this->assertSession()->pageTextContains('The form submitted correctly.'); } diff --git a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php index 6bdefd2682c7..629dbec68779 100644 --- a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php @@ -103,8 +103,8 @@ public function testRebuildFormStorageOnCachedPage() { // that initial build ID. $edit = ['title' => 'something']; $this->submitForm($edit, 'Rebuild'); - $this->assertNoText('No old build id'); - $this->assertNoText($build_id_initial); + $this->assertSession()->pageTextNotContains('No old build id'); + $this->assertSession()->pageTextNotContains($build_id_initial); $build_id_first_rebuild = $this->getFormBuildId(); $this->assertNotEquals($build_id_initial, $build_id_first_rebuild, 'Build id changes on first rebuild.'); diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 74dd371a1e2c..e87ab2e9a3a2 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -428,7 +428,7 @@ public function testSelect() { 'multiple_no_default', ]; foreach ($no_errors as $key) { - $this->assertNoText($form[$key]['#title'] . ' field is required.'); + $this->assertSession()->pageTextNotContains($form[$key]['#title'] . ' field is required.'); } $expected_errors = [ diff --git a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php index 8ee9e9daed35..03e55c1a07e9 100644 --- a/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php +++ b/core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php @@ -161,7 +161,7 @@ public function testInstalledIncompatibleModule() { file_put_contents($file_path, Yaml::encode($compatible_info)); $this->drupalGet('admin/modules'); - $this->assertNoText($incompatible_modules_message); + $this->assertSession()->pageTextNotContains($incompatible_modules_message); } // Uninstall the module and ensure that incompatible modules message is not // displayed for modules that are not installed. @@ -174,7 +174,7 @@ public function testInstalledIncompatibleModule() { $incompatible_info = $info + $incompatible_update; file_put_contents($file_path, Yaml::encode($incompatible_info)); $this->drupalGet('admin/modules'); - $this->assertNoText($incompatible_modules_message); + $this->assertSession()->pageTextNotContains($incompatible_modules_message); } } diff --git a/core/modules/system/tests/src/Functional/Form/ValidationTest.php b/core/modules/system/tests/src/Functional/Form/ValidationTest.php index bd53fcc4914e..7cac1f9b13fa 100644 --- a/core/modules/system/tests/src/Functional/Form/ValidationTest.php +++ b/core/modules/system/tests/src/Functional/Form/ValidationTest.php @@ -72,7 +72,7 @@ public function testValidate() { ->setValue('invalid_token'); $this->submitForm(['name' => 'validate'], 'Save'); $this->assertSession()->fieldValueNotEquals('name', '#value changed by #validate'); - $this->assertNoText('Name value: value changed by setValueForElement() in #validate'); + $this->assertSession()->pageTextNotContains('Name value: value changed by setValueForElement() in #validate'); $this->assertSession()->pageTextContains('The form has become outdated.'); } @@ -115,7 +115,7 @@ public function testValidateLimitErrors() { // is triggered. $this->drupalGet($path); $this->submitForm($edit, 'Partial validate'); - $this->assertNoText('Title field is required.'); + $this->assertSession()->pageTextNotContains('Title field is required.'); $this->assertSession()->pageTextContains('Test element is invalid'); // Edge case of #limit_validation_errors containing numeric indexes: same @@ -123,13 +123,13 @@ public function testValidateLimitErrors() { // 'test_numeric_index' field. $this->drupalGet($path); $this->submitForm($edit, 'Partial validate (numeric index)'); - $this->assertNoText('Title field is required.'); + $this->assertSession()->pageTextNotContains('Title field is required.'); $this->assertSession()->pageTextContains('Test (numeric index) element is invalid'); // Ensure something like 'foobar' isn't considered "inside" 'foo'. $this->drupalGet($path); $this->submitForm($edit, 'Partial validate (substring)'); - $this->assertNoText('Title field is required.'); + $this->assertSession()->pageTextNotContains('Title field is required.'); $this->assertSession()->pageTextContains('Test (substring) foo element is invalid'); // Ensure not validated values are not available to submit handlers. @@ -227,15 +227,15 @@ public function testCustomRequiredError() { foreach (Element::children($form) as $key) { if (isset($form[$key]['#required_error'])) { - $this->assertNoText($form[$key]['#title'] . ' field is required.'); + $this->assertSession()->pageTextNotContains($form[$key]['#title'] . ' field is required.'); $this->assertSession()->pageTextContains((string) $form[$key]['#required_error']); } elseif (isset($form[$key]['#form_test_required_error'])) { - $this->assertNoText($form[$key]['#title'] . ' field is required.'); + $this->assertSession()->pageTextNotContains($form[$key]['#title'] . ' field is required.'); $this->assertSession()->pageTextContains((string) $form[$key]['#form_test_required_error']); } } - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); // Verify that no custom validation error appears with valid values. $edit = [ @@ -248,15 +248,15 @@ public function testCustomRequiredError() { foreach (Element::children($form) as $key) { if (isset($form[$key]['#required_error'])) { - $this->assertNoText($form[$key]['#title'] . ' field is required.'); - $this->assertNoText((string) $form[$key]['#required_error']); + $this->assertSession()->pageTextNotContains($form[$key]['#title'] . ' field is required.'); + $this->assertSession()->pageTextNotContains((string) $form[$key]['#required_error']); } elseif (isset($form[$key]['#form_test_required_error'])) { - $this->assertNoText($form[$key]['#title'] . ' field is required.'); - $this->assertNoText((string) $form[$key]['#form_test_required_error']); + $this->assertSession()->pageTextNotContains($form[$key]['#title'] . ' field is required.'); + $this->assertSession()->pageTextNotContains((string) $form[$key]['#form_test_required_error']); } } - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); } } diff --git a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php index f7902c7c0bc9..249a45c6bfac 100644 --- a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php +++ b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php @@ -80,7 +80,7 @@ protected function doTestHookMenuIntegration() { protected function doTestTitleCallbackFalse() { $this->drupalGet('test-page'); $this->assertSession()->pageTextContains('A title with @placeholder', 'Raw text found on the page'); - $this->assertNoText('A title with some other text', 'Text with placeholder substitutions not found.'); + $this->assertSession()->pageTextNotContains('A title with some other text', 'Text with placeholder substitutions not found.'); } /** @@ -89,7 +89,7 @@ protected function doTestTitleCallbackFalse() { protected function doTestTitleMenuCallback() { // Verify that the menu router item title is not visible. $this->drupalGet(''); - $this->assertNoText('Menu Callback Title'); + $this->assertSession()->pageTextNotContains('Menu Callback Title'); // Verify that the menu router item title is output as page title. $this->drupalGet('menu_callback_title'); $this->assertSession()->pageTextContains('Menu Callback Title'); @@ -200,7 +200,7 @@ protected function doTestExoticPath() { "éøïвβä¸åœ‹æ›¸Ûž"; $this->drupalGet($path); $this->assertRaw('This is the menuTestCallback content.'); - $this->assertNoText('The website encountered an unexpected error. Please try again later.'); + $this->assertSession()->pageTextNotContains('The website encountered an unexpected error. Please try again later.'); } /** diff --git a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php index 0c07984f229f..adbb9901a825 100644 --- a/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php +++ b/core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php @@ -59,7 +59,7 @@ public function testClassLoadingNotInstalledModules() { for ($i = 0; $i < 2; $i++) { $this->drupalGet('module-test/class-loading'); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText($this->expected); + $this->assertSession()->pageTextNotContains($this->expected); } } @@ -79,7 +79,7 @@ public function testClassLoadingDisabledModules() { for ($i = 0; $i < 2; $i++) { $this->drupalGet('module-test/class-loading'); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText($this->expected); + $this->assertSession()->pageTextNotContains($this->expected); } } diff --git a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php index 4d704514eb2f..8f34316a3a9e 100644 --- a/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php +++ b/core/modules/system/tests/src/Functional/Module/ExperimentalModuleTest.php @@ -48,7 +48,7 @@ public function testExperimentalConfirmForm() { $this->drupalGet('admin/modules'); $this->submitForm($edit, 'Install'); $this->assertSession()->pageTextContains('Module Test page has been enabled.'); - $this->assertNoText('Experimental modules are provided for testing purposes only.'); + $this->assertSession()->pageTextNotContains('Experimental modules are provided for testing purposes only.'); // Uninstall the module. \Drupal::service('module_installer')->uninstall(['test_page_test']); @@ -63,12 +63,12 @@ public function testExperimentalConfirmForm() { // The module should not be enabled and there should be a warning and a // list of the experimental modules with only this one. - $this->assertNoText('Experimental Test has been enabled.'); + $this->assertSession()->pageTextNotContains('Experimental Test has been enabled.'); $this->assertSession()->pageTextContains('Experimental modules are provided for testing purposes only.'); $this->assertSession()->pageTextContains('The following modules are experimental: Experimental Test'); // There should be no message about enabling dependencies. - $this->assertNoText('You must enable'); + $this->assertSession()->pageTextNotContains('You must enable'); // Enable the module and confirm that it worked. $this->submitForm([], 'Continue'); @@ -86,14 +86,14 @@ public function testExperimentalConfirmForm() { // The module should not be enabled and there should be a warning and a // list of the experimental modules with only this one. - $this->assertNoText('2 modules have been enabled: Experimental Dependency Test, Experimental Test'); + $this->assertSession()->pageTextNotContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test'); $this->assertSession()->pageTextContains('Experimental modules are provided for testing purposes only.'); $this->assertSession()->pageTextContains('The following modules are experimental: Experimental Test'); // Ensure the non-experimental module is not listed as experimental. - $this->assertNoText('The following modules are experimental: Experimental Test, Experimental Dependency Test'); - $this->assertNoText('The following modules are experimental: Experimental Dependency Test'); + $this->assertSession()->pageTextNotContains('The following modules are experimental: Experimental Test, Experimental Dependency Test'); + $this->assertSession()->pageTextNotContains('The following modules are experimental: Experimental Dependency Test'); // There should be a message about enabling dependencies. $this->assertSession()->pageTextContains('You must enable the Experimental Test module to install Experimental Dependency Test'); @@ -116,17 +116,17 @@ public function testExperimentalConfirmForm() { // The module should not be enabled and there should be a warning and a // list of the experimental modules with only this one. - $this->assertNoText('2 modules have been enabled: Experimental Dependency Test, Experimental Test'); + $this->assertSession()->pageTextNotContains('2 modules have been enabled: Experimental Dependency Test, Experimental Test'); $this->assertSession()->pageTextContains('Experimental modules are provided for testing purposes only.'); $this->assertSession()->pageTextContains('The following modules are experimental: Experimental Test'); // Ensure the non-experimental module is not listed as experimental. - $this->assertNoText('The following modules are experimental: Experimental Dependency Test, Experimental Test'); - $this->assertNoText('The following modules are experimental: Experimental Dependency Test'); + $this->assertSession()->pageTextNotContains('The following modules are experimental: Experimental Dependency Test, Experimental Test'); + $this->assertSession()->pageTextNotContains('The following modules are experimental: Experimental Dependency Test'); // There should be no message about enabling dependencies. - $this->assertNoText('You must enable'); + $this->assertSession()->pageTextNotContains('You must enable'); // Enable the module and confirm that it worked. $this->submitForm([], 'Continue'); diff --git a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php index e89498430eae..fa4d1456b9e2 100644 --- a/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/PrepareUninstallTest.php @@ -109,7 +109,7 @@ public function testUninstall() { $this->submitForm(['uninstall[taxonomy]' => TRUE], 'Uninstall'); $this->submitForm([], 'Uninstall'); $this->assertSession()->pageTextContains('The selected modules have been uninstalled.'); - $this->assertNoText('Enables the categorization of content.'); + $this->assertSession()->pageTextNotContains('Enables the categorization of content.'); // Check Node cannot be uninstalled yet, there is content to be removed. $this->drupalGet('admin/modules/uninstall'); @@ -136,7 +136,7 @@ public function testUninstall() { } // Ensures there is no more count when not necessary. - $this->assertNoText('And 0 more content'); + $this->assertSession()->pageTextNotContains('And 0 more content'); $this->assertSession()->pageTextContains('This action cannot be undone.'); $this->assertSession()->pageTextContains('Make a backup of your database if you want to be able to restore these items.'); @@ -170,7 +170,7 @@ public function testUninstall() { $this->submitForm(['uninstall[node]' => TRUE], 'Uninstall'); $this->submitForm([], 'Uninstall'); $this->assertSession()->pageTextContains('The selected modules have been uninstalled.'); - $this->assertNoText('Allows content to be submitted to the site and displayed on pages.'); + $this->assertSession()->pageTextNotContains('Allows content to be submitted to the site and displayed on pages.'); // Ensure a 404 is returned when accessing a non-existent entity type. $this->drupalGet('admin/modules/uninstall/entity/node'); diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php index 00c08000ff1a..f3dcfa8796f6 100644 --- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php @@ -87,7 +87,7 @@ public function testUninstallPage() { $edit['uninstall[module_test]'] = TRUE; $this->drupalGet('admin/modules/uninstall'); $this->submitForm($edit, 'Uninstall'); - $this->assertNoText('Configuration deletions'); + $this->assertSession()->pageTextNotContains('Configuration deletions'); $this->assertSession()->pageTextContains('Configuration updates'); $this->assertSession()->pageTextContains($node_type->label()); $this->submitForm([], 'Uninstall'); @@ -101,7 +101,7 @@ public function testUninstallPage() { $this->drupalGet('admin/modules/uninstall'); $this->submitForm($edit, 'Uninstall'); $this->assertSession()->pageTextContains('Configuration deletions'); - $this->assertNoText('Configuration updates'); + $this->assertSession()->pageTextNotContains('Configuration updates'); $entity_types = []; foreach ($node_dependencies as $entity) { @@ -173,7 +173,7 @@ public function testFailedInstallStatus() { $this->submitForm($edit, 'Uninstall'); $this->submitForm([], 'Uninstall'); $this->assertSession()->pageTextContains('The selected modules have been uninstalled.'); - $this->assertNoText('Module installer config test'); + $this->assertSession()->pageTextNotContains('Module installer config test'); } } diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php index 1b12a18e8ce7..0b679ad373e5 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php @@ -92,7 +92,7 @@ public function testHttpsSession() { // Verify that user is not logged in on non-secure URL. $this->drupalGet($this->httpUrl('admin/config')); - $this->assertNoText('Configuration'); + $this->assertSession()->pageTextNotContains('Configuration'); $this->assertSession()->statusCodeEquals(403); // Verify that empty SID cannot be used on the non-secure site. diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php index 673a580f93c1..acb5321b00a1 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -131,7 +131,7 @@ public function testDataPersistence() { $this->sessionReset(); // Verify that after logout, previous user's session data is not available. $this->drupalGet('session-test/get'); - $this->assertNoText($value_1); + $this->assertSession()->pageTextNotContains($value_1); // Now try to store some data as an anonymous user. $value_3 = $this->randomMachineName(); @@ -158,7 +158,7 @@ public function testDataPersistence() { // Verify that the session persists for an authenticated user after // logging out and then back in. $this->drupalGet('session-test/get'); - $this->assertNoText($value_1); + $this->assertSession()->pageTextNotContains($value_1); // Change session and create another user. $user2 = $this->drupalCreateUser([]); @@ -226,7 +226,7 @@ public function testEmptyAnonymousSession() { $this->assertSessionCookie(FALSE); // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages. // $this->assertSessionEmpty(TRUE); - $this->assertNoText('This is a dummy message.'); + $this->assertSession()->pageTextNotContains('This is a dummy message.'); $this->assertSession()->responseHeaderEquals('X-Drupal-Cache', 'HIT'); $this->assertSession()->responseHeaderDoesNotExist('Set-Cookie'); @@ -240,7 +240,7 @@ public function testEmptyAnonymousSession() { $this->assertSessionCookie(FALSE); // @todo Reinstate when REQUEST and RESPONSE events fire for cached pages. // $this->assertSessionEmpty(TRUE); - $this->assertNoText('This is a dummy message.'); + $this->assertSession()->pageTextNotContains('This is a dummy message.'); } /** diff --git a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php index d9744b199462..17a5343bb681 100644 --- a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php +++ b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php @@ -131,7 +131,7 @@ public function testAccessDeniedCustomPageWithAccessDenied() { $this->config('system.site')->set('page.403', '/system-test/custom-4xx')->save(); $this->drupalGet('/system-test/always-denied'); - $this->assertNoText('Admin-only 4xx response'); + $this->assertSession()->pageTextNotContains('Admin-only 4xx response'); $this->assertSession()->pageTextContains('You are not authorized to access this page.'); $this->assertSession()->statusCodeEquals(403); // Verify the access cacheability metadata for custom 403 is bubbled. diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php index 72776c16eec0..95d2611e67d5 100644 --- a/core/modules/system/tests/src/Functional/System/CronRunTest.php +++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php @@ -117,7 +117,7 @@ public function testCronUI() { // Don't use REQUEST to calculate the exact time, because that will // fail randomly. Look for the word 'years', because without a timestamp, // the time will start at 1 January 1970. - $this->assertNoText('years'); + $this->assertSession()->pageTextNotContains('years'); $cron_last = time() - 200; \Drupal::state()->set('system.cron_last', $cron_last); diff --git a/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php b/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php index 1ee4c6fcb705..7158254ddf1a 100644 --- a/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php +++ b/core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php @@ -29,7 +29,7 @@ public function testDateLocking() { $this->assertSession()->linkByHrefExists('admin/config/regional/date-time/formats/manage/short'); $this->assertSession()->linkByHrefNotExists('admin/config/regional/date-time/formats/manage/html_date'); $this->assertSession()->pageTextContains('Fallback date format'); - $this->assertNoText('short (locked)'); + $this->assertSession()->pageTextNotContains('short (locked)'); // Locked date formats are not editable. $this->drupalGet('admin/config/regional/date-time/formats/manage/short'); diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php index 690a469fb7af..16e7ee75206b 100644 --- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php +++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php @@ -263,7 +263,7 @@ public function testEnteringDateTimeViaSelectors() { $edit['field_dt[0][value][day]'] = '29'; $this->drupalGet('node/add/page_with_date'); $this->submitForm($edit, 'Save'); - $this->assertNoText('Selected combination of day and month is not valid.'); + $this->assertSession()->pageTextNotContains('Selected combination of day and month is not valid.'); $this->drupalGet('node/1'); $this->assertSession()->pageTextContains('Mon, 02/29/2016 - 01:30'); diff --git a/core/modules/system/tests/src/Functional/System/FrontPageTest.php b/core/modules/system/tests/src/Functional/System/FrontPageTest.php index 6850eec4e4e9..7164f3365a15 100644 --- a/core/modules/system/tests/src/Functional/System/FrontPageTest.php +++ b/core/modules/system/tests/src/Functional/System/FrontPageTest.php @@ -66,7 +66,7 @@ public function testDrupalFrontPage() { $this->drupalGet('node'); $this->assertSession()->pageTextContains('On front page.'); $this->drupalGet($this->nodePath); - $this->assertNoText('On front page.'); + $this->assertSession()->pageTextNotContains('On front page.'); // Change the front page to an invalid path. $edit = ['site_frontpage' => '/kittens']; @@ -90,7 +90,7 @@ public function testDrupalFrontPage() { $this->drupalGet(''); $this->assertSession()->pageTextContains('On front page.'); $this->drupalGet('node'); - $this->assertNoText('On front page.'); + $this->assertSession()->pageTextNotContains('On front page.'); $this->drupalGet($this->nodePath); $this->assertSession()->pageTextContains('On front page.'); } diff --git a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php index 85e35aa6662c..634c3ebe964e 100644 --- a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php +++ b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php @@ -77,7 +77,7 @@ public function testPageNotFoundCustomPageWithAccessDenied() { $this->config('system.site')->set('page.404', '/system-test/custom-4xx')->save(); $this->drupalGet('/this-path-does-not-exist'); - $this->assertNoText('Admin-only 4xx response'); + $this->assertSession()->pageTextNotContains('Admin-only 4xx response'); $this->assertSession()->pageTextContains('The requested page could not be found.'); $this->assertSession()->statusCodeEquals(404); // Verify the access cacheability metadata for custom 404 is bubbled. @@ -86,7 +86,7 @@ public function testPageNotFoundCustomPageWithAccessDenied() { $this->drupalLogin($this->adminUser); $this->drupalGet('/this-path-does-not-exist'); $this->assertSession()->pageTextContains('Admin-only 4xx response'); - $this->assertNoText('The requested page could not be found.'); + $this->assertSession()->pageTextNotContains('The requested page could not be found.'); $this->assertSession()->statusCodeEquals(404); // Verify the access cacheability metadata for custom 404 is bubbled. $this->assertCacheContext('user.roles'); diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php index 3dcbdb35429d..684e195d2323 100644 --- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php +++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php @@ -96,9 +96,9 @@ public function testSiteMaintenance() { // Verify that user is able to log in. $this->drupalGet('user'); - $this->assertNoText($offline_message); + $this->assertSession()->pageTextNotContains($offline_message); $this->drupalGet('user/login'); - $this->assertNoText($offline_message); + $this->assertSession()->pageTextNotContains($offline_message); // Log in user and verify that maintenance mode message is displayed // directly after login. diff --git a/core/modules/system/tests/src/Functional/System/StatusTest.php b/core/modules/system/tests/src/Functional/System/StatusTest.php index 717c4aa56e16..1beb8513289b 100644 --- a/core/modules/system/tests/src/Functional/System/StatusTest.php +++ b/core/modules/system/tests/src/Functional/System/StatusTest.php @@ -60,7 +60,7 @@ public function testStatusPage() { } // If a module is fully installed no pending updates exists. - $this->assertNoText('Out of date'); + $this->assertSession()->pageTextNotContains('Out of date'); // The setting config_sync_directory is not properly formed. $this->assertRaw(t("Your %file file must define the %setting setting", ['%file' => $this->siteDirectory . '/settings.php', '%setting' => "\$settings['config_sync_directory']"])); diff --git a/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php b/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php index 2dec1ab4a4c3..8f42feb75a66 100644 --- a/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php +++ b/core/modules/system/tests/src/Functional/System/SystemAuthorizeTest.php @@ -54,7 +54,7 @@ public function testFileTransferHooks() { $page_title = $this->randomMachineName(16); $this->drupalGetAuthorizePHP($page_title); $this->assertSession()->titleEquals("$page_title | Drupal"); - $this->assertNoText('It appears you have reached this page in error.'); + $this->assertSession()->pageTextNotContains('It appears you have reached this page in error.'); $this->assertSession()->pageTextContains('To continue, provide your server connection details'); // Make sure we see the new connection method added by system_test. $this->assertRaw('System Test FileTransfer'); diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php index 8c2f5a97bc3f..b41b76584b54 100644 --- a/core/modules/system/tests/src/Functional/System/ThemeTest.php +++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php @@ -111,7 +111,7 @@ public function testThemeSettings() { ]; $this->drupalGet('admin/appearance/settings'); $this->submitForm($edit, 'Save configuration'); - $this->assertNoText('The custom logo path is invalid.'); + $this->assertSession()->pageTextNotContains('The custom logo path is invalid.'); $this->assertSession()->fieldValueEquals('logo_path', $expected['form']); // Verify logo path examples. @@ -231,8 +231,8 @@ public function testThemeSettings() { ]; $this->drupalGet('admin/appearance/settings'); $this->submitForm($edit, 'Save configuration'); - $this->assertNoText('The custom logo path is invalid.'); - $this->assertNoText('The custom favicon path is invalid.'); + $this->assertSession()->pageTextNotContains('The custom logo path is invalid.'); + $this->assertSession()->pageTextNotContains('The custom favicon path is invalid.'); } /** @@ -255,8 +255,8 @@ public function testThemeSettingsLogo() { // module is not enabled. \Drupal::service('module_installer')->uninstall(['file']); $this->drupalGet('admin/appearance/settings'); - $this->assertNoText('Logo image settings'); - $this->assertNoText('Shortcut icon settings'); + $this->assertSession()->pageTextNotContains('Logo image settings'); + $this->assertSession()->pageTextNotContains('Shortcut icon settings'); } /** @@ -483,7 +483,7 @@ public function testInstallAndSetAsDefault() { $this->assertEquals($theme_machine_name, $this->config('system.theme')->get('default')); // This checks for a regression. See https://www.drupal.org/node/2498691. - $this->assertNoText("The $theme_machine_name theme was not found."); + $this->assertSession()->pageTextNotContains("The $theme_machine_name theme was not found."); $themes = \Drupal::service('theme_handler')->rebuildThemeData(); $version = $themes[$theme_machine_name]->info['version']; diff --git a/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php index 7cd097684daf..58a6e3933efb 100644 --- a/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php @@ -49,7 +49,7 @@ public function testExperimentalConfirmForm() { $this->drupalGet('admin/appearance'); $this->cssSelect('a[title="Install <strong>Test theme</strong> theme"]')[0]->click(); $this->assertSession()->pageTextContains('The <strong>Test theme</strong> theme has been installed.'); - $this->assertNoText('Experimental modules are provided for testing purposes only.'); + $this->assertSession()->pageTextNotContains('Experimental modules are provided for testing purposes only.'); // Next, test installing an experimental theme with no dependencies. // There should be a confirmation form with an experimental warning, but no @@ -60,11 +60,11 @@ public function testExperimentalConfirmForm() { // The module should not be enabled and there should be a warning and a // list of the experimental modules with only this one. - $this->assertNoText('The Experimental Test theme has been installed.'); + $this->assertSession()->pageTextNotContains('The Experimental Test theme has been installed.'); $this->assertSession()->pageTextContains('Experimental themes are provided for testing purposes only.'); // There should be no message about enabling dependencies. - $this->assertNoText('You must enable'); + $this->assertSession()->pageTextNotContains('You must enable'); // Enable the theme and confirm that it worked. $this->submitForm([], 'Continue'); @@ -72,9 +72,9 @@ public function testExperimentalConfirmForm() { // Setting it as the default should not ask for another confirmation. $this->cssSelect('a[title="Set Experimental test as default theme"]')[0]->click(); - $this->assertNoText('Experimental themes are provided for testing purposes only. Use at your own risk.'); + $this->assertSession()->pageTextNotContains('Experimental themes are provided for testing purposes only. Use at your own risk.'); $this->assertSession()->pageTextContains('Experimental test is now the default theme.'); - $this->assertNoText(sprintf('Experimental test %s (experimental theme)', \Drupal::VERSION)); + $this->assertSession()->pageTextNotContains(sprintf('Experimental test %s (experimental theme)', \Drupal::VERSION)); $this->assertSession()->responseContains(sprintf('Experimental test %s (default theme, administration theme, experimental theme)', \Drupal::VERSION)); // Uninstall the theme. @@ -96,13 +96,13 @@ public function testExperimentalConfirmForm() { // The theme should not be enabled and there should be a warning and a // list of the experimental modules with only this one. - $this->assertNoText('The Experimental dependency test theme has been installed.'); + $this->assertSession()->pageTextNotContains('The Experimental dependency test theme has been installed.'); $this->assertSession()->pageTextContains('Experimental themes are provided for testing purposes only. Use at your own risk.'); $this->assertSession()->pageTextContains('The following themes are experimental: Experimental test'); // Ensure the non-experimental theme is not listed as experimental. - $this->assertNoText('The following themes are experimental: Experimental test, Experimental dependency test'); - $this->assertNoText('The following themes are experimental: Experimental dependency test'); + $this->assertSession()->pageTextNotContains('The following themes are experimental: Experimental test, Experimental dependency test'); + $this->assertSession()->pageTextNotContains('The following themes are experimental: Experimental dependency test'); // There should be a message about enabling dependencies. $this->assertSession()->pageTextContains('You must enable the Experimental test theme to install Experimental dependency test'); @@ -115,7 +115,7 @@ public function testExperimentalConfirmForm() { // Setting it as the default should not ask for another confirmation. $this->cssSelect('a[title="Set Experimental dependency test as default theme"]')[0]->click(); - $this->assertNoText('Experimental themes are provided for testing purposes only. Use at your own risk.'); + $this->assertSession()->pageTextNotContains('Experimental themes are provided for testing purposes only. Use at your own risk.'); $this->assertSession()->pageTextContains('Experimental dependency test is now the default theme.'); $this->assertSession()->responseContains(sprintf('Experimental test %s (experimental theme)', \Drupal::VERSION)); $this->assertSession()->responseContains(sprintf('Experimental dependency test %s (default theme, administration theme)', \Drupal::VERSION)); diff --git a/core/modules/system/tests/src/Functional/Theme/FastTest.php b/core/modules/system/tests/src/Functional/Theme/FastTest.php index 95888c282119..ec6f3a9d38f9 100644 --- a/core/modules/system/tests/src/Functional/Theme/FastTest.php +++ b/core/modules/system/tests/src/Functional/Theme/FastTest.php @@ -35,7 +35,7 @@ public function testUserAutocomplete() { $this->drupalLogin($this->account); $this->drupalGet('user/autocomplete', ['query' => ['q' => $this->account->getAccountName()]]); $this->assertRaw($this->account->getAccountName()); - $this->assertNoText('registry initialized'); + $this->assertSession()->pageTextNotContains('registry initialized'); } } diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php index 66e07ef12e5a..5c5eeec7292a 100644 --- a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php @@ -56,7 +56,7 @@ public function testNegotiatorPriorities() { $this->drupalGet('theme-test/priority'); // Ensure that the custom theme negotiator was not able to set the theme. - $this->assertNoText('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test'); + $this->assertSession()->pageTextNotContains('Theme hook implementor=theme-test--suggestion.html.twig. Foo=template_preprocess_theme_test'); } /** diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php index daca1401a023..39fce07d4c25 100644 --- a/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php +++ b/core/modules/system/tests/src/Functional/Theme/ThemeUiTest.php @@ -343,7 +343,7 @@ public function testInstalledIncompatibleTheme() { file_put_contents($file_path, Yaml::encode($compatible_info)); $this->drupalGet('admin/appearance'); - $this->assertNoText($incompatible_themes_message); + $this->assertSession()->pageTextNotContains($incompatible_themes_message); $page->clickLink("Install $theme_name theme"); $assert_session->addressEquals('admin/appearance'); $assert_session->pageTextContains("The $theme_name theme has been installed"); @@ -364,7 +364,7 @@ public function testInstalledIncompatibleTheme() { file_put_contents($file_path, Yaml::encode($compatible_info)); $this->drupalGet('admin/appearance'); - $this->assertNoText($incompatible_themes_message); + $this->assertSession()->pageTextNotContains($incompatible_themes_message); } // Uninstall the theme and ensure that incompatible themes message is not // displayed for themes that are not installed. @@ -373,7 +373,7 @@ public function testInstalledIncompatibleTheme() { $incompatible_info = $info + $incompatible_update; file_put_contents($file_path, Yaml::encode($incompatible_info)); $this->drupalGet('admin/appearance'); - $this->assertNoText($incompatible_themes_message); + $this->assertSession()->pageTextNotContains($incompatible_themes_message); } } diff --git a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php index f55db4c9c7e0..45de8f1efec8 100644 --- a/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php +++ b/core/modules/system/tests/src/Functional/Theme/TwigExtensionTest.php @@ -63,7 +63,7 @@ public function testTwigExtensionFunction() { $this->drupalGet('twig-extension-test/function'); $this->assertSession()->pageTextContains('THE QUICK BROWN BOX JUMPS OVER THE LAZY DOG 123.'); $this->assertSession()->pageTextContains('the quick brown box jumps over the lazy dog 123.'); - $this->assertNoText('The Quick Brown Fox Jumps Over The Lazy Dog 123.'); + $this->assertSession()->pageTextNotContains('The Quick Brown Fox Jumps Over The Lazy Dog 123.'); } /** diff --git a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php index 80ce0f187e35..c68c1c9d7a16 100644 --- a/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php +++ b/core/modules/system/tests/src/Functional/Theme/TwigTransTest.php @@ -177,7 +177,7 @@ protected function assertTwigTransTags() { // Makes sure https://www.drupal.org/node/2489024 doesn't happen without // twig debug. // Ensure that running php code inside a Twig trans is not possible. - $this->assertNoText(pi()); + $this->assertSession()->pageTextNotContains(pi()); } /** diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php index bcb801103c28..cf64b7d53605 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatePathTestBaseFilledTest.php @@ -76,7 +76,7 @@ public function testUpdatedSite() { $this->assertSession()->pageTextContains('Hola'); $this->assertSession()->pageTextContains('Hello'); // The user entity reference field is access restricted. - $this->assertNoText('Test 12'); + $this->assertSession()->pageTextNotContains('Test 12'); // Make sure all other field labels are there. for ($i = 1; $i <= 23; $i++) { if ($i != 12) { @@ -140,7 +140,7 @@ public function testUpdatedSite() { // Make sure the user is translated. $this->drupalGet('user/3/translations'); - $this->assertNoText('Not translated'); + $this->assertSession()->pageTextNotContains('Not translated'); // Make sure the custom field on the user is still there. $this->drupalGet('admin/config/people/accounts/fields'); diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php index 83c8d58d42a5..37c9eb05c3c7 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php @@ -148,7 +148,7 @@ public function testRequirements() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->assertSession()->pageTextContains('This is a requirements warning provided by the update_script_test module.'); $this->clickLink('try again'); - $this->assertNoText('This is a requirements warning provided by the update_script_test module.'); + $this->assertSession()->pageTextNotContains('This is a requirements warning provided by the update_script_test module.'); $this->clickLink('Continue'); $this->clickLink('Apply pending updates'); $this->checkForMetaRefresh(); @@ -160,7 +160,7 @@ public function testRequirements() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->assertSession()->pageTextContains('This is a requirements warning provided by the update_script_test module.'); $this->clickLink('try again'); - $this->assertNoText('This is a requirements warning provided by the update_script_test module.'); + $this->assertSession()->pageTextNotContains('This is a requirements warning provided by the update_script_test module.'); $this->clickLink('Continue'); $this->assertSession()->pageTextContains('No pending updates.'); // Confirm that all caches were cleared. @@ -695,7 +695,7 @@ protected function runUpdates($maintenance_mode) { $this->assertSession()->pageTextContains('Operating in maintenance mode.'); } else { - $this->assertNoText('Operating in maintenance mode.'); + $this->assertSession()->pageTextNotContains('Operating in maintenance mode.'); } $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); @@ -709,8 +709,8 @@ protected function runUpdates($maintenance_mode) { $this->assertSession()->pageTextContains('The update_script_test_update_8001() update was executed successfully.'); // Verify that no 7.x updates were run. - $this->assertNoText('The update_script_test_update_7200() update was executed successfully.'); - $this->assertNoText('The update_script_test_update_7201() update was executed successfully.'); + $this->assertSession()->pageTextNotContains('The update_script_test_update_7200() update was executed successfully.'); + $this->assertSession()->pageTextNotContains('The update_script_test_update_7201() update was executed successfully.'); // Verify that there are no links to different parts of the workflow. $this->assertSession()->linkNotExists('Administration pages'); diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index 147973778cd1..e1107dfe84c4 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -177,9 +177,9 @@ public function testTaxonomyTermChildTerms() { // Get Page 3. No parent term and no terms <18 are displayed. Terms 18-25 // are displayed. $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 2]]); - $this->assertNoText($term1->getName()); + $this->assertSession()->pageTextNotContains($term1->getName()); for ($x = 1; $x <= 17; $x++) { - $this->assertNoText($terms_array[$x]->getName()); + $this->assertSession()->pageTextNotContains($terms_array[$x]->getName()); } for ($x = 18; $x <= 25; $x++) { $this->assertSession()->pageTextContains($terms_array[$x]->getName()); @@ -324,8 +324,8 @@ public function testNodeTermCreationAndDeletion() { foreach ($term_names as $term_name) { $this->assertSession()->pageTextContains($term_name); } - $this->assertNoText($term_objects['term1']->getName()); - $this->assertNoText($term_objects['term2']->getName()); + $this->assertSession()->pageTextNotContains($term_objects['term1']->getName()); + $this->assertSession()->pageTextNotContains($term_objects['term2']->getName()); } /** diff --git a/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php b/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php index 08bce7b6a268..a710b0c685a0 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTranslationFieldViewTest.php @@ -64,11 +64,11 @@ public function testTranslatedTaxonomyTermReferenceDisplay() { $translation_path = $this->translateToLangcode . '/' . $path; $this->drupalGet($path); - $this->assertNoText($this->translatedTagName); + $this->assertSession()->pageTextNotContains($this->translatedTagName); $this->assertSession()->pageTextContains($this->baseTagName); $this->drupalGet($translation_path); $this->assertSession()->pageTextContains($this->translatedTagName); - $this->assertNoText($this->baseTagName); + $this->assertSession()->pageTextNotContains($this->baseTagName); } /** diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php index 32d15e720872..6599e7cbd7c4 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyParentUITest.php @@ -46,7 +46,7 @@ protected function setUp($import_test_views = TRUE): void { */ public function testTaxonomyParentUI() { $this->drupalGet('admin/structure/views/nojs/handler/test_taxonomy_parent/default/relationship/parent'); - $this->assertNoText('The handler for this item is broken or missing.'); + $this->assertSession()->pageTextNotContains('The handler for this item is broken or missing.'); } } diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php index 9e9d4467283a..c0a521ca20a1 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php @@ -120,11 +120,11 @@ public function testTaxonomyTermView() { $this->drupalGet('taxonomy/term/' . $term->id()); $this->assertSession()->pageTextContains($term->label()); $this->assertSession()->pageTextContains($original_title); - $this->assertNoText($translated_title); + $this->assertSession()->pageTextNotContains($translated_title); $this->drupalGet('ur/taxonomy/term/' . $term->id()); $this->assertSession()->pageTextContains($term->label()); - $this->assertNoText($original_title); + $this->assertSession()->pageTextNotContains($original_title); $this->assertSession()->pageTextContains($translated_title); // Uninstall language module and ensure that the language is not part of the diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php index 841ab102fc59..6415390dc104 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyVocabularyArgumentTest.php @@ -75,7 +75,7 @@ public function testTermWithVocabularyArgument() { // First term should be present. $this->assertSession()->pageTextContains($this->terms[0]->label()); // Second term should not be present. - $this->assertNoText($this->terms[1]->label()); + $this->assertSession()->pageTextNotContains($this->terms[1]->label()); } } diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php index 74a1c410b1d7..5813f1f348b8 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php @@ -330,7 +330,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() { ]; $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); - $this->assertNoText('No strings available'); + $this->assertSession()->pageTextNotContains('No strings available'); // Verify that search found the string as untranslated. $this->assertSession()->pageTextContains($name); diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php index 02ebdb46576b..f7889240ace4 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php @@ -74,7 +74,7 @@ public function testToolbarClasses() { $this->drupalGet('admin/config/regional/translate'); $this->submitForm($search, 'Filter'); // Make sure will be able to translate the menu item. - $this->assertNoText('No strings available.'); + $this->assertSession()->pageTextNotContains('No strings available.'); // Check that the class is on the item before we translate it. $xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]'); diff --git a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php index 2a97a0f27128..c03b86940ae9 100644 --- a/core/modules/tour/tests/src/Functional/TourHelpPageTest.php +++ b/core/modules/tour/tests/src/Functional/TourHelpPageTest.php @@ -87,7 +87,7 @@ protected function verifyHelp($tours_ok = TRUE) { $this->assertSession()->pageTextContains('Tours guide you through workflows'); } else { - $this->assertNoText('Tours guide you through workflows'); + $this->assertSession()->pageTextNotContains('Tours guide you through workflows'); } $titles = $this->getTourList(); @@ -115,7 +115,7 @@ protected function verifyHelp($tours_ok = TRUE) { $this->assertSession()->linkNotExistsExact($title); } else { - $this->assertNoText($title); + $this->assertSession()->pageTextNotContains($title); // Just test the first item in the list of text that should not // be there, because the second matches part of the name of a module // that is in the Module overviews section, so the text will be there diff --git a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php index 7e5da4f46e05..e3921eb0307f 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php @@ -104,10 +104,10 @@ public function testTrackerNodeAccess() { // User without access should not see private node. $this->drupalLogin($no_access_user); $this->drupalGet('activity'); - $this->assertNoText($private_node->getTitle()); + $this->assertSession()->pageTextNotContains($private_node->getTitle()); $this->assertSession()->pageTextContains($public_node->getTitle()); $this->drupalGet('user/' . $access_user->id() . '/activity'); - $this->assertNoText($private_node->getTitle()); + $this->assertSession()->pageTextNotContains($private_node->getTitle()); $this->assertSession()->pageTextContains($public_node->getTitle()); } diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php index 4cfde59098a3..0ac9a7c71215 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -88,7 +88,7 @@ public function testTrackerAll() { ]); $this->drupalGet('activity'); - $this->assertNoText($unpublished->label()); + $this->assertSession()->pageTextNotContains($unpublished->label()); $this->assertSession()->pageTextContains($published->label()); $this->assertSession()->linkExists('My recent content', 0, 'User tab shows up on the global tracker page.'); @@ -121,7 +121,7 @@ public function testTrackerAll() { // Delete a node and ensure it no longer appears on the tracker. $published->delete(); $this->drupalGet('activity'); - $this->assertNoText($published->label()); + $this->assertSession()->pageTextNotContains($published->label()); // Test proper display of time on activity page when comments are disabled. // Disable comments. @@ -173,9 +173,9 @@ public function testTrackerUser() { $this->submitForm($comment, 'Save'); $this->drupalGet('user/' . $this->user->id() . '/activity'); - $this->assertNoText($unpublished->label()); + $this->assertSession()->pageTextNotContains($unpublished->label()); $this->assertSession()->pageTextContains($my_published->label()); - $this->assertNoText($other_published_no_comment->label()); + $this->assertSession()->pageTextNotContains($other_published_no_comment->label()); $this->assertSession()->pageTextContains($other_published_my_comment->label()); // Assert cache contexts. @@ -224,7 +224,7 @@ public function testTrackerUser() { $this->drupalGet('comment/1/edit'); $this->submitForm(['status' => CommentInterface::NOT_PUBLISHED], 'Save'); $this->drupalGet('user/' . $this->user->id() . '/activity'); - $this->assertNoText($other_published_my_comment->label()); + $this->assertSession()->pageTextNotContains($other_published_my_comment->label()); // Test escaping of title on user's tracker tab. \Drupal::service('module_installer')->install(['user_hooks_test']); diff --git a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php index ba362c71750d..58fda4cf9e8e 100644 --- a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php +++ b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php @@ -52,7 +52,7 @@ public function testViaAuthorize($url) { // Ensure the module does not already exist. $this->drupalGet('admin/modules'); - $this->assertNoText('Update test new module'); + $this->assertSession()->pageTextNotContains('Update test new module'); $edit = [ 'project_url' => $url, diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index 2eb4e0dae8c6..c0ba0767ba54 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -72,7 +72,7 @@ public function testNoReleasesAvailable() { $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); $this->assertSession()->pageTextContains('Up to date'); $this->assertSession()->responseContains('<h3>Modules</h3>'); - $this->assertNoText('Update available'); + $this->assertSession()->pageTextNotContains('Update available'); $this->assertSession()->pageTextContains('No available releases found'); $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); @@ -105,7 +105,7 @@ public function testUpdateContribBasic() { $this->standardTests(); $this->assertSession()->pageTextContains('Up to date'); $this->assertSession()->responseContains('<h3>Modules</h3>'); - $this->assertNoText('Update available'); + $this->assertSession()->pageTextNotContains('Update available'); $this->assertRaw($project_link); // Since aaa_update_test is installed the fact it is hidden and in the @@ -182,7 +182,7 @@ public function testUpdateContribOrder() { $this->standardTests(); // We're expecting the report to say all projects are up to date. $this->assertSession()->pageTextContains('Up to date'); - $this->assertNoText('Update available'); + $this->assertSession()->pageTextNotContains('Update available'); // We want to see all 3 module names listed, since they'll show up either // as project names or as modules under the "Includes" listing. $this->assertSession()->pageTextContains('AAA Update test'); @@ -396,14 +396,15 @@ public function testUpdateShowDisabledThemes() { $this->refreshUpdateStatus($xml_mapping); // In neither case should we see the "Themes" heading for installed // themes. - $this->assertNoText('Themes'); + // Use regex pattern because we need to match 'Themes' case sensitively. + $this->assertSession()->pageTextNotMatches('/Themes/'); if ($check_disabled) { $this->assertSession()->pageTextContains('Uninstalled themes'); $this->assertRaw($base_theme_project_link); $this->assertRaw($sub_theme_project_link); } else { - $this->assertNoText('Uninstalled themes'); + $this->assertSession()->pageTextNotContains('Uninstalled themes'); $this->assertNoRaw($base_theme_project_link); $this->assertNoRaw($sub_theme_project_link); } @@ -483,7 +484,7 @@ public function testUpdateBrokenFetchURL() { // hope that 'Up to date' is not unique. $this->assertSession()->pageTextMatchesCount(3, '/Up to date/'); // It should say we failed to get data, not that we're missing an update. - $this->assertNoText('Update available'); + $this->assertSession()->pageTextNotContains('Update available'); // We need to check that this string is found as part of a project row, not // just in the "Failed to get available update data" message at the top of @@ -549,7 +550,7 @@ public function testHookUpdateStatusAlter() { $update_test_config->set('update_status', [])->save(); $this->drupalGet('admin/reports/updates'); $this->assertSession()->responseContains('<h3>Modules</h3>'); - $this->assertNoText('Security update required!'); + $this->assertSession()->pageTextNotContains('Security update required!'); $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Turn the altering back on and visit the Update manager UI. @@ -560,7 +561,7 @@ public function testHookUpdateStatusAlter() { // Turn the altering back off and visit the Update manager UI. $update_test_config->set('update_status', [])->save(); $this->drupalGet('admin/modules/update'); - $this->assertNoText('Security update'); + $this->assertSession()->pageTextNotContains('Security update'); } /** diff --git a/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php index c6018660148a..64b371c57369 100644 --- a/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateSemverCoreTest.php @@ -278,10 +278,10 @@ public function testDatestampMismatch() { ]; $this->config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus(['drupal' => 'dev']); - $this->assertNoText('2001-Sep-'); + $this->assertSession()->pageTextNotContains('2001-Sep-'); $this->assertSession()->pageTextContains('Up to date'); - $this->assertNoText('Update available'); - $this->assertNoText('Security update required!'); + $this->assertSession()->pageTextNotContains('Update available'); + $this->assertSession()->pageTextNotContains('Security update required!'); } /** @@ -298,7 +298,7 @@ public function testModulePageRunCron() { $this->cronRun(); $this->drupalGet('admin/modules'); - $this->assertNoText('No update information available.'); + $this->assertSession()->pageTextNotContains('No update information available.'); } /** @@ -336,8 +336,8 @@ public function testModulePageUpToDate() { $this->checkForMetaRefresh(); $this->assertSession()->pageTextContains('Checked available update data for one project.'); $this->drupalGet('admin/modules'); - $this->assertNoText('There are updates available for your version of Drupal.'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There are updates available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); } /** @@ -359,7 +359,7 @@ public function testModulePageRegularUpdate() { $this->assertSession()->pageTextContains('Checked available update data for one project.'); $this->drupalGet('admin/modules'); $this->assertSession()->pageTextContains('There are updates available for your version of Drupal.'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); } /** @@ -380,12 +380,12 @@ public function testModulePageSecurityUpdate() { $this->checkForMetaRefresh(); $this->assertSession()->pageTextContains('Checked available update data for one project.'); $this->drupalGet('admin/modules'); - $this->assertNoText('There are updates available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There are updates available for your version of Drupal.'); $this->assertSession()->pageTextContains('There is a security update available for your version of Drupal.'); // Make sure admin/appearance warns you you're missing a security update. $this->drupalGet('admin/appearance'); - $this->assertNoText('There are updates available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There are updates available for your version of Drupal.'); $this->assertSession()->pageTextContains('There is a security update available for your version of Drupal.'); // Make sure duplicate messages don't appear on Update status pages. @@ -393,10 +393,10 @@ public function testModulePageSecurityUpdate() { $this->assertSession()->pageTextContainsOnce('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/reports/updates'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/reports/updates/settings'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); } /** @@ -405,7 +405,7 @@ public function testModulePageSecurityUpdate() { public function testServiceUnavailable() { $this->refreshUpdateStatus([], '503-error'); // Ensure that no "Warning: SimpleXMLElement..." parse errors are found. - $this->assertNoText('SimpleXMLElement'); + $this->assertSession()->pageTextNotContains('SimpleXMLElement'); $this->assertSession()->pageTextContainsOnce('Failed to get available update data for one project.'); } diff --git a/core/modules/update/tests/src/Functional/UpdateTestBase.php b/core/modules/update/tests/src/Functional/UpdateTestBase.php index dd4d0279621b..fcffc24cdbc2 100644 --- a/core/modules/update/tests/src/Functional/UpdateTestBase.php +++ b/core/modules/update/tests/src/Functional/UpdateTestBase.php @@ -109,7 +109,7 @@ protected function standardTests() { $this->assertSession()->responseContains('<h3>Drupal core</h3>'); // Verify that the link to the Drupal project appears. $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); - $this->assertNoText('No available releases found'); + $this->assertSession()->pageTextNotContains('No available releases found'); $this->assertSession()->pageTextContains('Last checked:'); } diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php index f3ef4caa8eec..dc5aae50a8c4 100644 --- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php +++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php @@ -180,25 +180,25 @@ public function testUpdateManagerCoreSecurityUpdateMessages() { // about core missing a security update. $this->drupalGet('admin/modules/install'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/modules/update'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/appearance/install'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/appearance/update'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/reports/updates/install'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/reports/updates/update'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); $this->drupalGet('admin/update/ready'); - $this->assertNoText('There is a security update available for your version of Drupal.'); + $this->assertSession()->pageTextNotContains('There is a security update available for your version of Drupal.'); } /** diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index a572db57e5fe..65acd73caa31 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -30,6 +30,19 @@ class UserAdminTest extends BrowserTestBase { */ protected $defaultTheme = 'stark'; + /** + * Gets the xpath selector for a user account. + * + * @param \Drupal\user\Entity\UserInterface $user + * The user to get the link for. + * + * @return string + * The xpath selector for the user link. + */ + private static function getLinkSelectorForUser(UserInterface $user): string { + return '//td[contains(@class, "views-field-name")]/a[text()="' . $user->getAccountName() . '"]'; + } + /** * Registers a user and deletes it. */ @@ -88,9 +101,9 @@ public function testUserAdmin() { $this->drupalGet('admin/people', ['query' => ['permission' => 'administer taxonomy']]); // Check if the correct users show up. - $this->assertNoText($user_a->getAccountName()); - $this->assertSession()->pageTextContains($user_b->getAccountName()); - $this->assertSession()->pageTextContains($user_c->getAccountName()); + $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a)); + $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_b)); + $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c)); // Filter the users by role. Grab the system-generated role name for User C. $roles = $user_c->getRoles(); @@ -98,9 +111,9 @@ public function testUserAdmin() { $this->drupalGet('admin/people', ['query' => ['role' => reset($roles)]]); // Check if the correct users show up when filtered by role. - $this->assertNoText($user_a->getAccountName()); - $this->assertNoText($user_b->getAccountName()); - $this->assertSession()->pageTextContains($user_c->getAccountName()); + $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a)); + $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_b)); + $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c)); // Test blocking of a user. $account = $user_storage->load($user_c->id()); @@ -125,9 +138,9 @@ public function testUserAdmin() { // Test filtering on admin page for blocked users $this->drupalGet('admin/people', ['query' => ['status' => 2]]); - $this->assertNoText($user_a->getAccountName()); - $this->assertNoText($user_b->getAccountName()); - $this->assertSession()->pageTextContains($user_c->getAccountName()); + $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a)); + $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_b)); + $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c)); // Test unblocking of a user from /admin/people page and sending of activation mail $editunblock = []; diff --git a/core/modules/user/tests/src/Functional/UserBlocksTest.php b/core/modules/user/tests/src/Functional/UserBlocksTest.php index 34b4389e95db..46809bdabc4b 100644 --- a/core/modules/user/tests/src/Functional/UserBlocksTest.php +++ b/core/modules/user/tests/src/Functional/UserBlocksTest.php @@ -77,7 +77,7 @@ public function testUserLoginBlock() { $edit['pass'] = $user->passRaw; $this->drupalGet('admin/people/permissions'); $this->submitForm($edit, 'Log in'); - $this->assertNoText('User login'); + $this->assertSession()->pageTextNotContains('User login'); // Check that we are still on the same page. $this->assertSession()->addressEquals(Url::fromRoute('user.admin_permissions')); @@ -87,7 +87,7 @@ public function testUserLoginBlock() { $this->drupalGet('filter/tips'); $this->assertSession()->responseHeaderEquals(DynamicPageCacheSubscriber::HEADER, 'MISS'); $this->submitForm($edit, 'Log in'); - $this->assertNoText('User login'); + $this->assertSession()->pageTextNotContains('User login'); // Verify that we are still on the same page after login for allowed page. $this->assertSession()->responseMatches('!<title.*?Compose tips.*?</title>!'); @@ -96,7 +96,7 @@ public function testUserLoginBlock() { $this->drupalGet('filter/tips', ['query' => ['foo' => 'bar']]); $this->assertSession()->responseHeaderEquals(DynamicPageCacheSubscriber::HEADER, 'HIT'); $this->submitForm($edit, 'Log in'); - $this->assertNoText('User login'); + $this->assertSession()->pageTextNotContains('User login'); // Verify that we are still on the same page after login for allowed page. $this->assertSession()->responseMatches('!<title.*?Compose tips.*?</title>!'); $this->assertStringContainsString('/filter/tips?foo=bar', $this->getUrl(), 'Correct query arguments are displayed after login'); @@ -106,7 +106,7 @@ public function testUserLoginBlock() { $this->drupalGet('filter/tips', ['query' => ['foo' => 'baz']]); $this->assertSession()->responseHeaderEquals(DynamicPageCacheSubscriber::HEADER, 'HIT'); $this->submitForm($edit, 'Log in'); - $this->assertNoText('User login'); + $this->assertSession()->pageTextNotContains('User login'); // Verify that we are still on the same page after login for allowed page. $this->assertSession()->responseMatches('!<title.*?Compose tips.*?</title>!'); $this->assertStringContainsString('/filter/tips?foo=baz', $this->getUrl(), 'Correct query arguments are displayed after login'); @@ -129,7 +129,7 @@ public function testUserLoginBlock() { $this->submitForm($edit, 'Log in'); $this->assertSession()->pageTextContains('Unrecognized username or password. Forgot your password?'); $this->drupalGet('filter/tips'); - $this->assertNoText('Unrecognized username or password. Forgot your password?'); + $this->assertSession()->pageTextNotContains('Unrecognized username or password. Forgot your password?'); } } diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index a6ab36a03ab6..4f0db35fd506 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -193,7 +193,7 @@ public function testUserBlock() { $this->submitForm([], 'Cancel account'); $this->assertSession()->pageTextContains('Are you sure you want to cancel your account?'); $this->assertSession()->pageTextContains('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your username.'); - $this->assertNoText('Select the method to cancel the account above.'); + $this->assertSession()->pageTextNotContains('Select the method to cancel the account above.'); // Confirm account cancellation. $timestamp = time(); diff --git a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php index 449166fefe94..a3b0e9032340 100644 --- a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php @@ -45,7 +45,7 @@ public function testUserAdd() { $this->submitForm($edit, 'Create new account'); $this->assertSession()->pageTextContains('Unable to send email. Contact the site administrator if the problem persists.'); - $this->assertNoText('A welcome message with further instructions has been emailed to the new user ' . $edit['name'] . '.'); + $this->assertSession()->pageTextNotContains('A welcome message with further instructions has been emailed to the new user ' . $edit['name'] . '.'); } } diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php index 5d97b6489f80..d9905cdc3b12 100644 --- a/core/modules/user/tests/src/Functional/UserCreateTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateTest.php @@ -136,7 +136,7 @@ public function testUserAdd() { $this->drupalGet('admin/people/create'); $this->submitForm($edit, 'Create new account'); $this->assertSession()->pageTextContains("Created a new user account for $name. No email has been sent"); - $this->assertNoText('Password field is required'); + $this->assertSession()->pageTextNotContains('Password field is required'); } } diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index fbb86ffa9085..cc7b77969af1 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -170,7 +170,7 @@ public function testUserPasswordReset() { $this->drupalGet($resetURL); $this->submitForm([], 'Log in'); $this->drupalGet('user/' . $this->account->id() . '/edit'); - $this->assertNoText('Expected user_string to be a string, NULL given'); + $this->assertSession()->pageTextNotContains('Expected user_string to be a string, NULL given'); $this->drupalLogout(); // Create a password reset link as if the request time was 60 seconds older than the allowed limit. @@ -518,7 +518,7 @@ public function assertPasswordIpFlood() { * Makes assertions about a password reset not triggering IP flood control. */ public function assertNoPasswordIpFlood() { - $this->assertNoText('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'); + $this->assertSession()->pageTextNotContains('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'); } /** @@ -557,7 +557,7 @@ public function testResetImpersonation() { $this->drupalGet($attack_reset_url); $this->submitForm([], 'Log in'); // Verify that the invalid password reset page does not show the user name. - $this->assertNoText($user2->getAccountName()); + $this->assertSession()->pageTextNotContains($user2->getAccountName()); $this->assertSession()->addressEquals('user/password'); $this->assertSession()->pageTextContains('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'); } diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index f041a4cd9708..8938a6da9f6e 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -332,7 +332,7 @@ public function testRegistrationWithUserFields() { // Check that the field does not appear on the registration form. $this->drupalGet('user/register'); - $this->assertNoText($field->label()); + $this->assertSession()->pageTextNotContains($field->label()); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:core.entity_form_display.user.user.register'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:user.settings'); diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php index 1cb1900cb2a4..263b3a576fdb 100644 --- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php @@ -100,10 +100,10 @@ public function testRoleAdministration() { // interface. $this->drupalGet('admin/people/roles/manage/' . RoleInterface::ANONYMOUS_ID); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('Delete role'); + $this->assertSession()->pageTextNotContains('Delete role'); $this->drupalGet('admin/people/roles/manage/' . RoleInterface::AUTHENTICATED_ID); $this->assertSession()->statusCodeEquals(200); - $this->assertNoText('Delete role'); + $this->assertSession()->pageTextNotContains('Delete role'); } /** diff --git a/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php b/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php index 54c27a8049c4..e0d076972284 100644 --- a/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php +++ b/core/modules/user/tests/src/Functional/Views/FilterPermissionUiTest.php @@ -54,7 +54,7 @@ public function testHandlerUI() { $this->assertSession()->linkExists('User: Permission (= View user information)'); $this->submitForm([], 'Save'); // Verify that we can save the view. - $this->assertNoText('No valid values found on filter: User: Permission.'); + $this->assertSession()->pageTextNotContains('No valid values found on filter: User: Permission.'); $this->assertSession()->pageTextContains('The view test_filter_permission has been saved.'); // Verify that the handler summary is also correct when multiple values are @@ -70,7 +70,7 @@ public function testHandlerUI() { $this->assertSession()->linkExists('User: Permission (or View us…)'); $this->submitForm([], 'Save'); // Verify that we can save the view. - $this->assertNoText('No valid values found on filter: User: Permission.'); + $this->assertSession()->pageTextNotContains('No valid values found on filter: User: Permission.'); $this->assertSession()->pageTextContains('The view test_filter_permission has been saved.'); } diff --git a/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php b/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php index f9e610a58a46..3f68c071a63e 100644 --- a/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php +++ b/core/modules/user/tests/src/Functional/Views/HandlerFieldRoleTest.php @@ -49,7 +49,7 @@ public function testRole() { $this->assertSession()->responseContains($rolename_b . Html::escape('<em>' . $rolename_a . '</em>')); // Verify that the view test_views_handler_field_role does not render a role // not assigned to a user. - $this->assertNoText($rolename_not_assigned); + $this->assertSession()->pageTextNotContains($rolename_not_assigned); } } diff --git a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php index 40df001dc7ba..8c222f02b2d2 100644 --- a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php +++ b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php @@ -39,9 +39,9 @@ public function testUserFieldAccess() { $this->assertSession()->pageTextContains('Created'); // User does not by default have access to init, mail and status. - $this->assertNoText('Init'); - $this->assertNoText('Email'); - $this->assertNoText('Status'); + $this->assertSession()->pageTextNotContains('Init'); + $this->assertSession()->pageTextNotContains('Email'); + $this->assertSession()->pageTextNotContains('Status'); // Assign sub-admin role to grant extra access. $user = $this->drupalCreateUser(['sub-admin']); diff --git a/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php b/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php index b24afb3801f7..43dfdd1741ea 100644 --- a/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php +++ b/core/modules/views/tests/src/Functional/Entity/BaseFieldAccessTest.php @@ -67,7 +67,7 @@ protected function setUp($import_test_views = TRUE): void { public function testProtectedField() { $this->drupalGet('test-entity-protected-access'); $this->assertSession()->pageTextContains('ok to see this one'); - $this->assertNoText('no access value'); + $this->assertSession()->pageTextNotContains('no access value'); } } diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php index 7d5596cc1bdf..087d21a5b695 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php @@ -445,17 +445,17 @@ protected function checkTranslationSetting($expected_node_translatability = FALS $this->drupalGet('admin/structure/views/nojs/display/content/page_1/rendering_language'); if ($expected_node_translatability) { - $this->assertNoText($not_supported_text); + $this->assertSession()->pageTextNotContains($not_supported_text); $this->assertSession()->pageTextContains($supported_text); } else { $this->assertSession()->pageTextContains($not_supported_text); - $this->assertNoText($supported_text); + $this->assertSession()->pageTextNotContains($supported_text); } $this->drupalGet('admin/structure/views/nojs/display/files/page_1/rendering_language'); $this->assertSession()->pageTextContains($not_supported_text); - $this->assertNoText($supported_text); + $this->assertSession()->pageTextNotContains($supported_text); } } diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php index 3cb893936faa..fb626b4ba346 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php @@ -109,7 +109,7 @@ public function testExposedFormRenderCheckboxes() { // checked. $this->clickLink('Page 2'); $this->assertSession()->elementsCount('xpath', "//div[contains(@class, 'views-row')]", 1); - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); } /** @@ -158,14 +158,14 @@ public function testExposedIsAllOfFilter() { // All rows are displayed by default on the first page when no options are // checked. $this->assertSession()->elementsCount('xpath', "//div[contains(@class, 'views-row')]", 8); - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); // Select one option and ensure we still have results. $tid = $this->terms[0]->id(); $this->submitForm(["tid[$tid]" => $tid], 'Apply'); // Ensure only nodes tagged with $tid are displayed. $this->assertSession()->elementsCount('xpath', "//div[contains(@class, 'views-row')]", 2); - $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected. Please contact the site administrator.'); } } diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php index 42f5ae084caf..dc334a75681a 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php @@ -220,9 +220,12 @@ public function testExposedBlock($display) { $block->getPlugin()->setConfigurationValue('label_display', TRUE); $block->save(); - // Test that the block label is found. + // Assert that the only two occurrences of `$view->getTitle()` are the title + // and h2 tags. $this->drupalGet('test_exposed_block'); - $this->assertSession()->pageTextContains($view->getTitle()); + $this->assertSession()->elementContains('css', 'title', $view->getTitle()); + $this->assertSession()->elementExists('xpath', '//h2[text()="' . $view->getTitle() . '"]'); + $this->assertSession()->pageTextMatchesCount(2, '/' . $view->getTitle() . '/'); // Set a custom label on the exposed filter form block. $block->getPlugin()->setConfigurationValue('views_label', '<strong>Custom</strong> title<script>alert("hacked!");</script>'); @@ -237,9 +240,12 @@ public function testExposedBlock($display) { $block->save(); // Test that the label is removed. + // Assert that the only occurrence of `$view->getTitle()` is the title tag + // now that label has been removed. $this->drupalGet('test_exposed_block'); $this->assertNoRaw('<strong>Custom</strong> titlealert("hacked!");'); - $this->assertNoText($view->getTitle()); + $this->assertSession()->elementContains('css', 'title', $view->getTitle()); + $this->assertSession()->pageTextMatchesCount(1, '/' . $view->getTitle() . '/'); // Test there is an exposed form in a block. $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]); @@ -333,7 +339,7 @@ public function testTextInputRequired() { // Ensure that the "on demand text" is not displayed when an exposed filter // is applied. $this->drupalGet('test_exposed_form_buttons', ['query' => ['type' => 'article']]); - $this->assertNoText($on_demand_text); + $this->assertSession()->pageTextNotContains($on_demand_text); } /** diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php index a84bef2554cc..c1a933d83d4d 100644 --- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php @@ -171,7 +171,7 @@ public function testInOperatorSelectAllOptions() { $this->drupalGet('admin/structure/views/view/test_filter_in_operator_ui/edit/default'); $this->submitForm([], 'Save'); $this->submitForm([], 'Update preview'); - $this->assertNoText('An illegal choice has been detected.'); + $this->assertSession()->pageTextNotContains('An illegal choice has been detected.'); } /** diff --git a/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php b/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php index 6a27559a1e04..d41fb12882e1 100644 --- a/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/MenuLinkTest.php @@ -102,7 +102,7 @@ public function testHierarchicalMenuLinkVisibility() { // Test if the primary menu item (node) is visible, and the secondary menu // item (view) is hidden. $this->assertSession()->pageTextContains('Primary level node'); - $this->assertNoText('Secondary level view page'); + $this->assertSession()->pageTextNotContains('Secondary level view page'); // Go to the node page and ensure that both the first and second level items // are visible. diff --git a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php index bb72ff81c730..7c6c54c85f6a 100644 --- a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php @@ -58,7 +58,7 @@ public function testMiniPagerRender() { $this->drupalGet('test_mini_pager'); $this->assertSession()->pageTextContains('›› test'); $this->assertSession()->pageTextContains('Page 1'); - $this->assertNoText('‹‹ test'); + $this->assertSession()->pageTextNotContains('‹‹ test'); $this->assertSession()->pageTextContains($this->nodes[0]->label()); $this->assertSession()->pageTextContains($this->nodes[1]->label()); $this->assertSession()->pageTextContains($this->nodes[2]->label()); @@ -75,7 +75,7 @@ public function testMiniPagerRender() { // On last page, current page and previous page link appear, next page link // does not. $this->drupalGet('test_mini_pager', ['query' => ['page' => 6]]); - $this->assertNoText('›› test'); + $this->assertSession()->pageTextNotContains('›› test'); $this->assertSession()->pageTextContains('Page 7'); $this->assertSession()->pageTextContains('‹‹ test'); $this->assertSession()->pageTextContains($this->nodes[18]->label()); @@ -106,16 +106,16 @@ public function testMiniPagerRender() { $this->assertSession()->pageTextContains($this->nodes[1]->label()); $this->drupalGet('test_mini_pager_one', ['query' => ['page' => 19]]); - $this->assertNoText('››'); + $this->assertSession()->pageTextNotContains('››'); $this->assertSession()->pageTextContains('Page 20'); $this->assertSession()->pageTextContains('‹‹'); $this->assertSession()->pageTextContains($this->nodes[19]->label()); // Test a mini pager with all items on the page. No pager should display. $this->drupalGet('test_mini_pager_all'); - $this->assertNoText('‹‹ test'); - $this->assertNoText('Page 1'); - $this->assertNoText('test ››'); + $this->assertSession()->pageTextNotContains('‹‹ test'); + $this->assertSession()->pageTextNotContains('Page 1'); + $this->assertSession()->pageTextNotContains('test ››'); // Verify that all rows appear on the page. $this->assertSession()->elementsCount('xpath', "//div[contains(@class, 'views-row')]", count($this->nodes)); @@ -125,9 +125,9 @@ public function testMiniPagerRender() { } $this->drupalGet('test_mini_pager'); - $this->assertNoText('‹‹ test'); - $this->assertNoText('Page 1'); - $this->assertNoText('‹‹ test'); + $this->assertSession()->pageTextNotContains('‹‹ test'); + $this->assertSession()->pageTextNotContains('Page 1'); + $this->assertSession()->pageTextNotContains('‹‹ test'); $this->assertSession()->pageTextContains($this->nodes[19]->label()); $view = Views::getView('test_mini_pager'); @@ -138,9 +138,9 @@ public function testMiniPagerRender() { // Remove the last node as well and ensure that no "Page 1" is shown. $this->nodes[19]->delete(); $this->drupalGet('test_mini_pager'); - $this->assertNoText('‹‹ test'); - $this->assertNoText('Page 1'); - $this->assertNoText('‹‹ test'); + $this->assertSession()->pageTextNotContains('‹‹ test'); + $this->assertSession()->pageTextNotContains('Page 1'); + $this->assertSession()->pageTextNotContains('‹‹ test'); } } diff --git a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php index 15aa090a3028..edabcb016605 100644 --- a/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/ViewsBulkTest.php @@ -65,7 +65,7 @@ public function testBulkSelection() { // on the confirm form. $this->submitForm(['node_bulk_form[0]' => TRUE], 'Apply to selected items'); $this->assertSession()->pageTextContains($node_1->getTitle()); - $this->assertNoText($node_2->getTitle()); + $this->assertSession()->pageTextNotContains($node_2->getTitle()); // Change the pager limit to 2. $this->config('views.view.content')->set('display.default.display_options.pager.options.items_per_page', 2)->save(); @@ -83,7 +83,7 @@ public function testBulkSelection() { // selected on the confirm form. $this->submitForm(['node_bulk_form[1]' => TRUE], 'Apply to selected items'); $this->assertSession()->pageTextContains($node_1->getTitle()); - $this->assertNoText($node_3->getTitle()); + $this->assertSession()->pageTextNotContains($node_3->getTitle()); } } diff --git a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php index 5947c471c3f1..6d843b5bb764 100644 --- a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php +++ b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php @@ -50,11 +50,11 @@ public function testViewsWizardAndListing() { $this->assertSession()->linkByHrefExists(Url::fromRoute('entity.view.duplicate_form', ['view' => $view1['id']])->toString()); // The view should not have a REST export display. - $this->assertNoText('REST export'); + $this->assertSession()->pageTextNotContains('REST export'); // This view should not have a block. $this->drupalGet('admin/structure/block'); - $this->assertNoText($view1['label']); + $this->assertSession()->pageTextNotContains($view1['label']); // Create two nodes. $node1 = $this->drupalCreateNode(['type' => 'page']); @@ -104,11 +104,11 @@ public function testViewsWizardAndListing() { $this->assertSession()->linkByHrefExists(Url::fromRoute('view.' . $view2['id'] . '.page_1')->toString()); // The view should not have a REST export display. - $this->assertNoText('REST export'); + $this->assertSession()->pageTextNotContains('REST export'); // This view should not have a block. $this->drupalGet('admin/structure/block'); - $this->assertNoText('View: ' . $view2['label']); + $this->assertSession()->pageTextNotContains('View: ' . $view2['label']); // Create a view with a page and a block, and filter the listing. $view3 = []; @@ -131,7 +131,7 @@ public function testViewsWizardAndListing() { $this->assertSession()->addressEquals($view3['page[path]']); $this->assertSession()->pageTextContains($view3['page[title]']); $this->assertSession()->pageTextContains($node1->label()); - $this->assertNoText($node2->label()); + $this->assertSession()->pageTextNotContains($node2->label()); // Go back to the views page and check if this view is there. $this->drupalGet('admin/structure/views'); @@ -140,7 +140,7 @@ public function testViewsWizardAndListing() { $this->assertSession()->linkByHrefExists(Url::fromRoute('view.' . $view3['id'] . '.page_1')->toString()); // The view should not have a REST export display. - $this->assertNoText('REST export'); + $this->assertSession()->pageTextNotContains('REST export'); // Confirm that the block is available in the block administration UI. $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default')); @@ -154,10 +154,10 @@ public function testViewsWizardAndListing() { // for the expected node title in the block. $this->drupalGet('user'); $this->assertSession()->pageTextContains($node1->label()); - $this->assertNoText($node2->label()); + $this->assertSession()->pageTextNotContains($node2->label()); // Make sure the listing page doesn't show disabled default views. - $this->assertNoText('tracker'); + $this->assertSession()->pageTextNotContains('tracker'); // Create a view with only a REST export. $view4 = []; diff --git a/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php b/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php index 4b6e9c74e719..0a17137271da 100644 --- a/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php +++ b/core/modules/views/tests/src/Functional/Wizard/ItemsPerPageTest.php @@ -88,8 +88,8 @@ public function testItemsPerPage() { $this->assertSession()->pageTextContains($node4->label()); $this->assertSession()->pageTextContains($node3->label()); $this->assertSession()->pageTextContains($node2->label()); - $this->assertNoText($node1->label()); - $this->assertNoText($page_node->label()); + $this->assertSession()->pageTextNotContains($node1->label()); + $this->assertSession()->pageTextNotContains($page_node->label()); $pos5 = strpos($content, $node5->label()); $pos4 = strpos($content, $node4->label()); $pos3 = strpos($content, $node3->label()); @@ -112,9 +112,9 @@ public function testItemsPerPage() { $this->assertSession()->pageTextContains($node5->label()); $this->assertSession()->pageTextContains($node4->label()); $this->assertSession()->pageTextContains($node3->label()); - $this->assertNoText($node2->label()); - $this->assertNoText($node1->label()); - $this->assertNoText($page_node->label()); + $this->assertSession()->pageTextNotContains($node2->label()); + $this->assertSession()->pageTextNotContains($node1->label()); + $this->assertSession()->pageTextNotContains($page_node->label()); $pos5 = strpos($content, $node5->label()); $pos4 = strpos($content, $node4->label()); $pos3 = strpos($content, $node3->label()); diff --git a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php index a5457eb75752..188d3bcd12a6 100644 --- a/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php +++ b/core/modules/views/tests/src/Functional/Wizard/TaggedWithTest.php @@ -166,7 +166,7 @@ public function testTaggedWith() { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains($node_tag1_title); $this->assertSession()->pageTextContains($node_tag1_tag2_title); - $this->assertNoText($node_no_tags_title); + $this->assertSession()->pageTextNotContains($node_no_tags_title); // Create a view that filters by taxonomy term "tag2". It should show only // the one node from above that is tagged with "tag2". @@ -185,9 +185,9 @@ public function testTaggedWith() { $this->submitForm($view2, 'Save and edit'); $this->assertSession()->statusCodeEquals(200); $this->drupalGet($view2['page[path]']); - $this->assertNoText($node_tag1_title); + $this->assertSession()->pageTextNotContains($node_tag1_title); $this->assertSession()->pageTextContains($node_tag1_tag2_title); - $this->assertNoText($node_no_tags_title); + $this->assertSession()->pageTextNotContains($node_no_tags_title); } /** diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php index 383015616023..1c79b478c218 100644 --- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php +++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php @@ -90,7 +90,7 @@ public function testDefaultViews() { // $this->drupalGet($revert_href); // $this->submitForm(array(), 'Revert'); // $this->drupalGet('glossary'); - // $this->assertNoText($new_title); + // $this->assertSession()->pageTextNotContains($new_title); // Duplicate the view and check that the normal schema of duplicated views is used. $this->drupalGet('admin/structure/views'); diff --git a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php index 5b2ce890d68a..758e8c064923 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php @@ -98,7 +98,7 @@ public function testRemoveAttachedDisplay() { $this->submitForm([], 'Save'); // Check that there is no warning for the removed page display. - $this->assertNoText("Plugin ID 'page_1' was not found."); + $this->assertSession()->pageTextNotContains("Plugin ID 'page_1' was not found."); // Check that the attachment is no longer linked to the removed display. $this->assertSession()->pageTextContains('Not defined'); diff --git a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php index 89dc0c4aaa47..4a944e18f3df 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php @@ -143,7 +143,7 @@ public function testDuplicateDisplay() { $this->assertSession()->linkByHrefExists($path_prefix . '/block_1', 0, 'Make sure after duplicating the new display appears in the UI'); $this->assertSession()->addressEquals($path_prefix . '/block_1'); $this->assertSession()->pageTextContains('Block settings'); - $this->assertNoText('Page settings'); + $this->assertSession()->pageTextNotContains('Page settings'); $this->submitForm([], 'Save'); $view = Views::getView($view['id']); diff --git a/core/modules/views_ui/tests/src/Functional/DisplayTest.php b/core/modules/views_ui/tests/src/Functional/DisplayTest.php index 69f375b38ce9..a02269c3dacf 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayTest.php @@ -36,12 +36,14 @@ class DisplayTest extends UITestBase { */ public function testAddDisplay() { $view = $this->randomView(); - $this->assertNoText('Block'); - $this->assertNoText('Block 2'); + $this->assertSession()->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-1"]'); + $this->assertSession()->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-2"]'); + $this->assertSession()->pageTextMatchesCount(0, '/Block name:/'); $this->submitForm([], 'Add Block'); - $this->assertSession()->pageTextContains('Block'); - $this->assertNoText('Block 2'); + $this->assertSession()->elementTextContains('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-1"]', 'Block*'); + $this->assertSession()->elementNotExists('xpath', '//li[@data-drupal-selector="edit-displays-top-tabs-block-2"]'); + $this->assertSession()->pageTextMatchesCount(1, '/Block name:/'); } /** @@ -285,7 +287,7 @@ public function testHideDisplayOverride() { $this->submitForm([], 'Save'); $this->drupalGet('admin/structure/views/nojs/handler/test_display/page_1/field/title'); - $this->assertNoText('All displays'); + $this->assertSession()->pageTextNotContains('All displays'); // Test that the override option is shown when default display is on. \Drupal::configFactory()->getEditable('views.settings')->set('ui.show.default_display', TRUE)->save(); diff --git a/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php b/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php index eea148bdaa64..0952c5e1cd3b 100644 --- a/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php +++ b/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php @@ -76,9 +76,9 @@ public function testFilterNumericUI() { $this->submitForm(['age' => '2'], 'Apply'); $this->assertSession()->pageTextContains('John'); $this->assertSession()->pageTextContains('Paul'); - $this->assertNoText('Ringo'); + $this->assertSession()->pageTextNotContains('Ringo'); $this->assertSession()->pageTextContains('George'); - $this->assertNoText('Meredith'); + $this->assertSession()->pageTextNotContains('Meredith'); // Change the filter to a single filter to test the schema when the operator // is not exposed. @@ -94,16 +94,16 @@ public function testFilterNumericUI() { // Test that the filter works as expected. $this->drupalGet('test_view-path'); $this->assertSession()->pageTextContains('John'); - $this->assertNoText('Paul'); - $this->assertNoText('Ringo'); - $this->assertNoText('George'); - $this->assertNoText('Meredith'); + $this->assertSession()->pageTextNotContains('Paul'); + $this->assertSession()->pageTextNotContains('Ringo'); + $this->assertSession()->pageTextNotContains('George'); + $this->assertSession()->pageTextNotContains('Meredith'); $this->submitForm(['age' => '26'], 'Apply'); - $this->assertNoText('John'); + $this->assertSession()->pageTextNotContains('John'); $this->assertSession()->pageTextContains('Paul'); - $this->assertNoText('Ringo'); - $this->assertNoText('George'); - $this->assertNoText('Meredith'); + $this->assertSession()->pageTextNotContains('Ringo'); + $this->assertSession()->pageTextNotContains('George'); + $this->assertSession()->pageTextNotContains('Meredith'); // Change the filter to a 'between' filter to test if the label and // description are set for the 'minimum' filter element. diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 6c68cc6f101e..0c7fc4b936a5 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -284,12 +284,12 @@ public function testErrorMissingHelp() { // Test that the error message is not shown for entity fields but an empty // description field is shown instead. $this->drupalGet('admin/structure/views/nojs/add-handler/test_node_view/default/field'); - $this->assertNoText('Error: missing help'); + $this->assertSession()->pageTextNotContains('Error: missing help'); $this->assertRaw('<td class="description"></td>'); // Test that no error message is shown for other fields. $this->drupalGet('admin/structure/views/nojs/add-handler/test_view_empty/default/field'); - $this->assertNoText('Error: missing help'); + $this->assertSession()->pageTextNotContains('Error: missing help'); } /** diff --git a/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php b/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php index 5903db7571e2..968ff49a64af 100644 --- a/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php +++ b/core/modules/views_ui/tests/src/Functional/OverrideDisplaysTest.php @@ -114,11 +114,11 @@ public function testWizardMixedDefaultOverriddenDisplays() { $this->drupalGet($view['page[path]']); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains($view['page[title]']); - $this->assertNoText($view['block[title]']); + $this->assertSession()->pageTextNotContains($view['block[title]']); $this->drupalGet($view['page[feed_properties][path]']); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseContains($view['page[title]']); - $this->assertNoText($view['block[title]']); + $this->assertSession()->responseNotContains($view['block[title]']); // Confirm that the block is available in the block administration UI. $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default')); @@ -139,7 +139,7 @@ public function testWizardMixedDefaultOverriddenDisplays() { $this->drupalGet(''); $this->assertSession()->pageTextContains($view['block[title]']); - $this->assertNoText($view['page[title]']); + $this->assertSession()->pageTextNotContains($view['page[title]']); // Edit the page and change the title. This should automatically change // the feed's title also, but not the block. @@ -152,16 +152,16 @@ public function testWizardMixedDefaultOverriddenDisplays() { $this->drupalGet($view['page[path]']); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->pageTextContains($new_default_title); - $this->assertNoText($view['page[title]']); - $this->assertNoText($view['block[title]']); + $this->assertSession()->pageTextNotContains($view['page[title]']); + $this->assertSession()->pageTextNotContains($view['block[title]']); $this->drupalGet($view['page[feed_properties][path]']); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseContains($new_default_title); - $this->assertNoText($view['page[title]']); - $this->assertNoText($view['block[title]']); + $this->assertSession()->responseNotContains($view['page[title]']); + $this->assertSession()->responseNotContains($view['block[title]']); $this->drupalGet(''); - $this->assertNoText($new_default_title); - $this->assertNoText($view['page[title]']); + $this->assertSession()->pageTextNotContains($new_default_title); + $this->assertSession()->pageTextNotContains($view['page[title]']); $this->assertSession()->pageTextContains($view['block[title]']); // Edit the block and change the title. This should automatically change @@ -178,10 +178,10 @@ public function testWizardMixedDefaultOverriddenDisplays() { $this->drupalGet($view['page[feed_properties][path]']); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->responseContains($new_default_title); - $this->assertNoText($new_block_title); + $this->assertSession()->responseNotContains($new_block_title); $this->drupalGet(''); $this->assertSession()->pageTextContains($new_block_title); - $this->assertNoText($view['block[title]']); + $this->assertSession()->pageTextNotContains($view['block[title]']); } /** diff --git a/core/modules/views_ui/tests/src/Functional/StyleUITest.php b/core/modules/views_ui/tests/src/Functional/StyleUITest.php index 0d9b68a17f14..ecaaecaf90fd 100644 --- a/core/modules/views_ui/tests/src/Functional/StyleUITest.php +++ b/core/modules/views_ui/tests/src/Functional/StyleUITest.php @@ -67,7 +67,7 @@ public function testStyleUI() { $this->drupalGet("admin/structure/views/nojs/display/{$view_name}/page_1/row"); $this->submitForm(['row[type]' => 'fields'], 'Apply'); // If fields are being used this text will not be shown. - $this->assertNoText('The selected style or row format does not use fields.'); + $this->assertSession()->pageTextNotContains('The selected style or row format does not use fields.'); } } diff --git a/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php b/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php index 7638c8fe7bd9..0a1ea69bd6cc 100644 --- a/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php +++ b/core/modules/views_ui/tests/src/Functional/TranslatedViewTest.php @@ -82,7 +82,7 @@ public function testTranslatedStrings() { // Check if the label is translated. $this->drupalGet($edit_url, ['language' => \Drupal::languageManager()->getLanguage('fr')]); $this->assertSession()->titleEquals('Files (File) | Drupal'); - $this->assertNoText('Fichiers'); + $this->assertSession()->pageTextNotContains('Fichiers'); } } diff --git a/core/profiles/standard/tests/src/Functional/StandardTest.php b/core/profiles/standard/tests/src/Functional/StandardTest.php index 1bf5f725d1f9..fdc7d5a64f14 100644 --- a/core/profiles/standard/tests/src/Functional/StandardTest.php +++ b/core/profiles/standard/tests/src/Functional/StandardTest.php @@ -91,7 +91,7 @@ public function testStandard() { // Fetch the feed. $this->drupalGet('rss.xml'); $this->assertSession()->responseContains('Foobar'); - $this->assertNoText('Then she picked out two somebodies, Sally and me'); + $this->assertSession()->responseNotContains('Then she picked out two somebodies, Sally and me'); // Ensure block body exists. $this->drupalGet('block/add'); @@ -155,10 +155,10 @@ public function testStandard() { // Make sure the optional image styles are not installed. $this->drupalGet('admin/config/media/image-styles'); - $this->assertNoText('Max 325x325'); - $this->assertNoText('Max 650x650'); - $this->assertNoText('Max 1300x1300'); - $this->assertNoText('Max 2600x2600'); + $this->assertSession()->pageTextNotContains('Max 325x325'); + $this->assertSession()->pageTextNotContains('Max 650x650'); + $this->assertSession()->pageTextNotContains('Max 1300x1300'); + $this->assertSession()->pageTextNotContains('Max 2600x2600'); // Make sure the optional image styles are installed after enabling // the responsive_image module. diff --git a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php index 00fa980e9744..08d974062e57 100644 --- a/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -299,7 +299,7 @@ public function testTextAsserts() { $this->drupalGet('test-encoded'); $dangerous = 'Bad html <script>alert(123);</script>'; $sanitized = Html::escape($dangerous); - $this->assertNoText($dangerous); + $this->assertSession()->responseNotContains($dangerous); $this->assertSession()->responseContains($sanitized); } @@ -333,6 +333,7 @@ public function testAssertText() { * @group legacy */ public function testAssertNoText() { + $this->expectDeprecation('AssertLegacyTrait::assertNoText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738'); $this->expectDeprecation('Calling AssertLegacyTrait::assertNoText() with more than one argument is deprecated in drupal:8.2.0 and the method is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738'); $this->drupalGet('test-encoded'); $dangerous = 'Bad html <script>alert(123);</script>'; diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php index 41721e87b3a0..fe2ece56b179 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileExistingSettingsTest.php @@ -90,7 +90,7 @@ protected function setUpLanguage() { // Verify that the requested theme is used. $this->assertRaw($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. - $this->assertNoText('profile'); + $this->assertSession()->pageTextNotContains('profile'); parent::setUpLanguage(); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php index 5bd8d6d7969a..a5388abc08cb 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @@ -55,7 +55,7 @@ protected function setUpLanguage() { // Verify that the requested theme is used. $this->assertRaw($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. - $this->assertNoText('profile'); + $this->assertSession()->pageTextNotContains('profile'); parent::setUpLanguage(); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php index 2ca5c9ea5069..ebc9b62b619d 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationQueryTest.php @@ -101,7 +101,7 @@ protected function setUpSettings() { // Verify that the requested theme is used. $this->assertRaw($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. - $this->assertNoText('profile'); + $this->assertSession()->pageTextNotContains('profile'); parent::setUpSettings(); } @@ -119,7 +119,7 @@ public function testInstalled() { // Verify German was configured but not English. $this->drupalGet('admin/config/regional/language'); $this->assertSession()->pageTextContains('German'); - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); } /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php index 6a4712adab4d..e43d7b392176 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTranslationTest.php @@ -92,7 +92,7 @@ protected function setUpSettings() { // Verify that the requested theme is used. $this->assertRaw($this->info['distribution']['install']['theme']); // Verify that the "Choose profile" step does not appear. - $this->assertNoText('profile'); + $this->assertSession()->pageTextNotContains('profile'); parent::setUpSettings(); } @@ -110,7 +110,7 @@ public function testInstalled() { // Verify German was configured but not English. $this->drupalGet('admin/config/regional/language'); $this->assertSession()->pageTextContains('German'); - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); } /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php index acdb6b22de5d..ddc256a45766 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoConfigTest.php @@ -39,7 +39,7 @@ public function testConfigSync() { $this->assertSession()->pageTextContains('This import is empty and if applied would delete all of your configuration, so has been rejected.'); // Ensure there is no continuation button. - $this->assertNoText('Save and continue'); + $this->assertSession()->pageTextNotContains('Save and continue'); $this->assertSession()->buttonNotExists('edit-submit'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php index bc1483da612d..96499dc3364e 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigNoSystemSiteTest.php @@ -35,7 +35,7 @@ public function testConfigSync() { $this->assertSession()->pageTextContains('This import does not contain system.site configuration, so has been rejected.'); // Ensure there is no continuation button. - $this->assertNoText('Save and continue'); + $this->assertSession()->pageTextNotContains('Save and continue'); $this->assertSession()->buttonNotExists('edit-submit'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDriectoryProfileMismatchTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDriectoryProfileMismatchTest.php index 3af52960667a..bee5418af3cc 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDriectoryProfileMismatchTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDriectoryProfileMismatchTest.php @@ -54,7 +54,7 @@ public function testConfigSync() { $this->assertSession()->pageTextContains('The selected installation profile minimal does not match the profile stored in configuration testing_config_install_multilingual.'); // Ensure there is no continuation button. - $this->assertNoText('Save and continue'); + $this->assertSession()->pageTextNotContains('Save and continue'); $this->assertSession()->buttonNotExists('edit-submit'); } diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php index a8d783a0e5e7..4e6aaddf57b2 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageTest.php @@ -89,7 +89,7 @@ public function testTranslationsLoaded() { $this->assertSession()->pageTextContains('English'); } else { - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); } // Verify the strings from the translation files were imported. diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php index 6c20e5426adc..be24236edeeb 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php @@ -63,7 +63,7 @@ public function testInstaller() { // Verify German was configured but not English. $this->drupalGet('admin/config/regional/language'); $this->assertSession()->pageTextContains('German'); - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); } /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php index 40af4c935c43..a67ac13782c5 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php @@ -86,7 +86,7 @@ public function testInstaller() { // Verify German was configured but not English. $this->drupalGet('admin/config/regional/language'); $this->assertSession()->pageTextContains('German'); - $this->assertNoText('English'); + $this->assertSession()->pageTextNotContains('English'); // The current container still has the english as current language, rebuild. $this->rebuildContainer(); diff --git a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php index 1cf2aa589d8a..1c03b8404926 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/MultipleDistributionsProfileTest.php @@ -59,7 +59,7 @@ protected function setUpLanguage() { // Verify that the requested theme is used. $this->assertRaw('bartik'); // Verify that the "Choose profile" step does not appear. - $this->assertNoText('profile'); + $this->assertSession()->pageTextNotContains('profile'); parent::setUpLanguage(); } diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index aadbf5a701d0..bd7330d36505 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -120,7 +120,6 @@ public static function getSkippedDeprecations() { "The \"Drupal\Tests\Listeners\DrupalListener\" class uses \"PHPUnit\Framework\TestListenerDefaultImplementation\" that is deprecated The `TestListener` interface is deprecated.", "The \"PHPUnit\Framework\TestSuite\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\TestSuites\TestSuiteBase\".", // Simpletest's legacy assertion methods. - 'AssertLegacyTrait::assertNoText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738', 'AssertLegacyTrait::assertRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() instead. See https://www.drupal.org/node/3129738', 'AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738', // PHPUnit 9. diff --git a/core/tests/Drupal/Tests/RequirementsPageTrait.php b/core/tests/Drupal/Tests/RequirementsPageTrait.php index 0c2cc2a11455..0c0871c85d07 100644 --- a/core/tests/Drupal/Tests/RequirementsPageTrait.php +++ b/core/tests/Drupal/Tests/RequirementsPageTrait.php @@ -14,7 +14,7 @@ protected function updateRequirementsProblem() { // Assert a warning is shown on older test environments. $links = $this->getSession()->getPage()->findAll('named', ['link', 'try again']); if ($links && version_compare(phpversion(), \Drupal::MINIMUM_SUPPORTED_PHP) < 0) { - $this->assertNoText('Errors found'); + $this->assertSession()->pageTextNotContains('Errors found'); $this->assertWarningSummaries(['PHP']); $this->clickLink('try again'); $this->checkForMetaRefresh(); @@ -36,7 +36,7 @@ protected function updateRequirementsProblem() { * a warning not in the list is present, a fail is raised. */ protected function continueOnExpectedWarnings($expected_warnings = []) { - $this->assertNoText('Errors found'); + $this->assertSession()->pageTextNotContains('Errors found'); $this->assertWarningSummaries($expected_warnings); $this->clickLink('continue anyway'); $this->checkForMetaRefresh(); -- GitLab