function MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest::testMediaLibraryViewsConfig

Tests that the media library view config is updated.

See also

media_library_update_8703()

File

core/modules/media_library/tests/src/Functional/Update/MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest.php, line 31

Class

MediaLibraryUpdateViewPageDisplayEditDeleteLinkTest
Tests the media library module updates for the view page display links.

Namespace

Drupal\Tests\media_library\Functional\Update

Code

public function testMediaLibraryViewsConfig() {
    $config = $this->config('views.view.media_library');
    $this->assertNull($config->get('display.page.display_options.defaults.fields'));
    $this->assertNull($config->get('display.page.display_options.fields.name'));
    $this->assertNull($config->get('display.page.display_options.fields.edit_media'));
    $this->assertNull($config->get('display.page.display_options.fields.delete_media'));
    $this->runUpdates();
    $config = $this->config('views.view.media_library');
    $this->assertFalse($config->get('display.page.display_options.defaults.fields'));
    $this->assertSame('field', $config->get('display.page.display_options.fields.name.plugin_id'));
    $this->assertSame('name', $config->get('display.page.display_options.fields.name.entity_field'));
    $this->assertSame('entity_link_edit', $config->get('display.page.display_options.fields.edit_media.plugin_id'));
    $this->assertSame('entity_link_delete', $config->get('display.page.display_options.fields.delete_media.plugin_id'));
    // Check if the rendered entity is last in the field.
    $fields = $config->get('display.page.display_options.fields');
    end($fields);
    $this->assertSame('rendered_entity', key($fields));
}

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