diff --git a/core/modules/views_ui/src/Tests/FilterNumericWebTest.php b/core/modules/views_ui/src/Tests/FilterNumericWebTest.php index 5c6ab33..89e9782 100644 --- a/core/modules/views_ui/src/Tests/FilterNumericWebTest.php +++ b/core/modules/views_ui/src/Tests/FilterNumericWebTest.php @@ -35,28 +35,56 @@ public function testFilterNumericUI() { $this->drupalPostForm(NULL, array(), t('Grouped filters')); $edit = array(); - $edit['options[group_info][group_items][1][title]'] = 'Published'; - $edit['options[group_info][group_items][1][operator]'] = '='; - $edit['options[group_info][group_items][1][value][value]'] = 1; - $edit['options[group_info][group_items][2][title]'] = 'Not published'; - $edit['options[group_info][group_items][2][operator]'] = '='; - $edit['options[group_info][group_items][2][value][value]'] = 0; - $edit['options[group_info][group_items][3][title]'] = 'Not published2'; + $edit['options[group_info][group_items][1][title]'] = 'Old'; + $edit['options[group_info][group_items][1][operator]'] = '>'; + $edit['options[group_info][group_items][1][value][value]'] = 27; + $edit['options[group_info][group_items][2][title]'] = 'Young'; + $edit['options[group_info][group_items][2][operator]'] = '<='; + $edit['options[group_info][group_items][2][value][value]'] = 27; + $edit['options[group_info][group_items][3][title]'] = 'Not 25'; $edit['options[group_info][group_items][3][operator]'] = '!='; - $edit['options[group_info][group_items][3][value][value]'] = 1; + $edit['options[group_info][group_items][3][value][value]'] = 25; $this->drupalPostForm(NULL, $edit, t('Apply')); $this->drupalPostForm('admin/structure/views/view/test_view', array(), t('Save')); $this->assertConfigSchemaByName('views.view.test_view'); + // Test that the exposed filter works as expected. + $this->drupalPostForm(NULL, array(), t('Update preview')); + $this->assertText('John'); + $this->assertText('Paul'); + $this->assertText('Ringo'); + $this->assertText('George'); + $this->assertText('Meredith'); + $this->drupalPostForm(NULL, array('age' => '2'), t('Update preview')); + $this->assertText('John'); + $this->assertText('Paul'); + $this->assertNoText('Ringo'); + $this->assertText('George'); + $this->assertNoText('Meredith'); + // Change the filter to a single filter to test the schema when the operator // is not exposed. $this->drupalPostForm('admin/structure/views/nojs/handler/test_view/default/filter/age', array(), t('Single filter')); $edit = array(); - $edit['options[value][value]'] = 12; + $edit['options[value][value]'] = 25; $this->drupalPostForm(NULL, $edit, t('Apply')); $this->drupalPostForm('admin/structure/views/view/test_view', array(), t('Save')); $this->assertConfigSchemaByName('views.view.test_view'); + + // Test that the filter works as expected. + $this->drupalPostForm(NULL, array(), t('Update preview')); + $this->assertText('John'); + $this->assertNoText('Paul'); + $this->assertNoText('Ringo'); + $this->assertNoText('George'); + $this->assertNoText('Meredith'); + $this->drupalPostForm(NULL, array('age' => '26'), t('Update preview')); + $this->assertNoText('John'); + $this->assertText('Paul'); + $this->assertNoText('Ringo'); + $this->assertNoText('George'); + $this->assertNoText('Meredith'); } }