<?php
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
use Drupal\Tests\SchemaCheckTestTrait;
* Tests the filter numeric UI.
*/
public function testFilterNumericUI() {
+ // Add a page display to the test_view to be able to test the filtering.
+ $path = 'test_view-path';
+ $this->drupalPostForm('admin/structure/views/view/test_view/edit', [], 'Add Page');
+ $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', ['path' => $path], 'Apply');
+ $this->drupalPostForm(NULL, [], t('Save'));
+
$this->drupalPostForm('admin/structure/views/nojs/add-handler/test_view/default/filter', ['name[views_test_data.age]' => TRUE], t('Add and configure @handler', ['@handler' => t('filter criteria')]));
$this->drupalPostForm(NULL, [], t('Expose filter'));
$this->assertConfigSchemaByName('views.view.test_view');
// Test that the exposed filter works as expected.
- $this->drupalPostForm(NULL, [], t('Update preview'));
+ $this->drupalGet('test_view-path');
$this->assertText('John');
$this->assertText('Paul');
$this->assertText('Ringo');
$this->assertText('George');
$this->assertText('Meredith');
- $this->drupalPostForm(NULL, ['age' => '2'], t('Update preview'));
+ $this->drupalPostForm(NULL, ['age' => '2'], 'Apply');
$this->assertText('John');
$this->assertText('Paul');
$this->assertNoText('Ringo');
$this->assertConfigSchemaByName('views.view.test_view');
// Test that the filter works as expected.
- $this->drupalPostForm(NULL, [], t('Update preview'));
+ $this->drupalGet('test_view-path');
$this->assertText('John');
$this->assertNoText('Paul');
$this->assertNoText('Ringo');
$this->assertNoText('George');
$this->assertNoText('Meredith');
- $this->drupalPostForm(NULL, ['age' => '26'], t('Update preview'));
+ $this->drupalPostForm(NULL, ['age' => '26'], t('Apply'));
$this->assertNoText('John');
$this->assertText('Paul');
$this->assertNoText('Ringo');
$this->assertRaw('<label for="edit-age-max">And</label>', 'Max field label found');
$this->assertRaw('<label for="edit-age-min">Age between</label>', 'Min field label found');
// Check that the description is shown in the right place.
- $this->assertEqual(trim($this->cssSelect('.form-item-age-min .description')[0]), 'Description of the exposed filter');
+ $this->assertEqual(trim($this->cssSelect('.form-item-age-min .description')[0]->getText()), 'Description of the exposed filter');
}
}