function MediaUpdateTest::testEnableStandaloneUrl

Tests that the standalone URL is still accessible.

See also

media_post_update_enable_standalone_url()

File

core/modules/media/tests/src/Functional/Update/MediaUpdateTest.php, line 92

Class

MediaUpdateTest
Tests that media settings are properly updated during database updates.

Namespace

Drupal\Tests\media\Functional\Update

Code

public function testEnableStandaloneUrl() {
    $this->container
        ->get('module_installer')
        ->install([
        'media_test_source',
    ]);
    // Create a media type.
    $media_type = $this->createMediaType('test');
    // Run updates.
    $this->runUpdates();
    // Create a media item.
    $media = Media::create([
        'bundle' => $media_type->id(),
        'name' => 'Unnamed',
    ]);
    $media->save();
    $user = $this->drupalCreateUser([
        'administer media',
    ]);
    $this->drupalLogin($user);
    $this->drupalGet('media/' . $media->id());
    $this->assertSession()
        ->statusCodeEquals(200);
}

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