public function ContentEntitySourceFileTest::setUp

Overrides ContentEntityTestBase::setUp

File

sources/content/tests/src/Kernel/ContentEntitySourceFileTest.php, line 31

Class

ContentEntitySourceFileTest
Content entity Source file tests.

Namespace

Drupal\Tests\tmgmt_content\Kernel

Code

public function setUp() : void {
  parent::setUp();

  // Auto-create fields for testing.
  FieldStorageConfig::create([
    'entity_type' => $this->entityTypeId,
    'field_name' => 'field_file',
    'type' => 'file',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => $this->entityTypeId,
    'field_name' => 'field_file',
    'bundle' => $this->entityTypeId,
    'label' => 'Test file-field',
    'translatable' => TRUE,
  ])
    ->save();

  // Auto-create fields for testing.
  FieldStorageConfig::create([
    'entity_type' => $this->entityTypeId,
    'field_name' => 'field_file_untranslatable',
    'type' => 'file',
    'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => $this->entityTypeId,
    'field_name' => 'field_file_untranslatable',
    'bundle' => $this->entityTypeId,
    'label' => 'Test file-field',
    'translatable' => FALSE,
  ])
    ->save();

  // Add an image field and make it translatable.
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', array(
    'file_usage',
  ));
}