You are here

public function SearchDateIntervalTest::testDateIntervalQueryAlter in Drupal 8

Same name and namespace in other branches
  1. 9 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
    ->drupalPostForm('search/node', $edit, t('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');
}