ds.forms.test 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file
  4. * Form layout tests.
  5. */
  6. class dsFormTests extends dsBaseTest {
  7. /**
  8. * Implements getInfo().
  9. */
  10. public static function getInfo() {
  11. return array(
  12. 'name' => t('Forms'),
  13. 'description' => t('Tests for managing layouts on forms.'),
  14. 'group' => t('Display Suite'),
  15. );
  16. }
  17. /**
  18. * Forms tests.
  19. */
  20. function testDSForms() {
  21. // Create a node.
  22. $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => FALSE));
  23. // Configure teaser layout.
  24. $form = array(
  25. 'additional_settings[layout]' => 'ds_2col_stacked',
  26. );
  27. $form_assert = array(
  28. 'regions' => array(
  29. 'header' => '<td colspan="8">' . t('Header') . '</td>',
  30. 'left' => '<td colspan="8">' . t('Left') . '</td>',
  31. 'right' => '<td colspan="8">' . t('Right') . '</td>',
  32. 'footer' => '<td colspan="8">' . t('Footer') . '</td>',
  33. ),
  34. );
  35. $this->dsSelectLayout($form, $form_assert, 'admin/structure/types/manage/article/fields');
  36. $fields = array(
  37. 'fields[title][region]' => 'header',
  38. 'fields[body][region]' => 'left',
  39. 'fields[field_image][region]' => 'right',
  40. 'fields[field_tags][region]' => 'right',
  41. );
  42. $this->dsConfigureUI($fields, 'admin/structure/types/manage/article/fields');
  43. // Inspect the node.
  44. $this->drupalGet('node/' . $node->nid . '/edit');
  45. $this->assertRaw('ds_2col_stacked', 'ds-form class added');
  46. $this->assertRaw('group-header', 'Template found (region header)');
  47. $this->assertRaw('group-left', 'Template found (region left)');
  48. $this->assertRaw('group-right', 'Template found (region right)');
  49. $this->assertRaw('group-footer', 'Template found (region footer)');
  50. $this->assertRaw('edit-title', 'Title field found');
  51. $this->assertRaw('edit-submit', 'Submit field found');
  52. $this->assertRaw('edit-field-tags-und', 'Tags field found');
  53. $this->assertRaw('edit-log', 'Revision log found');
  54. }
  55. }