class UuidValidatorTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Validation/UuidValidatorTest.php \Drupal\KernelTests\Core\Validation\UuidValidatorTest
Tests the UUID validator.
@group Validation
Hierarchy
- class \Drupal\KernelTests\Core\Validation\UuidValidatorTest
Expanded class hierarchy of UuidValidatorTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Validation/ UuidValidatorTest.php, line 14
Namespace
Drupal\KernelTests\Core\ValidationView source
class UuidValidatorTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'config_test',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installConfig('config_test');
}
/**
* @see \Drupal\Core\Validation\Plugin\Validation\Constraint\UuidConstraint
*/
public function testUuid() : void {
$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());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ExtensionListTestTrait::getModulePath | protected | function | Gets the path for the specified module. |
ExtensionListTestTrait::getThemePath | protected | function | Gets the path for the specified theme. |
StorageCopyTrait::replaceStorageContents | protected static | function | Copy the configuration from one storage to another and remove stale items. |
UuidValidatorTest::$modules | protected static | property | Modules to install. |
UuidValidatorTest::setUp | protected | function | |
UuidValidatorTest::testUuid | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.