function ViewsConfigUpdaterTest::testNeedsRenderedEntityFieldUpdate

@covers ::needsRenderedEntityFieldUpdate

File

core/modules/views/tests/src/Kernel/ViewsConfigUpdaterTest.php, line 87

Class

ViewsConfigUpdaterTest
@coversDefaultClass \Drupal\views\ViewsConfigUpdater

Namespace

Drupal\Tests\views\Kernel

Code

public function testNeedsRenderedEntityFieldUpdate() : void {
    $config_updater = $this->container
        ->get('class_resolver')
        ->getInstanceFromDefinition(ViewsConfigUpdater::class);
    assert($config_updater instanceof ViewsConfigUpdater);
    $test_view = $this->loadTestView('views.view.test_entity_field_renderered_entity');
    $needs_update = $config_updater->needsRenderedEntityFieldUpdate($test_view);
    $test_view->save();
    $this->assertTrue($needs_update);
    $displays = [
        'default',
        'page_1',
        'page_2',
        'page_3',
        'page_4',
        'page_5',
        'page_6',
    ];
    foreach ($displays as $display) {
        $display = $test_view->getDisplay($display);
        self::assertEmpty($display['cache_metadata']['tags']);
    }
}

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