Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / FilterNumericWebTest.php
similarity index 86%
rename from web/core/modules/views_ui/src/Tests/FilterNumericWebTest.php
rename to web/core/modules/views_ui/tests/src/Functional/FilterNumericWebTest.php
index 104d62f54da73f8da14eb8f92b0fbaff712b02e2..8dc568de9bdf2f784b966aa0ded68e39d9433a73 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\views_ui\Tests;
+namespace Drupal\Tests\views_ui\Functional;
 
 use Drupal\Tests\SchemaCheckTestTrait;
 
@@ -24,6 +24,12 @@ class FilterNumericWebTest extends UITestBase {
    * 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'));
@@ -52,13 +58,13 @@ class FilterNumericWebTest extends UITestBase {
     $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');
@@ -75,13 +81,13 @@ class FilterNumericWebTest extends UITestBase {
     $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');
@@ -106,7 +112,7 @@ class FilterNumericWebTest extends UITestBase {
     $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');
   }
 
 }