You are here

public function ViewsDataTest::testGetAllEqualsToGetNull in Drupal 8

Tests that getting all data has same results as getting data with NULL logic.

@covers ::getAll @group legacy

@expectedDeprecation Calling get() without the $key argument is deprecated in drupal:8.2.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/3090442

File

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

Class

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

Namespace

Drupal\Tests\views\Unit

Code

public function testGetAllEqualsToGetNull() {
  $expected_views_data = $this
    ->viewsDataWithProvider();
  $this
    ->setupMockedModuleHandler();

  // Setup a warm cache backend for a single table.
  $this->cacheBackend
    ->expects($this
    ->once())
    ->method('get')
    ->with("views_data:en");
  $this->cacheBackend
    ->expects($this
    ->once())
    ->method('set')
    ->with('views_data:en', $expected_views_data);

  // Initialize the views data cache and repeat with no specified table. This
  // should only load the cache entry for all tables.
  for ($i = 0; $i < 5; $i++) {
    $this
      ->assertSame($expected_views_data, $this->viewsData
      ->getAll());
    $this
      ->assertSame($expected_views_data, $this->viewsData
      ->get());
  }
}