function NodeDisplaysRegions::testRendering in Node displays 7
Same name and namespace in other branches
- 6.3 tests/nd.regions.test \NodeDisplaysRegions::testRendering()
- 6 tests/nd.regions.test \NodeDisplaysRegions::testRendering()
- 6.2 tests/nd.regions.test \NodeDisplaysRegions::testRendering()
Test if nodeapi & preprocess do their job good by excluding fields and putting them in the right region.
File
- tests/
nd.regions.test, line 70 - Tests for Node displays (regions)
Class
- NodeDisplaysRegions
- @file Tests for Node displays (regions)
Code
function testRendering() {
$admin_user = $this
->drupalCreateUser(array(
'administer nodes',
'access display suite',
'administer nd',
'configure layout for nd',
'export and import settings',
'revert overridden settings',
'use PHP in custom fields',
));
$this
->drupalLogin($admin_user);
$page_node = $this
->drupalCreateNode();
// First post.
$edit = array(
'title[full][region]' => 'header',
'author[full][region]' => 'middle',
'body[full][region]' => 'middle',
'links[full][region]' => 'footer',
'terms[full][region]' => 'disabled',
);
$this
->drupalPost('admin/ds/layout/page/full', $edit, t('Save'));
$page_object = $this
->_nd_build_object($page_node);
$this
->assertTrue(in_array('title', array_keys($page_object->regions['header'])), t('Title is in header region'), t('Rendering tests'));
$this
->assertTrue(in_array('author', array_keys($page_object->regions['middle'])), t('Author is in middle region'), t('Rendering tests'));
$this
->assertTrue(in_array('body', array_keys($page_object->regions['middle'])), t('Body is in middle region'), t('Rendering tests'));
$this
->assertTrue(in_array('links', array_keys($page_object->regions['footer'])), t('Links is in footer region'), t('Rendering tests'));
$this
->assertTrue($this
->_nd_field_not_found('terms', $page_object->regions), t('Terms is disabled'), t('Rendering tests'));
// Let's do another one..
$edit = array(
'title[full][region]' => 'disabled',
'author[full][region]' => 'right',
'body[full][region]' => 'middle',
'links[full][region]' => 'footer',
'terms[full][region]' => 'footer',
);
$this
->drupalPost('admin/ds/layout/page/full', $edit, t('Save'));
$page_object = $this
->_nd_build_object($page_node);
$this
->assertTrue(in_array('terms', array_keys($page_object->regions['footer'])), t('Terms is in footer region'), t('Rendering tests'));
$this
->assertTrue(in_array('author', array_keys($page_object->regions['right'])), t('Author is in right region'), t('Rendering tests'));
$this
->assertTrue(in_array('body', array_keys($page_object->regions['middle'])), t('Body is in middle region'), t('Rendering tests'));
$this
->assertTrue(in_array('links', array_keys($page_object->regions['footer'])), t('Links is in footer region'), t('Rendering tests'));
$this
->assertTrue($this
->_nd_field_not_found('title', $page_object->regions), t('Title is disabled'), t('Rendering tests'));
}