You are here

protected function MediaResourceTestBase::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php \Drupal\Tests\media\Functional\Rest\MediaResourceTestBase::setUp()
  2. 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 44

Class

MediaResourceTestBase

Namespace

Drupal\Tests\media\Functional\Rest

Code

protected function setUp() : void {
  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();
}