You are here

public function BlockCacheTest::testCachePerPage in MongoDB 7

Test DRUPAL_CACHE_PER_PAGE.

File

mongodb_block_ui/src/Tests/BlockCacheTest.php, line 185

Class

BlockCacheTest
Test block caching.

Namespace

Drupal\mongodb_block_ui\Tests

Code

public function testCachePerPage() {
  $this
    ->setCacheMode(DRUPAL_CACHE_PER_PAGE);
  $current_content = $this
    ->randomName();
  variable_set('block_test_content', $current_content);
  $this
    ->drupalGet('node');
  $this
    ->assertText($current_content, t('Block content displays on the node page.'));
  $old_content = $current_content;
  $current_content = $this
    ->randomName();
  variable_set('block_test_content', $current_content);
  $this
    ->drupalGet('user');
  $this
    ->assertNoText($old_content, t('Block content cached for the node page does not show up for the user page.'));
  $this
    ->drupalGet('node');
  $this
    ->assertText($old_content, t('Block content cached for the node page.'));
}