You are here

public function RenderCacheWebTest::testRepeatedDisplay in Drupal 9

Same name and namespace in other branches
  1. 10 core/modules/views/tests/src/Functional/RenderCacheWebTest.php \Drupal\Tests\views\Functional\RenderCacheWebTest::testRepeatedDisplay()

Tests render caching for display rendered with different args on same page.

File

core/modules/views/tests/src/Functional/RenderCacheWebTest.php, line 82

Class

RenderCacheWebTest
Tests render caching of blocks provided by views.

Namespace

Drupal\Tests\views\Functional

Code

public function testRepeatedDisplay() {
  $this
    ->drupalGet("views_test_render_cache/node_id_argument/block_1/{$this->nodes[0]->id()}/{$this->nodes[1]->id()}");

  // Confirm there are two displays.
  $displays = $this
    ->cssSelect('.views-element-container .view-id-node_id_argument.view-display-id-block_1');
  $this
    ->assertCount(2, $displays, 'There are two displays');

  // First display should only have test title 1.
  $this
    ->assertSame($this->nodes[0]
    ->getTitle(), $displays[0]
    ->getText());

  // Second display should only have test title 2.
  $this
    ->assertSame($this->nodes[1]
    ->getTitle(), $displays[1]
    ->getText());
}