protected function PlaceholderResolverTest::setUp in Typed Data API enhancements 8
Overrides KernelTestBase::setUp
File
- tests/src/ Kernel/ PlaceholderResolverTest.php, line 77 
Class
- PlaceholderResolverTest
- Tests the placeholder resolver.
Namespace
Drupal\Tests\typed_data\KernelCode
protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  // Make sure default date formats are there for testing the format_date
  // filter.
  $this
    ->installConfig([
    'system',
  ]);
  $this->typedDataManager = $this->container
    ->get('typed_data_manager');
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->placeholderResolver = $this->container
    ->get('typed_data.placeholder_resolver');
  $this->simpleTestContext = $this->container
    ->get('typed_data_global_context_test.simple_test_context');
  $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',
  ]);
}