You are here

public function ViewsDataTest::testFullGetCache in Drupal 8

Tests the caching of the full views data.

File

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

Class

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

Namespace

Drupal\Tests\views\Unit

Code

public function testFullGetCache() {
  $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")
    ->will($this
    ->returnValue(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);
}