You are here

public function FieldWebTest::testClickSortingDistinct in Drupal 10

Same name and namespace in other branches
  1. 9 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 105

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());
}