diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 6a3dd0c..577951a 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -379,4 +379,29 @@ function testBlockRehash() { $config = $instance->getConfig(); $this->assertEqual($config['cache'], DRUPAL_NO_CACHE, "Test block's database entry updated to DRUPAL_NO_CACHE."); } + + /** + * Test disabled blocks. + */ + function testBlockModuleDisable() { + module_enable(array('block_test')); + $this->assertTrue(module_exists('block_test'), 'Test block module enabled.'); + + // Clear the block cache to load the block_test module's block definitions. + $manager = $this->container->get('plugin.manager.block'); + $manager->clearCachedDefinitions(); + + // Add a test block. + $plugin = $manager->getDefinition('test_cache'); + $block = array(); + $block['id'] = 'test_cache'; + $block['machine_name'] = $this->randomName(8); + $block['theme'] = variable_get('theme_default', 'stark'); + $block['region'] = 'header'; + $this->drupalPost('admin/structure/block/manage/' . $block['id'] . '/' . $block['theme'], array('machine_name' => $block['machine_name'], 'region' => $block['region']), t('Save block')); + + module_disable(array('block_test'), FALSE); + $this->drupalGet('admin/structure/block'); + $this->assertResponse(200); + } }