function FinderTest::testExceptionIfNoUuid
Same name in other branches
- 11.x core/tests/Drupal/Tests/Core/DefaultContent/FinderTest.php \Drupal\Tests\Core\DefaultContent\FinderTest::testExceptionIfNoUuid()
Tests that files without UUIDs will raise an exception.
File
-
core/
tests/ Drupal/ Tests/ Core/ DefaultContent/ FinderTest.php, line 40
Class
- FinderTest
- @covers \Drupal\Core\DefaultContent\Finder @group DefaultContent
Namespace
Drupal\Tests\Core\DefaultContentCode
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.