You are here

public function MediaLibraryUpdateFormAndViewDisplaysTest::testPostUpdateDisplayModes in Drupal 8

Tests the media library module updates for form and view displays.

See also

media_library_update_8701()

media_library_post_update_display_modes()

File

core/modules/media_library/tests/src/Functional/Update/MediaLibraryUpdateFormAndViewDisplaysTest.php, line 35

Class

MediaLibraryUpdateFormAndViewDisplaysTest
Tests the media library module updates for form and view displays.

Namespace

Drupal\Tests\media_library\Functional\Update

Code

public function testPostUpdateDisplayModes() {
  $this
    ->assertNull(ImageStyle::load('media_library'));
  $this
    ->assertNull(EntityFormDisplay::load('media.file.media_library'));
  $this
    ->assertNull(EntityViewDisplay::load('media.file.media_library'));
  $this
    ->assertNull(EntityFormDisplay::load('media.image.media_library'));
  $this
    ->assertNull(EntityViewDisplay::load('media.image.media_library'));
  $this
    ->runUpdates();
  $this
    ->assertInstanceOf(ImageStyle::class, ImageStyle::load('media_library'));
  $this
    ->assertInstanceOf(EntityFormDisplay::class, EntityFormDisplay::load('media.file.media_library'));
  $this
    ->assertInstanceOf(EntityViewDisplay::class, EntityViewDisplay::load('media.file.media_library'));
  $this
    ->assertInstanceOf(EntityFormDisplay::class, EntityFormDisplay::load('media.image.media_library'));
  $this
    ->assertInstanceOf(EntityViewDisplay::class, EntityViewDisplay::load('media.image.media_library'));
  $this
    ->assertSession()
    ->pageTextContains('Media Library form and view displays have been created for the following media types: File, Image.');
}