1 layout.test | LayoutInterfaceTest::testBlockUninstall() |
Tests layout_modules_uninstalled().
File
- core/
modules/ layout/ tests/ layout.test, line 1974 - Tests for the Layout module.
Class
- LayoutInterfaceTest
- Tests the interface for adding, removing, and moving blocks.
Code
function testBlockUninstall() {
$this->backdropGet('admin/structure/layouts');
$this->clickLink(t('Add layout'));
// Create a new layout at a new path.
$layout_title = $this->randomName();
$layout_name = strtolower($layout_title);
$layout_url = 'layout-test-path';
$edit = array(
'title' => $layout_title,
'name' => $layout_name,
'layout_template' => 'moscone_flipped',
'path' => $layout_url,
);
$this->backdropPost(NULL, $edit, t('Create layout'));
// Add a block to the sidebar.
$this->clickLink(t('Add block'), 3);
$this->assertText(t('A testing block for layouts.'));
$this->clickLink(t('Layout foo block'));
$edit = array(
'block_settings[count]' => 5,
);
$this->backdropPost(NULL, $edit, t('Add block'));
// Save the layout.
$this->backdropPost(NULL, array(), t('Save layout'));
// Check that the new block is on the edit page.
$this->backdropGet('admin/structure/layouts/manage/' . $layout_name);
$this->assertText(t('A testing block for layouts.'));
// Add the same block to the default layout.
$this->backdropGet('admin/structure/layouts/manage/default');
// Add the same block to the sidebar.
$this->clickLink(t('Add block'), 3);
$this->assertText(t('A testing block for layouts.'));
$this->clickLink(t('Layout foo block'));
$edit = array(
'block_settings[count]' => 5,
);
$this->backdropPost(NULL, $edit, t('Add block'));
// Save the layout.
$this->backdropPost(NULL, array(), t('Save layout'));
// Check that the new block is on the edit page.
$this->backdropGet('admin/structure/layouts/manage/default');
$this->assertText(t('A testing block for layouts.'));
// Uninstall the module providing the block.
module_disable(array('layout_test'));
backdrop_uninstall_modules(array('layout_test'));
$this->assertFalse(module_exists('layout_test'), 'The module has been uninstalled.');
// Check that the new block is on none of the layout edit pages.
$this->backdropGet('admin/structure/layouts/manage/default');
$this->assertNoText(t('A testing block for layouts.'));
$this->backdropGet('admin/structure/layouts/manage/' . $layout_name);
$this->assertNoText(t('A testing block for layouts.'));
}