function SearchDateIntervalTest::testDateIntervalQueryAlter

Same name in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchDateIntervalTest.php \Drupal\Tests\search\Functional\SearchDateIntervalTest::testDateIntervalQueryAlter()
  2. 8.9.x core/modules/search/tests/src/Functional/SearchDateIntervalTest.php \Drupal\Tests\search\Functional\SearchDateIntervalTest::testDateIntervalQueryAlter()
  3. 11.x 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 87

Class

SearchDateIntervalTest
Tests searching with date filters that exclude some translations.

Namespace

Drupal\Tests\search\Functional

Code

public function testDateIntervalQueryAlter() : void {
    // 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');
}

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