| 7 dashboard.test | DashboardBlocksTestCase::testDisableEnable() |
| 8 dashboard.test | DashboardBlocksTestCase::testDisableEnable() |
Tests that the dashboard module can be re-enabled, retaining its blocks.
File
- modules/
dashboard/ dashboard.test, line 88 - Tests for dashboard.module.
Code
function testDisableEnable() {
// Add a new custom block to a dashboard region.
$custom_block = array();
$custom_block['info'] = $this->randomName(8);
$custom_block['title'] = $this->randomName(8);
$custom_block['body[value]'] = $this->randomName(32);
$custom_block['regions[stark]'] = 'dashboard_main';
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
$this->drupalGet('admin/dashboard');
$this->assertRaw($custom_block['title'], t('Block appears on the dashboard.'));
$edit = array();
$edit['modules[Core][dashboard][enable]'] = FALSE;
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
$this->assertNoRaw('assigned to the invalid region', t('Dashboard blocks gracefully disabled.'));
module_list(TRUE);
$this->assertFalse(module_exists('dashboard'), t('Dashboard disabled.'));
$edit['modules[Core][dashboard][enable]'] = 'dashboard';
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
module_list(TRUE);
$this->assertTrue(module_exists('dashboard'), t('Dashboard enabled.'));
$this->drupalGet('admin/dashboard');
$this->assertRaw($custom_block['title'], t('Block still appears on the dashboard.'));
}
Login or register to post comments