You are here

public function ViewsDataTest::testGetOnFirstCall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/tests/src/Unit/ViewsDataTest.php \Drupal\Tests\views\Unit\ViewsDataTest::testGetOnFirstCall()

Tests fetching all the views data without a static cache.

File

core/modules/views/tests/src/Unit/ViewsDataTest.php, line 192
Contains \Drupal\Tests\views\Unit\ViewsDataTest.

Class

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

Namespace

Drupal\Tests\views\Unit

Code

public function testGetOnFirstCall() {

  // Ensure that the hooks are just invoked once.
  $this
    ->setupMockedModuleHandler();
  $this->moduleHandler
    ->expects($this
    ->at(2))
    ->method('alter')
    ->with('views_data', $this
    ->viewsDataWithProvider());
  $this->cacheBackend
    ->expects($this
    ->once())
    ->method('get')
    ->with("views_data:en")
    ->will($this
    ->returnValue(FALSE));
  $expected_views_data = $this
    ->viewsDataWithProvider();
  $views_data = $this->viewsData
    ->get();
  $this
    ->assertSame($expected_views_data, $views_data);
}