You are here

public function KeyValueItemTest::testFieldCreate in Key value field 8

Test key_value field creation.

File

tests/src/Kernel/KeyValueItemTest.php, line 16

Class

KeyValueItemTest
@coversDefaultClass \Drupal\key_value_field\Plugin\Field\FieldType\KeyValueItem @group key_value_field

Namespace

Drupal\Tests\key_value_field\Kernel

Code

public function testFieldCreate() {
  $this
    ->createTestField('key_value');
  $entity = EntityTest::create([
    'test_key_value_field' => [
      'value' => '',
    ],
  ]);
  $entity
    ->save();
  $this
    ->assertTrue($entity->test_key_value_field
    ->isEmpty());
  $this
    ->assertEquals(NULL, $entity->test_key_value_field->value);
}