You are here

protected function MediaKernelTestBase::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Kernel/MediaKernelTestBase.php \Drupal\Tests\media\Kernel\MediaKernelTestBase::setUp()
  2. 10 core/modules/media/tests/src/Kernel/MediaKernelTestBase.php \Drupal\Tests\media\Kernel\MediaKernelTestBase::setUp()

Overrides KernelTestBase::setUp

1 call to MediaKernelTestBase::setUp()
MediaTranslationTest::setUp in core/modules/media/tests/src/Kernel/MediaTranslationTest.php
1 method overrides MediaKernelTestBase::setUp()
MediaTranslationTest::setUp in core/modules/media/tests/src/Kernel/MediaTranslationTest.php

File

core/modules/media/tests/src/Kernel/MediaKernelTestBase.php, line 59

Class

MediaKernelTestBase
Base class for Media kernel tests.

Namespace

Drupal\Tests\media\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('file');
  $this
    ->installSchema('file', 'file_usage');
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('media');
  $this
    ->installConfig([
    'field',
    'system',
    'image',
    'file',
    'media',
  ]);

  // Create a test media type.
  $this->testMediaType = $this
    ->createMediaType('test');

  // Create a test media type with constraints.
  $this->testConstraintsMediaType = $this
    ->createMediaType('test_constraints');
  $this->user = User::create([
    'name' => 'username',
    'status' => 1,
  ]);
  $this->user
    ->save();
  $this->container
    ->get('current_user')
    ->setAccount($this->user);
}