Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.74 diff -u -p -r1.74 block.admin.inc --- modules/block/block.admin.inc 9 Mar 2010 03:48:59 -0000 1.74 +++ modules/block/block.admin.inc 9 Mar 2010 07:00:02 -0000 @@ -516,6 +516,10 @@ function block_custom_block_delete_submi ->condition('module', 'block') ->condition('delta', $form_state['values']['bid']) ->execute(); + db_delete('block_role') + ->condition('module', 'block') + ->condition('delta', $form_state['values']['bid']) + ->execute(); drupal_set_message(t('The block %name has been removed.', array('%name' => $form_state['values']['info']))); cache_clear_all(); $form_state['redirect'] = 'admin/structure/block'; Index: modules/block/block.test =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.test,v retrieving revision 1.45 diff -u -p -r1.45 block.test --- modules/block/block.test 9 Mar 2010 03:48:59 -0000 1.45 +++ modules/block/block.test 9 Mar 2010 07:00:02 -0000 @@ -84,11 +84,17 @@ class BlockTestCase extends DrupalWebTes $this->assertRaw(l(t('configure'), 'admin/structure/block/manage/block/' . $bid . '/configure'), t('Custom block configure link found.')); $this->assertRaw(l(t('delete'), 'admin/structure/block/manage/block/' . $bid . '/delete'), t('Custom block delete link found.')); + // Set visibility only for authenticated users, to verify delete functionality. + $edit['roles[2]'] = TRUE; + $this->drupalPost('admin/structure/block/manage/block/' . $bid . '/configure', $edit, t('Save block')); + // Delete the created custom block & verify that it's been deleted and no longer appearing on the page. $this->clickLink(t('delete')); $this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete')); $this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), t('Custom block successfully deleted.')); $this->assertNoText(t($custom_block['title']), t('Custom block no longer appears on page.')); + $count = db_query("SELECT 1 FROM {block_role} WHERE module = :module AND delta = :delta", array(':module' => $custom_block['module'], ':delta' => $custom_block['delta']))->fetchField(); + $this->assertFalse($count, t('Table block_role being cleaned.')); } /**