function MediaLibrarySetAdministrativePageToTableDisplayTest::testUpdateWithCustomizedMediaViewPath

Tests that the update does not alter a custom 'media' view path.

File

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

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 testUpdateWithCustomizedMediaViewPath() {
    
    /** @var \Drupal\views\ViewEntityInterface $view */
    $view = View::load('media');
    $display =& $view->getDisplay('media_page_list');
    $display['display_options']['path'] = 'admin/content/all-media';
    $view->save();
    $this->runUpdates();
    // The update should not have modified the path.
    $view = View::load('media');
    $display = $view->getDisplay('media_page_list');
    $this->assertSame('admin/content/all-media', $display['display_options']['path']);
    $view = View::load('media_library');
    $display = $view->getDisplay('page');
    $this->assertSame('admin/content/media-grid', $display['display_options']['path']);
    $this->assertArrayNotHasKey('menu', $display['display_options']);
}

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