Projet

Général

Profil

Paste
Télécharger (1,93 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ds / tests / ds.forms.test @ bf6fb0ee

1
<?php
2

    
3
/**
4
 * @file
5
 * Form layout tests.
6
 */
7

    
8
class dsFormTests extends dsBaseTest {
9

    
10
  /**
11
   * Implements getInfo().
12
   */
13
  public static function getInfo() {
14
    return array(
15
      'name' => t('Forms'),
16
      'description' => t('Tests for managing layouts on forms.'),
17
      'group' => t('Display Suite'),
18
    );
19
  }
20

    
21
  /**
22
   * Forms tests.
23
   */
24
  function testDSForms() {
25

    
26
    // Create a node.
27
    $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => FALSE));
28

    
29
    // Configure teaser layout.
30
    $form = array(
31
      'additional_settings[layout]' => 'ds_2col_stacked',
32
    );
33
    $form_assert = array(
34
      'regions' => array(
35
        'header' => '<td colspan="8">' . t('Header') . '</td>',
36
        'left' => '<td colspan="8">' . t('Left') . '</td>',
37
        'right' => '<td colspan="8">' . t('Right') . '</td>',
38
        'footer' => '<td colspan="8">' . t('Footer') . '</td>',
39
      ),
40
    );
41
    $this->dsSelectLayout($form, $form_assert, 'admin/structure/types/manage/article/fields');
42

    
43
    $fields = array(
44
      'fields[title][region]' => 'header',
45
      'fields[body][region]' => 'left',
46
      'fields[field_image][region]' => 'right',
47
      'fields[field_tags][region]' => 'right',
48
    );
49
    $this->dsConfigureUI($fields, 'admin/structure/types/manage/article/fields');
50

    
51
    // Inspect the node.
52
    $this->drupalGet('node/' . $node->nid . '/edit');
53
    $this->assertRaw('ds_2col_stacked', 'ds-form class added');
54
    $this->assertRaw('group-header', 'Template found (region header)');
55
    $this->assertRaw('group-left', 'Template found (region left)');
56
    $this->assertRaw('group-right', 'Template found (region right)');
57
    $this->assertRaw('group-footer', 'Template found (region footer)');
58
    $this->assertRaw('edit-title', 'Title field found');
59
    $this->assertRaw('edit-submit', 'Submit field found');
60
    $this->assertRaw('edit-field-tags-und', 'Tags field found');
61
    $this->assertRaw('edit-log', 'Revision log found');
62
  }
63
}