You are here

public function HtmlResponseAttachmentsTest::testRenderCachedBlock in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php \Drupal\system\Tests\Render\HtmlResponseAttachmentsTest::testRenderCachedBlock()

Test caching of ['#attached'].

File

core/modules/system/src/Tests/Render/HtmlResponseAttachmentsTest.php, line 67
Contains \Drupal\system\Tests\Render\HtmlResponseAttachmentsTest.

Class

HtmlResponseAttachmentsTest
Functional tests for HtmlResponseAttachmentsProcessor.

Namespace

Drupal\system\Tests\Render

Code

public function testRenderCachedBlock() {

  // Make sure our test block is visible.
  $this
    ->drupalPlaceBlock('attached_rendering_block', [
    'region' => 'content',
  ]);

  // Get the front page, which should now have our visible block.
  $this
    ->drupalGet('');

  // Make sure our block is visible.
  $this
    ->assertText('Markup from attached_rendering_block.');

  // Test that all our attached items are present.
  $this
    ->assertFeed();
  $this
    ->assertHead();
  $this
    ->assertResponse(418);
  $this
    ->assertTeapotHeaders();

  // Reload the page, to test caching.
  $this
    ->drupalGet('');

  // Make sure our block is visible.
  $this
    ->assertText('Markup from attached_rendering_block.');

  // The header should be present again.
  $this
    ->assertHeader('X-Test-Teapot', 'Teapot Mode Active');
}