diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-18 05:28:43 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-18 05:28:43 +0000 |
commit | 1650fea5d949b576bcc779d6315250da0ba7ec82 (patch) | |
tree | d2bbbd716e9f11754dd881145ae06c2a372f4757 /modules/system/system.test | |
parent | 2484439643f86cbc2da3b4f391eb3e23e51fc94d (diff) | |
download | brdo-1650fea5d949b576bcc779d6315250da0ba7ec82.tar.gz brdo-1650fea5d949b576bcc779d6315250da0ba7ec82.tar.bz2 |
#516150 by David_Rothstein, dropcube, Senpai, alexanderpas, sun: Add fallback for main content block rendering. (Make it so you can't render your site completely unusable by disabling block module. Oopsie.)
Diffstat (limited to 'modules/system/system.test')
-rw-r--r-- | modules/system/system.test | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/modules/system/system.test b/modules/system/system.test index 4f75cf21d..4f684e876 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -999,7 +999,89 @@ class SystemBlockTestCase extends DrupalWebTestCase { $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); $this->drupalPost('admin/structure/block/manage/system/powered-by/configure', array('title' => '', 'color' => 'powered-blue', 'size' => '80x15'), t('Save block')); } +} + +/** + * Test main content rendering fallback provided by system module. + */ +class SystemMainContentFallback extends DrupalWebTestCase { + protected $admin_user; + protected $web_user; + + public static function getInfo() { + return array( + 'name' => 'Main content rendering fallback', + 'description' => ' Test system module main content rendering fallback.', + 'group' => 'System', + ); + } + + function setUp() { + parent::setUp('system_test'); + + // Create and login admin user. + $this->admin_user = $this->drupalCreateUser(array( + 'access administration pages', + 'administer site configuration', + 'administer blocks', + 'administer nodes', + )); + $this->drupalLogin($this->admin_user); + // Create a web user. + $this->web_user = $this->drupalCreateUser(array('access user profiles', 'access content')); + } + + /** + * Test availability of main content. + */ + function testMainContentFallback() { + $edit = array(); + // Disable the dashboard module, which depends on the block module. + $edit['modules[Core][dashboard][enable]'] = FALSE; + $this->drupalPost('admin/config/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + // Disable the block module. + $edit['modules[Core][block][enable]'] = FALSE; + $this->drupalPost('admin/config/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + module_list(TRUE); + $this->assertFalse(module_exists('block'), t('Block module disabled.')); + + // At this point, no region is filled and fallback should be triggered. + $this->drupalGet('admin/config/system/site-information'); + $this->assertField('site_name', t('Admin interface still availble.')); + + // Fallback should not trigger when another module is handling content. + $this->drupalGet('system-test/main-content-handling'); + $this->assertRaw('id="system-test-content"', t('Content handled by another module')); + $this->assertText(t('Content to test main content fallback'), t('Main content still displayed.')); + + // Fallback should trigger when another module + // indicates that it is not handling the content. + $this->drupalGet('system-test/main-content-fallback'); + $this->assertText(t('Content to test main content fallback'), t('Main content fallback properly triggers.')); + + // Fallback should not trigger when another module is handling content. + // Note that this test ensures that no duplicate + // content gets created by the fallback. + $this->drupalGet('system-test/main-content-duplication'); + $this->assertNoText(t('Content to test main content fallback'), t('Main content not duplicated.')); + + // Request a user* page and see if it is displayed. + $this->drupalLogin($this->web_user); + $this->drupalGet('user/' . $this->web_user->uid . '/edit'); + $this->assertField('mail', t('User interface still availble.')); + + // Enable the block module again. + $this->drupalLogin($this->admin_user); + $edit = array(); + $edit['modules[Core][block][enable]'] = 'block'; + $this->drupalPost('admin/config/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + module_list(TRUE); + $this->assertTrue(module_exists('block'), t('Block module re-enabled.')); + } } class SystemSettingsForm extends DrupalWebTestCase { |