1 layout.test LayoutSelectionTest::testPages()

Tests the correct layout is used on 404 and 403 pages.

File

core/modules/layout/tests/layout.test, line 2408
Tests for the Layout module.

Class

LayoutSelectionTest
Tests that the correct layout is used in various situations.

Code

function testPages() {
  // Check that a known page is using the admin (one-column) layout.
  $this->backdropGet('admin/config/content/formats/plain_text');
  $this->assertIsAdminLayout();

  // Check that node/add uses the admin layout for the admin user.
  $this->backdropGet('node/add/' . $this->content_type->type);
  $this->assertIsAdminLayout();

  // Check that a 403 page uses the admin layout.
  $this->backdropGet('admin/appearance');
  $this->assertIsAdminLayout();

  // Check that a 404 page uses the admin layout.
  $this->backdropGet('admin/config/content/formats/fake-format');
  $this->assertIsAdminLayout();

  // Check that the front-end is using the default layout.
  $this->backdropGet('node');
  $this->assertIsDefaultLayout();

  // Check that anonymous users get the Default layout for admin paths.
  $this->backdropLogout();

  // Anonymous 403.
  $this->backdropGet('admin/config/content/formats/plain_text');
  $this->assertIsDefaultLayout();

  // Anonymous 404.
  $this->backdropGet('admin/config/content/formats/fake-format');
  $this->assertIsDefaultLayout();

  // Check that a logged in user that can access an admin page but not the
  // admin theme uses the default layout.
  $this->backdropLogin($this->web_user);
  $this->backdropGet('node/add/' . $this->content_type->type);
  $this->assertIsDefaultLayout();
}