function RenderCacheWebTest::testEmptyView

Same name and namespace in other branches
  1. 8.9.x core/modules/views/tests/src/Functional/RenderCacheWebTest.php \Drupal\Tests\views\Functional\RenderCacheWebTest::testEmptyView()
  2. 10 core/modules/views/tests/src/Functional/RenderCacheWebTest.php \Drupal\Tests\views\Functional\RenderCacheWebTest::testEmptyView()
  3. 11.x core/modules/views/tests/src/Functional/RenderCacheWebTest.php \Drupal\Tests\views\Functional\RenderCacheWebTest::testEmptyView()

Tests rendering caching of a views block with arguments.

File

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

Class

RenderCacheWebTest
Tests render caching of blocks provided by views.

Namespace

Drupal\Tests\views\Functional

Code

public function testEmptyView() {
    $this->placeBlock('views_block:node_id_argument-block_1', [
        'region' => 'header',
    ]);
    $this->drupalGet('<front>');
    $this->assertEquals([], $this->cssSelect('div.region-header div.views-field-title'));
    $this->drupalGet($this->nodes[0]
        ->toUrl());
    $result = $this->cssSelect('div.region-header div.views-field-title')[0]
        ->getText();
    $this->assertEquals('test title 1', $result);
    $this->drupalGet($this->nodes[1]
        ->toUrl());
    $result = $this->cssSelect('div.region-header div.views-field-title')[0]
        ->getText();
    $this->assertEquals('test title 2', $result);
    $this->drupalGet($this->nodes[0]
        ->toUrl());
    $result = $this->cssSelect('div.region-header div.views-field-title')[0]
        ->getText();
    $this->assertEquals('test title 1', $result);
}

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