You are here

function PanelizerNodeTest::testNodePanelizerAdminTheme in Panelizer 7.3

Verify that the admin theme is displayed appropriately.

File

tests/panelizer.node.test, line 435
Test the node functionality for Panelizer.

Class

PanelizerNodeTest
Verifies Panelizer configuration options for nodes.

Code

function testNodePanelizerAdminTheme() {
  $content_type = 'page';
  $view_mode = 'default';

  // Panelize "Basic page" content type.
  $edit = array(
    'panelizer[status]' => TRUE,
  );
  $this
    ->drupalPost('admin/structure/types/manage/' . $content_type, $edit, t('Save content type'));

  // Create a test node.
  $node = $this
    ->createNode();

  // Check that the post has been panelized.
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertLink('Customize display', 0, 'The customize display link appears on the page');
  $this
    ->assertLinkByHref('node/' . $node->nid . '/panelizer', 0, 'A link to customize the node appears on the page');

  // Confirm the node page is not using the admin theme.
  $this
    ->assertNoRaw('themes/seven/style.css', 'The node page is not using the admin theme.');

  // Check that the view mode can be panelized.
  $this
    ->drupalGet('node/' . $node->nid . '/panelizer');
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Changes made here will override the default (Panelizer) displays and will only affect this @entity.', array(
    '@entity' => 'node',
  )));

  // Confirm the Panelizer pages are being used. By default node_admin_theme
  // is set to TRUE, so the admin theme should be used.
  $this
    ->assertRaw('themes/seven/style.css', 'The node Panelizer page is using the admin theme.');

  // Override the admin theme setting.
  variable_set('node_admin_theme', FALSE);

  // Load the same Panelizer page again.
  $this
    ->drupalGet('node/' . $node->nid . '/panelizer');
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Changes made here will override the default (Panelizer) displays and will only affect this @entity.', array(
    '@entity' => 'node',
  )));

  // Confirm the Panelizer pages are being used. By default node_admin_theme
  // is set to TRUE, so the admin theme should be used.
  $this
    ->assertNoRaw('themes/seven/style.css', 'The node Panelizer page is no longer using the admin theme as it was disabled for node edit pages.');
}