You are here

protected function LinkFieldCollectorTest::setUp in Dependency Calculation 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/EventSubscriber/DependencyCollector/LinkFieldCollectorTest.php, line 61

Class

LinkFieldCollectorTest
Class LinkFieldCollectorTest to check Link field dependencies.

Namespace

Drupal\Tests\depcalc\Kernel\EventSubscriber\DependencyCollector

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('node', 'node_access');
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('path_alias');
  $this
    ->installConfig('filter');
  $this
    ->installConfig('node');
  $this
    ->installConfig([
    'field',
    'system',
  ]);
  $this
    ->installSchema('book', 'book');
  $this
    ->installConfig('book');
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'link',
    'entity_type' => 'node',
    'type' => 'link',
    'cardinality' => -1,
  ]);
  $field_storage
    ->save();
  $field = FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'page',
    'label' => 'link',
    'settings' => [
      'link_type' => LinkItemInterface::LINK_GENERIC,
    ],
  ]);
  $field
    ->save();
  $this->calculator = Drupal::service('entity.dependency.calculator');
}