public function XmlSitemapMultilingualTest::testFrontpageLink in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapMultilingualTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapMultilingualTest::testFrontpageLink()
Tests the frontpage link for multiple languages.
File
- tests/
src/ Functional/ XmlSitemapMultilingualTest.php, line 35
Class
- XmlSitemapMultilingualTest
- Tests the generation of multilingual sitemaps.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
public function testFrontpageLink() {
$this
->regenerateSitemap();
// Check that the frontpage link is correct for default and non-default
// languages. The link ends with a slash.
$frontpage_link = Url::fromRoute('<front>', [], [
'absolute' => TRUE,
])
->toString();
$this
->drupalGet('sitemap.xml');
$this
->assertSession()
->responseContains($frontpage_link, "English frontpage link found in the sitemap.");
$this
->drupalGet('fr/sitemap.xml');
$this
->assertSession()
->responseContains($frontpage_link . 'fr', "French frontpage link found in the sitemap.");
}