You are here

public function BlockViewBuilderTest::testBlockViewBuilderCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/Tests/BlockViewBuilderTest.php \Drupal\block\Tests\BlockViewBuilderTest::testBlockViewBuilderCache()

Tests block render cache handling.

File

core/modules/block/src/Tests/BlockViewBuilderTest.php, line 131
Contains \Drupal\block\Tests\BlockViewBuilderTest.

Class

BlockViewBuilderTest
Tests the block view builder.

Namespace

Drupal\block\Tests

Code

public function testBlockViewBuilderCache() {

  // Verify cache handling for a non-empty block.
  $this
    ->verifyRenderCacheHandling();

  // Create an empty block.
  $this->block = $this->controller
    ->create(array(
    'id' => 'test_block',
    'theme' => 'stark',
    'plugin' => 'test_cache',
  ));
  $this->block
    ->save();
  \Drupal::state()
    ->set('block_test.content', NULL);

  // Verify cache handling for an empty block.
  $this
    ->verifyRenderCacheHandling();
}