function MediaLibraryUpdateWidgetViewTest::testMediaLibraryViewsConfig

Tests that the media library view config is updated.

See also

media_library_update_8702()

File

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

Class

MediaLibraryUpdateWidgetViewTest
Tests the media library module updates for the widget view.

Namespace

Drupal\Tests\media_library\Functional\Update

Code

public function testMediaLibraryViewsConfig() {
    $config = $this->config('views.view.media_library');
    $this->assertNull($config->get('display.widget.display_options.defaults.filters'));
    $this->assertNull($config->get('display.widget.display_options.defaults.arguments'));
    $this->assertArrayNotHasKey('filters', $config->get('display.widget.display_options'));
    $this->assertArrayNotHasKey('arguments', $config->get('display.widget.display_options'));
    $this->runUpdates();
    $config = $this->config('views.view.media_library');
    $this->assertFalse($config->get('display.widget.display_options.defaults.filters'));
    $this->assertFalse($config->get('display.widget.display_options.defaults.arguments'));
    $this->assertArrayHasKey('filters', $config->get('display.widget.display_options'));
    $this->assertArrayHasKey('arguments', $config->get('display.widget.display_options'));
    $this->assertSame('1', $config->get('display.widget.display_options.filters.status.value'));
    $this->assertTrue($config->get('display.widget.display_options.filters.name.exposed'));
    $this->assertSame('ignore', $config->get('display.widget.display_options.arguments.bundle.default_action'));
}

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