function ViewsDataTest::testFullGetCache

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::testFullGetCache()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::testFullGetCache()
  3. 11.x core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::testFullGetCache()

Tests the caching of the full views data.

File

core/modules/views/tests/src/Unit/ViewsDataTest.php, line 280

Class

ViewsDataTest
@coversDefaultClass \Drupal\views\ViewsData @group views

Namespace

Drupal\Tests\views\Unit

Code

public function testFullGetCache() : void {
    $expected_views_data = $this->viewsDataWithProvider();
    // Views data should be invoked once.
    $this->setupMockedModuleHandler();
    $this->moduleHandler
        ->expects($this->once())
        ->method('alter')
        ->with('views_data', $expected_views_data);
    $this->cacheBackend
        ->expects($this->once())
        ->method('get')
        ->with("views_data:en")
        ->willReturn(FALSE);
    $views_data = $this->viewsData
        ->getAll();
    $this->assertSame($expected_views_data, $views_data);
    $views_data = $this->viewsData
        ->getAll();
    $this->assertSame($expected_views_data, $views_data);
}

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