function LanguageHierarchyBaseTestCase::moveBlockToRegion in Language Hierarchy 7
Move block to region, from block.test
1 call to LanguageHierarchyBaseTestCase::moveBlockToRegion()
- MenuTranslationHierarchyWebTestCase::testMenuTranslateLocalize in modules/
i18n_menu_hierarchy/ tests/ i18n_menu_hierarchy.test
File
- tests/
language_hierarchy.test, line 283 - Tests for Language Hierarchy module.
Class
- LanguageHierarchyBaseTestCase
- Base class for Language Hierarchy module tests.
Code
function moveBlockToRegion($block, $region = 'sidebar_first') {
// Set the created block to a specific region.
$edit = array();
$edit['blocks[' . $block['module'] . '_' . $block['delta'] . '][region]'] = $region;
$this
->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the block was moved to the proper region.
$this
->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array(
'%region_name' => $region,
)));
// Confirm that the block is being displayed.
$this
->drupalGet('node');
$this
->assertText(check_plain($block['title']), 'Block successfully being displayed on the page.');
// Confirm that the custom block was found at the proper region.
$xpath = $this
->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array(
':region-class' => 'region region-' . str_replace('_', '-', $region),
':block-id' => 'block-' . $block['module'] . '-' . $block['delta'],
));
$this
->assertFieldByXPath($xpath, NULL, format_string('Custom block found in %region_name region.', array(
'%region_name' => $region,
)));
}