diff --git a/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php index c6cc2cb2ab6462607ad0aa8dbab071b55427b5cc..ea008a8dfab7ad6d185a2dbb5c9880259e364481 100644 --- a/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_blog/tests/src/Functional/ComponentValidationTest.php @@ -36,6 +36,8 @@ class ComponentValidationTest extends BrowserTestBase { $this->applyRecipe($dir); // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + + $this->ensureFileExists('4bb02092-717b-44c8-9147-be3821c244c6'); } public function testContentModel(): void { diff --git a/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php index 17a6d24a856338ddc921630817ff3f62224c1332..ccb627f7bfbab7e4de43aba59727484315fbc127 100644 --- a/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_case_study/tests/src/Functional/ComponentValidationTest.php @@ -36,6 +36,9 @@ class ComponentValidationTest extends BrowserTestBase { $this->applyRecipe($dir); // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + + $this->ensureFileExists('47b880a9-c2a4-4ed6-844d-95c6d6677004'); + $this->ensureFileExists('831ca26d-590c-4f34-8545-379e9d77106f'); } public function testContentModel(): void { diff --git a/recipes/drupal_cms_content_type_base/tests/src/ContentModelTestTrait.php b/recipes/drupal_cms_content_type_base/tests/src/ContentModelTestTrait.php index 23f937d3f19bad0a459449768e3e1ffb440533f3..80cd2241591536c26ce367180a224d3e6d955ca6 100644 --- a/recipes/drupal_cms_content_type_base/tests/src/ContentModelTestTrait.php +++ b/recipes/drupal_cms_content_type_base/tests/src/ContentModelTestTrait.php @@ -6,12 +6,27 @@ namespace Drupal\Tests\drupal_cms_content_type_base; use Drupal\Core\Entity\Display\EntityDisplayInterface; use Drupal\Core\Entity\EntityFieldManagerInterface; +use Drupal\Core\Entity\EntityRepositoryInterface; +use Drupal\file\FileInterface; use Drupal\layout_builder\Entity\LayoutEntityDisplayInterface; use Drupal\Tests\BrowserTestBase; use PHPUnit\Framework\Assert; trait ContentModelTestTrait { + /** + * Ensures that the file associated with a file entity, actually exists. + * + * @param string $uuid + * The UUID of a file entity. + */ + protected function ensureFileExists(string $uuid): void { + $file = $this->container->get(EntityRepositoryInterface::class) + ->loadEntityByUuid('file', $uuid); + Assert::assertInstanceOf(FileInterface::class, $file, "There is no file with UUID '$uuid'."); + Assert::assertFileExists($file->getFileUri()); + } + /** * Returns the weights of all components in a display. * diff --git a/recipes/drupal_cms_events/content/file/DrupalCon-Atlanta .webp b/recipes/drupal_cms_events/content/file/DrupalCon-Atlanta.webp similarity index 100% rename from recipes/drupal_cms_events/content/file/DrupalCon-Atlanta .webp rename to recipes/drupal_cms_events/content/file/DrupalCon-Atlanta.webp diff --git a/recipes/drupal_cms_events/content/media/drupalcon-atlanta-image.yml b/recipes/drupal_cms_events/content/media/drupalcon-atlanta-image.yml index 1fafdacdba2546c52e4a46b3f3db6b4460d802e1..4aee2ea27cedfdc30452f9b5cd4df3f5715f6046 100644 --- a/recipes/drupal_cms_events/content/media/drupalcon-atlanta-image.yml +++ b/recipes/drupal_cms_events/content/media/drupalcon-atlanta-image.yml @@ -15,7 +15,7 @@ default: target_id: 1 name: - - value: 'DrupalCon Atlanta.png' + value: 'DrupalCon-Atlanta.webp' created: - value: 1734408755 diff --git a/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php index eb27c2647a3fd327d152bb4e522b5612e861eded..4c62d23154eec0efef08bf15572322e7d3040e6d 100644 --- a/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_events/tests/src/Functional/ComponentValidationTest.php @@ -37,6 +37,8 @@ class ComponentValidationTest extends BrowserTestBase { // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + $this->ensureFileExists('601c1f74-4633-4069-ae90-57c645568b1c'); + // The privacy settings should be available to anonymous users. $this->drupalPlaceBlock('system_menu_block:footer', ['label' => 'Footer']); $this->drupalGet('<front>'); diff --git a/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php index 4a6f8f1836d33351416344acd3e0e3d44a4c6b75..329606c3f2f662ead59cd45bd4af0025e41a4755 100644 --- a/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_news/tests/src/Functional/ComponentValidationTest.php @@ -41,6 +41,8 @@ class ComponentValidationTest extends BrowserTestBase { $this->applyRecipe($dir); // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + + $this->ensureFileExists('f57ca5cc-9336-44d5-b847-b24876ffd1f6'); } public function testContentModel(): void { diff --git a/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php index adf56b527467bd50a66be845590f3083ec441f36..e8d79bb6245ca7a13a97418b6e99aa4e9fb6fdc8 100644 --- a/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_person/tests/src/Functional/ComponentValidationTest.php @@ -36,6 +36,8 @@ class ComponentValidationTest extends BrowserTestBase { $this->applyRecipe($dir); // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + + $this->ensureFileExists('5a635060-8540-4be7-bad9-8a51414731ad'); } public function testContentModel(): void { diff --git a/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php index 230c1b6b9dbbc317f14978bfc0831b10f40769a2..f56e8e1dcb52f4e02d447933c6dae3ef7573ff7d 100644 --- a/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_project/tests/src/Functional/ComponentValidationTest.php @@ -36,6 +36,9 @@ class ComponentValidationTest extends BrowserTestBase { $this->applyRecipe($dir); // Apply it again to prove that it is idempotent. $this->applyRecipe($dir); + + $this->ensureFileExists('47b880a9-c2a4-4ed6-844d-95c6d6677004'); + $this->ensureFileExists('671c51f9-7a67-40ce-82de-750f53892f26'); } public function testContentModel(): void { diff --git a/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php index 78980891eb56824cb2f6b0ad3306f7c47663eeef..b3b38e6ace243c84268b615fe3d284797603609e 100644 --- a/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php @@ -9,6 +9,7 @@ use Composer\InstalledVersions; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\State\StateInterface; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\drupal_cms_content_type_base\ContentModelTestTrait; use Symfony\Component\Process\PhpExecutableFinder; use Symfony\Component\Process\Process; @@ -17,6 +18,8 @@ use Symfony\Component\Process\Process; */ class ComponentValidationTest extends BrowserTestBase { + use ContentModelTestTrait; + /** * {@inheritdoc} */ @@ -65,6 +68,8 @@ class ComponentValidationTest extends BrowserTestBase { $dir = InstalledVersions::getInstallPath('drupal/drupal_cms_starter'); $this->applyRecipe($dir); + $this->ensureFileExists('05439bd3-1c60-4e1a-8719-e9da071e88e4'); + // The front page should be accessible to everyone. $this->drupalGet('<front>'); $assert_session = $this->assertSession();