You are here

public function SearchDateIntervalTest::testDateIntervalQueryAlter in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/tests/src/Functional/SearchDateIntervalTest.php \Drupal\Tests\search\Functional\SearchDateIntervalTest::testDateIntervalQueryAlter()
  2. 10 core/modules/search/tests/src/Functional/SearchDateIntervalTest.php \Drupal\Tests\search\Functional\SearchDateIntervalTest::testDateIntervalQueryAlter()

Tests searching with date filters that exclude some translations.

File

core/modules/search/tests/src/Functional/SearchDateIntervalTest.php, line 82

Class

SearchDateIntervalTest
Tests searching with date filters that exclude some translations.

Namespace

Drupal\Tests\search\Functional

Code

public function testDateIntervalQueryAlter() {

  // Search for keyword node.
  $edit = [
    'keys' => 'node',
  ];
  $this
    ->drupalGet('search/node');
  $this
    ->submitForm($edit, 'Search');

  // The nodes must have the same node ID but the created date is different.
  // So only the Spanish translation must appear.
  $this
    ->assertSession()
    ->linkExists('Node ES', 0, 'Spanish translation found in search results');
  $this
    ->assertSession()
    ->linkNotExists('Node EN', 'Search results do not contain English node');
}