diff --git a/core/modules/views/src/Tests/Handler/HandlerTestBase.php b/core/modules/views/src/Tests/Handler/HandlerTestBase.php index c2afcbc..1603329 100644 --- a/core/modules/views/src/Tests/Handler/HandlerTestBase.php +++ b/core/modules/views/src/Tests/Handler/HandlerTestBase.php @@ -1,13 +1,13 @@ drupalPostForm(NULL, [], t('Save')); $this->drupalGet($path); - $this->drupalPostForm(NULL, [], t('Apply')); + $this->drupalPostForm(NULL, [], 'Apply'); $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 4); - $this->drupalPostForm(NULL, ['created' => '1'], t('Apply')); + $this->drupalPostForm(NULL, ['created' => '1'], 'Apply'); $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 1); $this->assertEqual($results[0]->getText(), $this->nodes[3]->id()); - $this->drupalPostForm(NULL, ['created' => '2'], t('Apply')); + $this->drupalPostForm(NULL, ['created' => '2'], 'Apply'); $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 1); $this->assertEqual($results[0]->getText(), $this->nodes[3]->id()); - $this->drupalPostForm(NULL, ['created' => '3'], t('Apply')); + $this->drupalPostForm(NULL, ['created' => '3'], 'Apply'); $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 1); $this->assertEqual($results[0]->getText(), $this->nodes[1]->id()); @@ -259,7 +260,7 @@ protected function _testFilterDateUI() { $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 1); $this->assertEqual($results[0]->getText(), $this->nodes[3]->id()); - $this->drupalPostForm(NULL, ['created' => format_date(250000, 'custom', 'Y-m-d H:i:s')], t('Apply')); + $this->drupalPostForm(NULL, ['created' => format_date(250000, 'custom', 'Y-m-d H:i:s')], 'Apply'); $results = $this->cssSelect('.view-content .field-content'); $this->assertEqual(count($results), 2); $this->assertEqual($results[0]->getText(), $this->nodes[2]->id()); diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php b/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php index 77f5754..1a37ce8 100644 --- a/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php +++ b/core/modules/views/tests/src/Functional/Handler/HandlerAllTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Functional\Handler; use Drupal\comment\Tests\CommentTestTrait; +use Drupal\Tests\views\Functional\ViewTestBase; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\HandlerBase; use Drupal\views\Plugin\views\filter\InOperator; @@ -13,7 +14,7 @@ * * @group views */ -class HandlerAllTest extends HandlerTestBase { +class HandlerAllTest extends ViewTestBase { use CommentTestTrait; diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php index eed5773..2b4f59c 100644 --- a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php +++ b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Functional\Handler; use Drupal\comment\Tests\CommentTestTrait; +use Drupal\Tests\views\Functional\ViewTestBase; use Drupal\views\Entity\View; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\HandlerBase; @@ -13,7 +14,7 @@ * * @group views */ -class HandlerTest extends HandlerTestBase { +class HandlerTest extends ViewTestBase { use CommentTestTrait; @@ -259,8 +260,7 @@ public function testRelationshipUI() { $this->assertFieldByName($relationship_name); // Check for available options. - $xpath = $this->buildXPathQuery('//textarea[@name=:value]|//input[@name=:value]|//select[@name=:value]', [':value' => $relationship_name]); - $fields = $this->xpath($xpath); + $fields = $this->getSession()->getPage()->findAll('named', ['field', $relationship_name]); $options = []; foreach ($fields as $field) { $items = $field->findAll('css', 'option'); diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerTestBase.php b/core/modules/views/tests/src/Functional/Handler/HandlerTestBase.php deleted file mode 100644 index e4a7736..0000000 --- a/core/modules/views/tests/src/Functional/Handler/HandlerTestBase.php +++ /dev/null @@ -1,12 +0,0 @@ -cssSelect('link[href="' . Url::fromRoute('view.' . $view2['id'] . '.feed_1', [], ['absolute' => TRUE])->toString() . '"]'); $this->assertEqual(count($elements), 1, 'Feed found.'); $this->drupalGet($view2['page[feed_properties][path]']); - $this->assertEmpty($this->cssSelect('rss[version="2.0"]')); + // Because the response is XML we can't use the page which depends on an + // HTML tag being present. + $this->assertEquals('2.0', $this->getSession()->getDriver()->getAttribute('//rss', 'version')); // The feed should have the same title and nodes as the page. $this->assertText($view2['page[title]']); $this->assertRaw($node1->url('canonical', ['absolute' => TRUE])); diff --git a/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php b/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php index 99f7b8a..3232ecb 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php @@ -157,9 +157,6 @@ public function testReadMore() { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = $this->container->get('renderer'); - if (!isset($this->options['validate']['type'])) { - return; - } $expected_more_text = 'custom more text'; $view = Views::getView('test_display_more'); @@ -169,7 +166,7 @@ public function testReadMore() { $output = $renderer->renderRoot($output); $this->setRawContent($output); - $result = $this->xpath('//a[@class=:class]', [':class' => 'more-link']); + $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']); $this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.'); $this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.'); @@ -178,7 +175,7 @@ public function testReadMore() { $more_link = $view->display_handler->renderMoreLink(); $more_link = $renderer->renderRoot($more_link); $this->setRawContent($more_link); - $result = $this->xpath('//a[@class=:class]', [':class' => 'more-link']); + $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']); $this->assertEqual($result[0]->attributes()->href, \Drupal::url('view.test_display_more.page_1'), 'The right more link is shown.'); $this->assertEqual(trim($result[0][0]), $expected_more_text, 'The right link text is shown.'); @@ -194,7 +191,7 @@ public function testReadMore() { $output = $view->preview(); $output = $renderer->renderRoot($output); $this->setRawContent($output); - $result = $this->xpath('//a[@class=:class]', [':class' => 'more-link']); + $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']); $this->assertTrue(empty($result), 'The more link is not shown.'); $view = Views::getView('test_display_more'); @@ -212,7 +209,7 @@ public function testReadMore() { $output = $view->preview(); $output = $renderer->renderRoot($output); $this->setRawContent($output); - $result = $this->xpath('//a[@class=:class]', [':class' => 'more-link']); + $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']); $this->assertTrue(empty($result), 'The more link is not shown when view has more records.'); // Test the default value of use_more_always.