function MediaLibrarySetAdministrativePageToTableDisplayTest::testUpdateWithCustomizedMediaLibraryMenuSettings
Tests that the update preserves custom 'media_library' menu settings.
File
-
core/
modules/ media_library/ tests/ src/ Functional/ Update/ MediaLibrarySetAdministrativePageToTableDisplayTest.php, line 132
Class
- MediaLibrarySetAdministrativePageToTableDisplayTest
- Tests update to set 'media' view's table display as the administrative page.
Namespace
Drupal\Tests\media_library\Functional\UpdateCode
public function testUpdateWithCustomizedMediaLibraryMenuSettings() {
/** @var \Drupal\views\ViewEntityInterface $view */
$view = View::load('media_library');
$display =& $view->getDisplay('page');
$display['display_options']['menu'] = [
'type' => 'normal',
'title' => 'A treasure trove of interesting pictures',
'parent' => 'system.admin_structure',
];
$view->save();
$this->runUpdates();
// The update should have changed the path but preserved the menu settings.
$view = View::load('media_library');
$display = $view->getDisplay('page');
$this->assertSame('admin/content/media-grid', $display['display_options']['path']);
$this->assertSame('normal', $display['display_options']['menu']['type']);
$this->assertSame('A treasure trove of interesting pictures', $display['display_options']['menu']['title']);
$this->assertSame('system.admin_structure', $display['display_options']['menu']['parent']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.