Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/tests/views_exposed_form.test
9 9
 * Tests exposed forms.
10 10
 */
11 11
class ViewsExposedFormTest extends ViewsSqlTest {
12

  
13
  /**
14
   *
15
   */
12 16
  public static function getInfo() {
13 17
    return array(
14 18
      'name' => 'Exposed forms',
......
17 21
    );
18 22
  }
19 23

  
24
  /**
25
   *
26
   */
20 27
  public function setUp() {
21 28
    parent::setUp('views_ui');
22 29
    module_enable(array('views_ui'));
23
    // @TODO Figure out why it's required to clear the cache here.
30
    // @todo Figure out why it's required to clear the cache here.
24 31
    views_module_include('views_default', TRUE);
25 32
    views_get_all_views(TRUE);
26 33
    menu_rebuild();
......
75 82
    $this->drupalGet('test_exposed_remember');
76 83
    $this->assertFieldByName('type', 'page');
77 84

  
78
    // Request the page with an unrelated GET argument, filter should still be set.
85
    // Request the page with an unrelated GET argument, filter should still be
86
    // set.
79 87
    $this->drupalGet('test_exposed_remember', array('query' => array('argument' => 'value')));
80 88
    $this->assertFieldByName('type', 'page');
81 89

  
......
101 109
    // Be sure that the button is called exposed.
102 110
    $this->helperButtonHasLabel('edit-options-expose-button-button', t('Expose filter'));
103 111

  
104
    // The first time the filter UI is displayed, the operator and the
105
    // value forms should be shown.
112
    // The first time the filter UI is displayed, the operator and the value
113
    // forms should be shown.
106 114
    $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists');
107 115
    $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists');
108 116
    $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists');
......
112 120
    $this->drupalPost('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type', $edit, t('Expose filter'));
113 121
    // Check the label of the expose button.
114 122
    $this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide filter'));
115
    // Check the label of the grouped exposed button
123
    // Check the label of the grouped exposed button.
116 124
    $this->helperButtonHasLabel('edit-options-group-button-button', t('Grouped filters'));
117 125

  
118
    // After Expose the filter, Operator and Value should be still here
126
    // After Expose the filter, Operator and Value should be still here.
119 127
    $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists');
120 128
    $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists');
121 129
    $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists');
......
141 149
    $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
142 150
    $this->drupalPost(NULL, array(), t('Grouped filters'));
143 151

  
144
    // After click on 'Grouped Filters' standard operator and value should not be displayed
152
    // After click on 'Grouped Filters' standard operator and value should not
153
    // be displayed.
145 154
    $this->assertNoFieldById('edit-options-operator-in', '', 'Operator In not exists');
146 155
    $this->assertNoFieldById('edit-options-operator-not-in', '', 'Operator Not In not exists');
147 156
    $this->assertNoFieldById('edit-options-value-page', '', 'Checkbox for Page not exists');
148 157
    $this->assertNoFieldById('edit-options-value-article', '', 'Checkbox for Article not exists');
149 158

  
150

  
151 159
    // Check that after click on 'Grouped Filters', a new button is shown to
152 160
    // add more items to the list.
153 161
    $this->helperButtonHasLabel('edit-options-group-info-add-group', t('Add another item'));
154 162

  
155
    // Create a grouped filter
163
    // Create a grouped filter.
156 164
    $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
157 165
    $edit = array();
158 166
    $edit["options[group_info][group_items][1][title]"] = 'Is Article';
......
166 174
    $edit["options[group_info][group_items][3][value][page]"] = TRUE;
167 175
    $this->drupalPost(NULL, $edit, t('Apply'));
168 176

  
169
    // Validate that all the titles are defined for each group
177
    // Validate that all the titles are defined for each group.
170 178
    $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
171 179
    $edit = array();
172 180
    $edit["options[group_info][group_items][1][title]"] = 'Is Article';
173 181
    $edit["options[group_info][group_items][1][value][article]"] = TRUE;
174 182

  
175
    // This should trigger an error
183
    // This should trigger an error.
176 184
    $edit["options[group_info][group_items][2][title]"] = '';
177 185
    $edit["options[group_info][group_items][2][value][page]"] = TRUE;
178 186

  
......
182 190
    $this->drupalPost(NULL, $edit, t('Apply'));
183 191
    $this->assertRaw(t('The title is required if value for this item is defined.'), t('Group items should have a title'));
184 192

  
185
    // Un-Expose the filter
193
    // Un-Expose the filter.
186 194
    $this->drupalGet('admin/structure/views/nojs/config-item/test_exposed_admin_ui/default/filter/type');
187 195
    $this->drupalPost(NULL, array(), t('Hide filter'));
188 196

  
189
    // After Un-Expose the filter, Operator and Value should be shown again
197
    // After Un-Expose the filter, Operator and Value should be shown again.
190 198
    $this->assertFieldById('edit-options-operator-in', '', 'Operator In exists after hide filter');
191 199
    $this->assertFieldById('edit-options-operator-not-in', '', 'Operator Not In exists after hide filter');
192 200
    $this->assertFieldById('edit-options-value-page', '', 'Checkbox for Page exists after hide filter');
......
199 207
    $this->helperButtonHasLabel('edit-options-expose-button-button', t('Hide sort'));
200 208
    $this->assertFieldById('edit-options-expose-label', '', t('Make sure a label field is shown'));
201 209
  }
210

  
202 211
}

Formats disponibles : Unified diff