public function MediaOverviewTest::testMediaOverviewPath in Lightning Media 8.3
Tests modifications to the 'media' view, depending on core version.
File
- tests/
src/ Functional/ MediaOverviewTest.php, line 31
Class
- MediaOverviewTest
- Tests Lightning Media's modifications to the 'media' view.
Namespace
Drupal\Tests\lightning_media\FunctionalCode
public function testMediaOverviewPath() {
// The logic in lightning_media_view_insert() is normally only done during
// site installation, so we need to simulate that.
$GLOBALS['install_state'] = [];
$view = View::load('media');
$this
->assertInstanceOf(View::class, $view);
lightning_media_view_insert($view);
$display = View::load('media')
->getDisplay('media_page_list');
// The path of the media overview page should only be modified on Drupal 8.7
// and earlier.
if (version_compare(\Drupal::VERSION, '8.8.0', '>=')) {
$this
->assertSame('admin/content/media', $display['display_options']['path']);
}
else {
$this
->assertSame('admin/content/media-table', $display['display_options']['path']);
}
}