You are here

function DashboardBlocksTestCase::testDashboardRegions in Drupal 7

Tests that dashboard regions are displayed or hidden properly.

File

modules/dashboard/dashboard.test, line 66
Tests for dashboard.module.

Class

DashboardBlocksTestCase
Tests the Dashboard module blocks.

Code

function testDashboardRegions() {
  $dashboard_regions = dashboard_region_descriptions();

  // Ensure blocks can be placed in dashboard regions.
  $this
    ->drupalGet('admin/dashboard/configure');
  foreach ($dashboard_regions as $region => $description) {
    $elements = $this
      ->xpath('//option[@value=:region]', array(
      ':region' => $region,
    ));
    $this
      ->assertTrue(!empty($elements), format_string('%region is an available choice on the dashboard block configuration page.', array(
      '%region' => $region,
    )));
  }

  // Ensure blocks cannot be placed in dashboard regions on the standard
  // blocks configuration page.
  $this
    ->drupalGet('admin/structure/block');
  foreach ($dashboard_regions as $region => $description) {
    $elements = $this
      ->xpath('//option[@value=:region]', array(
      ':region' => $region,
    ));
    $this
      ->assertTrue(empty($elements), format_string('%region is not an available choice on the block configuration page.', array(
      '%region' => $region,
    )));
  }
}