public function SearchResultsTest::testSynonyms in Google Search Appliance 8
Tests synonyms.
File
- tests/
src/ Functional/ SearchResultsTest.php, line 123  
Class
- SearchResultsTest
 - Tests search results are output.
 
Namespace
Drupal\Tests\google_appliance\FunctionalCode
public function testSynonyms() {
  // Submit the search specified in $file_spec via URL (form submission already tested)
  $this
    ->drupalGet('gsearch/ponies');
  $assert = $this
    ->assertSession();
  // Make sure we get a response, and that it is not an error message.
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextNotContains('No Results');
  $assert
    ->pageTextNotContains('You may also try:');
  // No search for synonyms.
  $this
    ->drupalGet('gsearch/unicorns');
  $assert
    ->statusCodeEquals(200);
  $assert
    ->pageTextContains('You may also try:');
  $assert
    ->linkExists('Donkeys');
  $assert
    ->linkByHrefExists(Url::fromRoute(SearchViewRoute::ROUTE_NAME, [
    'search_query' => 'donkeys',
  ])
    ->toString());
}