You are here

protected function BlockCacheTest::setCacheMode in MongoDB 7

Private helper method to set the test block's cache mode.

5 calls to BlockCacheTest::setCacheMode()
BlockCacheTest::testCacheGlobal in mongodb_block_ui/src/Tests/BlockCacheTest.php
Test DRUPAL_CACHE_GLOBAL.
BlockCacheTest::testCachePerPage in mongodb_block_ui/src/Tests/BlockCacheTest.php
Test DRUPAL_CACHE_PER_PAGE.
BlockCacheTest::testCachePerRole in mongodb_block_ui/src/Tests/BlockCacheTest.php
Test DRUPAL_CACHE_PER_ROLE.
BlockCacheTest::testCachePerUser in mongodb_block_ui/src/Tests/BlockCacheTest.php
Test DRUPAL_CACHE_PER_USER.
BlockCacheTest::testNoCache in mongodb_block_ui/src/Tests/BlockCacheTest.php
Test DRUPAL_NO_CACHE.

File

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

Class

BlockCacheTest
Test block caching.

Namespace

Drupal\mongodb_block_ui\Tests

Code

protected function setCacheMode($cache_mode) {
  db_update('block')
    ->fields(array(
    'cache' => $cache_mode,
  ))
    ->condition('module', 'block_test')
    ->execute();
  $current_mode = db_query("SELECT cache FROM {block} WHERE module = 'block_test'")
    ->fetchField();
  if ($current_mode != $cache_mode) {
    $this
      ->fail(t('Unable to set cache mode to %mode. Current mode: %current_mode', array(
      '%mode' => $cache_mode,
      '%current_mode' => $current_mode,
    )));
  }
}