function MediaLibraryAccessTest::setUp

Same name in other branches
  1. 8.9.x core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAccessTest::setUp()
  2. 10 core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php \Drupal\Tests\media_library\Kernel\MediaLibraryAccessTest::setUp()
  3. 11.x 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\Kernel

Code

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([]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.