function UuidItemTest::testInvalidUuid
Same name and namespace in other branches
- 11.x core/modules/field/tests/src/Kernel/KernelString/UuidItemTest.php \Drupal\Tests\field\Kernel\KernelString\UuidItemTest::testInvalidUuid()
Tests that UUID item values must be valid UUIDs.
File
-
core/
modules/ field/ tests/ src/ Kernel/ KernelString/ UuidItemTest.php, line 37
Class
- UuidItemTest
- Tests the UUID field.
Namespace
Drupal\Tests\field\Kernel\KernelStringCode
public function testInvalidUuid() : void {
$entity = EntityTest::create([
'uuid' => 'not a valid uuid',
]);
$violation = $entity->validate()
->get(0);
$this->assertSame('This is not a valid UUID.', (string) $violation->getMessage());
$this->assertSame('uuid.0.value', $violation->getPropertyPath());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.