function MediaResourceTestBase::setUp

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

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

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