You are here

public function BlockCacheTest::testNoCache in MongoDB 7

Test DRUPAL_NO_CACHE.

File

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

Class

BlockCacheTest
Test block caching.

Namespace

Drupal\mongodb_block_ui\Tests

Code

public function testNoCache() {
  $this
    ->setCacheMode(DRUPAL_NO_CACHE);
  $current_content = $this
    ->randomName();
  variable_set('block_test_content', $current_content);

  // If DRUPAL_NO_CACHE has no effect, the next request would be cached.
  $this
    ->drupalGet('');
  $this
    ->assertText($current_content, t('Block content displays.'));

  // A cached copy should not be served.
  $current_content = $this
    ->randomName();
  variable_set('block_test_content', $current_content);
  $this
    ->drupalGet('');
  $this
    ->assertText($current_content, t('DRUPAL_NO_CACHE prevents blocks from being cached.'));
}