You are here

function Drupali18nTestCase::moveBlockToRegion in Internationalization 7

Move block to region, from block.test

4 calls to Drupali18nTestCase::moveBlockToRegion()
i18nBlocksTestCase::i18nCreateBlock in i18n_block/i18n_block.test
Test creating custom block (i.e. box), moving it to a specific region and then deleting it.
i18nBlocksTestCase::testBlockTranslation in i18n_block/i18n_block.test
i18nMenuTestCase::testMenuTranslateLocalize in i18n_menu/i18n_menu.test
i18nMenuTestCase::testNodeMenuItems in i18n_menu/i18n_menu.test
Test menu items for nodes.

File

./i18n.test, line 247
Base class for Internationalization tests

Class

Drupali18nTestCase
@file Base class for Internationalization tests

Code

function moveBlockToRegion($block, $region = 'sidebar_first') {
  $this
    ->drupalLogin($this->admin_user);

  // 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']), t('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, t('Custom block found in %region_name region.', array(
    '%region_name' => $region,
  )));
}