You are here

protected function MediaLibraryAccessTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAccessTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php, line 46

Class

MediaLibraryAccessTest
Tests the media library access.

Namespace

Drupal\Tests\media_library\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', 'file_usage');
  $this
    ->installSchema('system', [
    'sequences',
    'key_value_expire',
  ]);
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('filter_format');
  $this
    ->installEntitySchema('media');
  $this
    ->installConfig([
    'field',
    'system',
    'file',
    'image',
    'media',
    'media_library',
  ]);
  EntityTestBundle::create([
    'id' => 'test',
  ])
    ->save();
  $field_storage = FieldStorageConfig::create([
    'type' => 'entity_reference',
    'field_name' => 'field_test_media',
    'entity_type' => 'entity_test',
    'settings' => [
      'target_type' => 'media',
    ],
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'field_storage' => $field_storage,
    'bundle' => 'test',
  ])
    ->save();

  // Create an account with special UID 1.
  $this
    ->createUser([]);
}