function PanelizerNodeTest::testPageConfiguration in Panelizer 7.3
Verify that the "Basic page" content type can be panelized.
File
- tests/
panelizer.node.test, line 46 - Test the node functionality for Panelizer.
Class
- PanelizerNodeTest
- Verifies Panelizer configuration options for nodes.
Code
function testPageConfiguration() {
$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');
// Allow panelization of the "Default" view mode.
$this
->drupalGet('admin/structure/types/manage/' . $content_type);
$this
->assertResponse(200);
$edit = array(
'panelizer[view modes][' . $view_mode . '][status]' => TRUE,
);
$this
->drupalPost(NULL, $edit, t('Save content type'));
// Confirm the behavior of Panelizer when there is no default display
// available.
$paths = array(
$view_mode,
$view_mode . '/settings',
$view_mode . '/context',
$view_mode . '/layout',
$view_mode . '/content',
);
foreach ($paths as $path) {
$this
->drupalGet('admin/structure/types/manage/' . $content_type . '/panelizer/' . $path);
$this
->assertResponse(200);
$this
->assertText(t('No default display has been configured for this view mode.'));
}
// Check that the view mode can be panelized.
$this
->drupalGet('node/' . $node->nid . '/panelizer');
$this
->assertResponse(200);
$this
->assertText('Default');
$this
->assertLink('panelize', 0, 'The panelize link for the view mode appears on the page');
$this
->assertLinkByHref('node/' . $node->nid . '/panelizer/' . $view_mode, 0, 'A link to panelize the view mode appears on the page');
// Verify that the view mode is not currently panelized.
$this
->drupalGet('node/' . $node->nid . '/panelizer/' . $view_mode);
$this
->assertRaw(t('This %entity is not currently panelized.', array(
'%entity' => 'Node',
)));
// Panelize the view mode.
$this
->drupalPost(NULL, array(), t('Panelize it!'));
// Check that the view mode has been panelized.
$this
->drupalGet('node/' . $node->nid);
$elements = $this
->xpath('//div[contains(@class,:class)]', array(
':class' => 'panelizer-view-mode',
));
$this
->assertEqual(count($elements), 1, 'The node is panelized.');
}