X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FKernelTests%2FCore%2FValidation%2FConstraintsTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FKernelTests%2FCore%2FValidation%2FConstraintsTest.php;h=8e17422ff68ade33f0e7f88c8581017619356778;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php b/web/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php new file mode 100644 index 000000000..8e17422ff --- /dev/null +++ b/web/core/tests/Drupal/KernelTests/Core/Validation/ConstraintsTest.php @@ -0,0 +1,45 @@ +installConfig('config_test'); + } + + /** + * @see \Drupal\Core\Validation\Plugin\Validation\Constraint\UuidConstraint + */ + public function testUuid() { + $typed_config_manager = \Drupal::service('config.typed'); + /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_config */ + $typed_config = $typed_config_manager->get('config_test.validation'); + $typed_config->get('uuid') + ->setValue(\Drupal::service('uuid')->generate()); + + $this->assertCount(0, $typed_config->validate()); + + $typed_config->get('uuid') + ->setValue(\Drupal::service('uuid')->generate() . '-invalid'); + $this->assertCount(1, $typed_config->validate()); + } + +}