diff --git a/src/Tests/LanguageIntegrationTest.php b/src/Tests/LanguageIntegrationTest.php new file mode 100644 index 0000000..8aa98b6 --- /dev/null +++ b/src/Tests/LanguageIntegrationTest.php @@ -0,0 +1,73 @@ +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); + + // Create an extra language. + ConfigurableLanguage::create(array('id' => 'xx-lolspeak', 'label' => 'Lolspeak'))->save(); + + $this->drupalGet('search-api-test-fulltext'); + $this->assertLink('item'); + $this->assertLink('article'); + + $this->drupalGet('xx-lolspeak/search-api-test-fulltext'); + + $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'); + } + +}