summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-31 06:31:00 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-05-31 06:31:00 +0000
commitf3c5d931b0e4c6d36b29f439d6e380f96511f8d8 (patch)
treecf15c92479bad6472ad2ed97d7c105c1911cb10d
parenta26efbeb5a0ad8b90c8eb2b20f06d34e69d2958f (diff)
downloadbrdo-f3c5d931b0e4c6d36b29f439d6e380f96511f8d8.tar.gz
brdo-f3c5d931b0e4c6d36b29f439d6e380f96511f8d8.tar.bz2
#473080 by chx: Fix bug in block page access callback showing tabs that should not appear. (with tests)
-rw-r--r--modules/block/block.module3
-rw-r--r--modules/block/block.test32
2 files changed, 34 insertions, 1 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 18a20af22..841761cdf 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -176,7 +176,8 @@ function block_menu() {
* Menu item access callback - only admin or enabled themes can be accessed.
*/
function _block_themes_access($theme) {
- return user_access('administer blocks') && ($theme->status || $theme->name == variable_get('admin_theme', 0));
+ $admin_theme = variable_get('admin_theme');
+ return user_access('administer blocks') && ($theme->status || ($admin_theme && ($theme->name == $admin_theme)));
}
/**
diff --git a/modules/block/block.test b/modules/block/block.test
index 34618e92d..9cef03036 100644
--- a/modules/block/block.test
+++ b/modules/block/block.test
@@ -191,3 +191,35 @@ class NonDefaultBlockAdmin extends DrupalWebTestCase {
$this->assertRaw('stark/layout.css', t('Stark CSS found'));
}
}
+
+/**
+ * Test the block system with admin themes.
+ */
+class BlockAdminThemeTestCase extends DrupalWebTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => t('Admin theme block admin accessibility'),
+ 'description' => t("Check whether the block administer page for a disabled theme acccessible if and only if it's the admin theme."),
+ 'group' => t('Block'),
+ );
+ }
+
+ /**
+ * Check for the accessibility of the admin theme on the block admin page.
+ */
+ function testAdminTheme() {
+ // Create administrative user.
+ $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer site configuration'));
+ $this->drupalLogin($admin_user);
+
+ // Ensure that access to block admin page is denied when theme is disabled.
+ $this->drupalGet('admin/build/block/list/stark');
+ $this->assertResponse(403, t('The block admin page for a disabled theme can not be accessed'));
+
+ // Enable admin theme and confirm that tab is accessible.
+ $edit['admin_theme'] = 'stark';
+ $this->drupalPost('admin/build/themes', $edit, t('Save configuration'));
+ $this->drupalGet('admin/build/block/list/stark');
+ $this->assertResponse(200, t('The block admin page for the admin theme can be accessed'));
+ }
+}