public function KeyValueItemTest::testMaximumKeyLength in Key value field 8
Test storing data to field with maximum key length constraint.
@expectedException \Drupal\Core\Entity\EntityStorageException
File
- tests/
src/ Kernel/ KeyValueItemTest.php, line 94
Class
- KeyValueItemTest
- @coversDefaultClass \Drupal\key_value_field\Plugin\Field\FieldType\KeyValueItem @group key_value_field
Namespace
Drupal\Tests\key_value_field\KernelCode
public function testMaximumKeyLength() {
$this
->createTestField('key_value', [
'settings' => [
'key_max_length' => 10,
],
]);
// @todo I would have expected some validation.
$entity = EntityTest::create([
'test_key_value_field' => [
'value' => 'orange',
'key' => 'this-is-really-a-long-key',
],
]);
$entity
->save();
}