You are here

public function MediaUpdateTest::testEnableStandaloneUrl in Drupal 8

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