You are here

protected function DataFetcherTest::setUp in Typed Data API enhancements 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/DataFetcherTest.php, line 68

Class

DataFetcherTest
Class DataFetcherTest.

Namespace

Drupal\Tests\typed_data\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  $this->typedDataManager = $this->container
    ->get('typed_data_manager');
  $this->dataFetcher = $this->container
    ->get('typed_data.data_fetcher');
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->entityTypeManager
    ->getStorage('node_type')
    ->create([
    'type' => 'page',
  ])
    ->save();

  // Create a multi-value integer field for testing.
  FieldStorageConfig::create([
    'field_name' => 'field_integer',
    'type' => 'integer',
    'entity_type' => 'node',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'field_integer',
    'entity_type' => 'node',
    'bundle' => 'page',
  ])
    ->save();
  $this->node = $this->entityTypeManager
    ->getStorage('node')
    ->create([
    'title' => 'test',
    'type' => 'page',
  ]);
}