function MediaLibrarySetAdministrativePageToTableDisplayTest::testUpdateWithCustomizedMediaLibraryViewPath

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

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