You are here

public function MediaLibrarySetAdministrativePageToTableDisplayTest::testUpdateWithCustomizedMediaLibraryViewPath in Drupal 8

Tests that the update does not alter custom 'media' path and menu settings.

File

core/modules/media_library/tests/src/Functional/Update/MediaLibrarySetAdministrativePageToTableDisplayTest.php, line 112

Class

MediaLibrarySetAdministrativePageToTableDisplayTest
Tests update to set 'media' view's table display as the administrative page.

Namespace

Drupal\Tests\media_library\Functional\Update

Code

public function testUpdateWithCustomizedMediaLibraryViewPath() {

  /** @var \Drupal\views\ViewEntityInterface $view */
  $view = View::load('media_library');
  $display =& $view
    ->getDisplay('page');
  $display['display_options']['path'] = 'admin/content/media-pretty';
  $view
    ->save();
  $this
    ->runUpdates();

  // The update should not have modified the path or menu settings.
  $view = View::load('media_library');
  $display = $view
    ->getDisplay('page');
  $this
    ->assertSame('admin/content/media-pretty', $display['display_options']['path']);
  $this
    ->assertSame('tab', $display['display_options']['menu']['type']);
  $this
    ->assertSame('Media', $display['display_options']['menu']['title']);
}