diff --git a/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php b/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php index d8cef338eb80aefce7f5e55ec3f3709b4ad69624..2c604a70586c2bb4e1f144850c96ce3f3215025c 100644 --- a/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php +++ b/tests/src/Functional/UpdaterFormNoRecommendedReleaseMessageTest.php @@ -85,12 +85,17 @@ class UpdaterFormNoRecommendedReleaseMessageTest extends AutomaticUpdatesFunctio $this->drupalGet('/admin/reports/updates/automatic-update'); $assert_session = $this->assertSession(); + // BEGIN: DELETE FROM CORE MERGE REQUEST + // @todo Use \Drupal\Tests\WebAssert::statusMessageContains() when module + // drops support for Drupal core 9.3.x. + // END: DELETE FROM CORE MERGE REQUEST + $message_selector = $expected_message_type === 'status' ? "//div[@role='contentinfo' and h2[text()='Status message']]" : "//div[@role='alert' and h2[text()='Error message']]"; if ($updates_available) { - $assert_session->statusMessageContains('Updates were found, but they must be performed manually.', $expected_message_type); + $assert_session->elementTextContains('xpath', $message_selector, 'Updates were found, but they must be performed manually.'); $assert_session->linkExists('the list of available updates'); } else { - $assert_session->statusMessageContains('No update available', $expected_message_type); + $assert_session->elementTextContains('xpath', $message_selector, 'No update available'); } $assert_session->buttonNotExists('Update'); } diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index fd4a157606710828a883e092c26a1de277e1fdc4..f73f37443f7df5f94ce98a94a609ca0da3585ac1 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -50,7 +50,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { parent::setUp(); $this->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/drupal.9.8.1-security.xml'); - $user = $this->createUser([ + $permissions = [ 'administer site configuration', 'administer software updates', 'access administration pages', @@ -58,7 +58,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { 'administer modules', 'access site reports', 'view update notifications', - ]); + ]; + // BEGIN: DELETE FROM CORE MERGE REQUEST + // Check for permission that was added in Drupal core 9.4.x. + $available_permissions = array_keys($this->container->get('user.permissions')->getPermissions()); + if (!in_array('view update notifications', $available_permissions)) { + array_pop($permissions); + } + // END: DELETE FROM CORE MERGE REQUEST + $user = $this->createUser($permissions); $this->drupalLogin($user); $this->checkForUpdates(); }