diff --git a/src/Tests/LanguageIntegrationTest.php b/src/Tests/LanguageIntegrationTest.php new file mode 100644 index 0000000..6229cf3 --- /dev/null +++ b/src/Tests/LanguageIntegrationTest.php @@ -0,0 +1,70 @@ +drupalLogin($this->adminUser); + + $this->setUpExampleStructure(); + $this->insertExampleContent(); + $this->assertEqual($this->indexItems($this->indexId), 5, '5 items were indexed.'); + + // Make absolutely sure the ::$blocks variable doesn't pass information + // along between tests. + $this->blocks = NULL; + } + + /** + * Tests that a facet works on a page with language prefix. + * + * @see https://www.drupal.org/node/2712557 + */ + public function testLanguageIntegration() { + $facet_id = 'owl'; + $facet_name = 'Owl'; + $this->createFacet($facet_name, $facet_id); + + ConfigurableLanguage::create(['id' => 'xx-lolspeak'])->save(); + + // 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->assertText('item'); + $this->assertText('article'); + $this->clickLink('item'); + + // Check that the language code is still in the url. + $this->assertTrue(strpos($this->getUrl(), 'xx-lolspeak/'), 'Found the language code in the url'); + $this->assertResponse(200); + $this->assertText('item'); + $this->assertText('article'); + } + +}