You are here

protected function MenuLinkFieldKernelTest::createFields in Menu Link (Field) 8

Test fields creation.

File

tests/src/Kernel/MenuLinkFieldKernelTest.php, line 28

Class

MenuLinkFieldKernelTest
Tests the menu link field.

Namespace

Drupal\Tests\menu_link\Kernel

Code

protected function createFields() : void {
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test_mul');
  FieldStorageConfig::create([
    'field_name' => 'field_menu_link',
    'entity_type' => 'entity_test_mul',
    'type' => 'menu_link',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_menu_link',
    'entity_type' => 'entity_test_mul',
    'bundle' => 'entity_test_mul',
  ])
    ->save();
  FieldStorageConfig::create([
    'field_name' => 'field_menu_link2',
    'entity_type' => 'entity_test_mul',
    'type' => 'menu_link',
    'settings' => [
      'menu_link_per_translation' => TRUE,
    ],
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_menu_link2',
    'entity_type' => 'entity_test_mul',
    'bundle' => 'entity_test_mul',
  ])
    ->save();
}