function RenderCacheWebTest::testRepeatedDisplay

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/RenderCacheWebTest.php \Drupal\Tests\views\Functional\RenderCacheWebTest::testRepeatedDisplay()
  2. 11.x 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 84

Class

RenderCacheWebTest
Tests render caching of blocks provided by views.

Namespace

Drupal\Tests\views\Functional

Code

public function testRepeatedDisplay() : void {
    $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());
}

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