private function BlockCacheTestCase::setCacheMode
7.x block.test | private BlockCacheTestCase::setCacheMode($cache_mode) |
Private helper method to set the test block's cache mode.
5 calls to BlockCacheTestCase::setCacheMode()
- BlockCacheTestCase::testCacheGlobal in drupal-7.x/
modules/ block/ block.test - Test DRUPAL_CACHE_GLOBAL.
- BlockCacheTestCase::testCachePerPage in drupal-7.x/
modules/ block/ block.test - Test DRUPAL_CACHE_PER_PAGE.
- BlockCacheTestCase::testCachePerRole in drupal-7.x/
modules/ block/ block.test - Test DRUPAL_CACHE_PER_ROLE.
- BlockCacheTestCase::testCachePerUser in drupal-7.x/
modules/ block/ block.test - Test DRUPAL_CACHE_PER_USER.
- BlockCacheTestCase::testNoCache in drupal-7.x/
modules/ block/ block.test - Test DRUPAL_NO_CACHE.
File
- drupal-7.x/
modules/ block/ block.test, line 662 - Tests for block.module.
Class
- BlockCacheTestCase
- Test block caching.
Code
private 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)));
}
}