diff --git a/modules/block/block.test b/modules/block/block.test index 022bf38..877242a 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -334,6 +334,19 @@ class BlockTestCase extends DrupalWebTestCase { // Verify that the database is updated with the new caching mode. $current_caching = db_query("SELECT cache FROM {block} WHERE module = 'block_test' AND delta = 'test_cache'")->fetchField(); $this->assertEqual($current_caching, DRUPAL_NO_CACHE, t("Test block's database entry updated to DRUPAL_NO_CACHE.")); + + // Remove a block from block_info and take sure it's not part of the block + // table anymore. + $block = db_query("SELECT bid FROM {block} WHERE module = 'block_test' AND delta = 'test_block_info'")->fetchField(); + $this->assertTrue(!empty($block), t('Test block is in the database.')); + + // Rebuild the blocks. + variable_set('block_test_block_info', FALSE); + // Flushing all caches should call _block_rehash(). + drupal_flush_all_caches(); + + $block = db_query("SELECT bid FROM {block} WHERE module = 'block_test' AND delta = 'test_block_info'")->fetchField(); + $this->assertTrue(empty($block), t('Test block is not part of the database anymore.')); } } diff --git a/modules/block/tests/block_test.module b/modules/block/tests/block_test.module index 2abc433..9d478cc 100644 --- a/modules/block/tests/block_test.module +++ b/modules/block/tests/block_test.module @@ -17,6 +17,12 @@ function block_test_block_info() { $blocks['test_html_id'] = array( 'info' => t('Test block html id'), ); + + if (variable_get('block_test_block_info', TRUE)) { + $blocks['test_block_info'] = array( + 'info' => t('Test block info'), + ); + } return $blocks; }