You are here

public function LanguageIntegrationTest::testLanguageIntegration in Facets 8

Tests that a facet works on a page with language prefix.

See also

https://www.drupal.org/node/2712557

File

tests/src/Functional/LanguageIntegrationTest.php, line 73

Class

LanguageIntegrationTest
Tests the integration with the language module.

Namespace

Drupal\Tests\facets\Functional

Code

public function testLanguageIntegration() {
  $facet_id = 'owl';
  $facet_name = 'Owl';
  $this
    ->createFacet($facet_name, $facet_id);

  // Go to the search view with a language prefix and click on one of the
  // facets.
  $this
    ->drupalGet('xx-lolspeak/search-api-test-fulltext');
  $this
    ->assertSession()
    ->pageTextContains('item');
  $this
    ->assertSession()
    ->pageTextContains('article');
  $this
    ->clickLink('item');

  // Check that the language code is still in the url.
  $this
    ->assertNotFalse(strpos($this
    ->getUrl(), 'xx-lolspeak/'), 'Found the language code in the url');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('item');
  $this
    ->assertSession()
    ->pageTextContains('article');
}