From fd3615149461733986217ec355996788aa351a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Tue, 30 Jul 2024 21:46:04 -0400 Subject: [PATCH] Rename patch, add tests --- composer.json | 2 +- ...ner-aware.diff => 3416357-10.3.x-only.patch} | 0 tests/src/ExistingSite/MetaTagsTest.php | 17 ++++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) rename patches/core/{queue-factory-container-aware.diff => 3416357-10.3.x-only.patch} (100%) diff --git a/composer.json b/composer.json index e61df20b..ff4bf05a 100644 --- a/composer.json +++ b/composer.json @@ -204,7 +204,7 @@ "#3464550: Create config action which can create an entity for every bundle of another entity type": "./patches/core/8975.patch", "#3303127: Determine which core config entity methods should be config actions": "./patches/core/7940.patch", "Allow arbitrary callables to provide input to recipes": "./patches/core/recipe-callable-input.patch", - "#3416357: Convert QueueFactory to use a service locator": "./patches/core/queue-factory-container-aware.diff" + "#3416357: Convert QueueFactory to use a service locator": "./patches/core/3416357-10.3.x-only.patch" }, "drupal/automatic_updates": { "#3463662: When it is installed, Package Manager should try to detect the paths of Composer and rsync": "./patches/automatic_updates/automatic_updates-1085.patch" diff --git a/patches/core/queue-factory-container-aware.diff b/patches/core/3416357-10.3.x-only.patch similarity index 100% rename from patches/core/queue-factory-container-aware.diff rename to patches/core/3416357-10.3.x-only.patch diff --git a/tests/src/ExistingSite/MetaTagsTest.php b/tests/src/ExistingSite/MetaTagsTest.php index 70c639d6..be5bfa9c 100644 --- a/tests/src/ExistingSite/MetaTagsTest.php +++ b/tests/src/ExistingSite/MetaTagsTest.php @@ -4,7 +4,7 @@ namespace Drupal\Tests\starshot\ExistingSite; -use Drupal\Core\Config\ConfigFactoryInterface; +use Behat\Mink\Element\NodeElement; use Drupal\Core\File\FileUrlGeneratorInterface; use Drupal\file\Entity\File; use Drupal\media\Entity\Media; @@ -20,17 +20,24 @@ class MetaTagsTest extends ExistingSiteBase { */ public function testFrontPageMetaTags(): void { - $expected_title = 'I say potato, you say potato'; + // Create a random title expectation. + $expected_title = $this->getRandomGenerator()->name(); // Set the site name. - $this->container->get(ConfigFactoryInterface::class) - ->getEditable('system.site') + $config_factory = $this->container->get('config.factory'); + $config_factory->getEditable('system.site') ->set('name', $expected_title) ->save(); // Get the front page title. $this->drupalGet(''); - $this->assertSession()->titleEquals($expected_title); + $title_tag = $this->getSession() + ->getPage() + ->find('xpath', '/head/title'); + assert($title_tag instanceof NodeElement, 'Ensure that the "" tag is found.'); + $actual_title = $title_tag->getText(); + + $this->assertEquals($expected_title, $actual_title, 'Page title matches expected.'); } /**