1 system.test SystemMainContentFallback::testMainContentFallback()

Test availability of main content.

File

core/modules/system/tests/system.test, line 1639
Tests for system.module.

Class

SystemMainContentFallback
Test main content rendering fallback provided by system module.

Code

function testMainContentFallback() {
  // Disable the layout module.
  module_disable(array('layout'));
  // Remove the old layout path from the menu.
  menu_rebuild();
  $this->assertFalse(module_exists('layout'), 'Layout module disabled.');

  // At this point, no region is filled and fallback should be triggered.
  $this->backdropGet('admin/config/system/site-information');
  $this->assertField('site_name', 'Admin interface still available.');

  // Fallback should not trigger when another module is handling content.
  $this->backdropGet('system-test/main-content-fallback');
  $this->assertText(t('Content to test main content fallback'), 'Main content still displayed without Layout module enabled.');

  // Request a user* page and see if it is displayed.
  $this->backdropLogin($this->web_user);
  $this->backdropGet('user/' . $this->web_user->uid . '/edit');
  $this->assertField('mail', 'User interface still available.');

  // Enable the layout module again.
  module_enable(array('layout'));
  $this->assertTrue(module_exists('layout'), 'Layout module re-enabled.');
}