diff --git a/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php b/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php index 6abfb5b6733164623b159f4a3c2f5cb0cefcbcc9..ad6f98c3cf7880c8c07b76ecf9ba8c4ee6ca5d57 100644 --- a/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php +++ b/core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php @@ -4,7 +4,6 @@ namespace Drupal\Tests\Core\DefaultContent; -use Drupal\Component\FileSystem\FileSystem; use Drupal\Core\DefaultContent\Finder; use Drupal\Core\DefaultContent\ImportException; use Drupal\Tests\UnitTestCase; @@ -38,14 +37,9 @@ public function testFoundDataIsInDependencyOrder(): void { * Tests that files without UUIDs will raise an exception. */ public function testExceptionIfNoUuid(): void { - $dir = FileSystem::getOsTemporaryDirectory(); - $this->assertIsString($dir); - /** @var string $dir */ - file_put_contents($dir . '/no-uuid.yml', '_meta: {}'); - $this->expectException(ImportException::class); - $this->expectExceptionMessage("$dir/no-uuid.yml does not have a UUID."); - new Finder($dir); + $this->expectExceptionMessageMatches("#/no-uuid\.yml does not have a UUID\.$#"); + new Finder(__DIR__ . '/../../../../fixtures/default_content_broken'); } } diff --git a/core/tests/fixtures/default_content_broken/no-uuid.yml b/core/tests/fixtures/default_content_broken/no-uuid.yml new file mode 100644 index 0000000000000000000000000000000000000000..f95a15c6463aca5b7150ec31774931695f8e4d15 --- /dev/null +++ b/core/tests/fixtures/default_content_broken/no-uuid.yml @@ -0,0 +1,23 @@ +_meta: + version: '1.0' + entity_type: block_content + bundle: basic + default_langcode: en +default: + status: + - + value: true + info: + - + value: 'Useful Info' + reusable: + - + value: true + revision_translation_affected: + - + value: true + body: + - + value: "I'd love to put some useful info here." + format: plain_text + summary: ''