function FieldWebTest::testClickSortingDistinct

Same name in other branches
  1. 10 core/modules/views/tests/src/Functional/Handler/FieldWebTest.php \Drupal\Tests\views\Functional\Handler\FieldWebTest::testClickSortingDistinct()
  2. 11.x core/modules/views/tests/src/Functional/Handler/FieldWebTest.php \Drupal\Tests\views\Functional\Handler\FieldWebTest::testClickSortingDistinct()

Tests the default click sorting functionality with distinct.

File

core/modules/views/tests/src/Functional/Handler/FieldWebTest.php, line 108

Class

FieldWebTest
Tests fields from within a UI.

Namespace

Drupal\Tests\views\Functional\Handler

Code

public function testClickSortingDistinct() {
    ConfigurableLanguage::createFromLangcode('es')->save();
    $node = $this->drupalCreateNode();
    $this->drupalGet('test_distinct_click_sorting');
    $this->assertSession()
        ->statusCodeEquals(200);
    // Check that the results are ordered by id in ascending order and that the
    // title click filter is for descending.
    $this->assertSession()
        ->linkByHrefExists(Url::fromRoute('<none>', [], [
        'query' => [
            'order' => 'changed',
            'sort' => 'desc',
        ],
    ])->toString());
    $this->assertSession()
        ->pageTextContains($node->getTitle());
    $this->clickLink('Changed');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->pageTextContains($node->getTitle());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.