protected function MediaLibraryAccessTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 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 48  
Class
- MediaLibraryAccessTest
 - Tests the media library access.
 
Namespace
Drupal\Tests\media_library\KernelCode
protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', 'file_usage');
  $this
    ->installSchema('system', [
    'sequences',
  ]);
  $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([]);
}