You are here

public function MediaResourceTestBase::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php \Drupal\Tests\media\Functional\Rest\MediaResourceTestBase::setUp()

Overrides EntityResourceTestBase::setUp

File

core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php, line 47

Class

MediaResourceTestBase

Namespace

Drupal\Tests\media\Functional\Rest

Code

public function setUp() {
  parent::setUp();
  \Drupal::configFactory()
    ->getEditable('media.settings')
    ->set('standalone_url', TRUE)
    ->save(TRUE);

  // Provisioning the Media REST resource without the File REST resource does
  // not make sense.
  $this->resourceConfigStorage
    ->create([
    'id' => 'entity.file',
    'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
    'configuration' => [
      'methods' => [
        'GET',
      ],
      'formats' => [
        static::$format,
      ],
      'authentication' => isset(static::$auth) ? [
        static::$auth,
      ] : [],
    ],
    'status' => TRUE,
  ])
    ->save();
  $this->container
    ->get('router.builder')
    ->rebuild();
}