function dsFormTests::testDSForms in Display Suite 7.2
Same name and namespace in other branches
- 7 tests/ds.forms.test \dsFormTests::testDSForms()
Forms tests.
File
- tests/
ds.forms.test, line 24 - Form layout tests.
Class
- dsFormTests
- @file Form layout tests.
Code
function testDSForms() {
// Create a node.
$node = $this
->drupalCreateNode(array(
'type' => 'article',
'promote' => FALSE,
));
// Configure teaser layout.
$form = array(
'additional_settings[layout]' => 'ds_2col_stacked',
);
$form_assert = array(
'regions' => array(
'header' => '<td colspan="8">' . t('Header') . '</td>',
'left' => '<td colspan="8">' . t('Left') . '</td>',
'right' => '<td colspan="8">' . t('Right') . '</td>',
'footer' => '<td colspan="8">' . t('Footer') . '</td>',
),
);
$this
->dsSelectLayout($form, $form_assert, 'admin/structure/types/manage/article/fields');
$fields = array(
'fields[title][region]' => 'header',
'fields[body][region]' => 'left',
'fields[field_image][region]' => 'right',
'fields[field_tags][region]' => 'right',
);
$this
->dsConfigureUI($fields, 'admin/structure/types/manage/article/fields');
// Inspect the node.
$this
->drupalGet('node/' . $node->nid . '/edit');
$this
->assertRaw('ds_2col_stacked', 'ds-form class added');
$this
->assertRaw('group-header', 'Template found (region header)');
$this
->assertRaw('group-left', 'Template found (region left)');
$this
->assertRaw('group-right', 'Template found (region right)');
$this
->assertRaw('group-footer', 'Template found (region footer)');
$this
->assertRaw('edit-title', 'Title field found');
$this
->assertRaw('edit-submit', 'Submit field found');
$this
->assertRaw('edit-field-tags-und', 'Tags field found');
$this
->assertRaw('edit-log', 'Revision log found');
}