public function KeyValueLongItemTest::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/ KeyValueLongItemTest.php, line 116
Class
- KeyValueLongItemTest
- @coversDefaultClass \Drupal\key_value_field\Plugin\Field\FieldType\KeyValueLongItem @group key_value_field
Namespace
Drupal\Tests\key_value_field\KernelCode
public function testMaximumKeyLength() {
$this
->createTestField('key_value_long', [
'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();
}