public function SimplesitemapTest::testHrefLangRemoval in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testHrefLangRemoval()
Test the removal of hreflang tags in HTML.
File
- tests/
src/ Functional/ SimplesitemapTest.php, line 662
Class
- SimplesitemapTest
- Tests Simple XML Sitemap functional integration.
Namespace
Drupal\Tests\simple_sitemap\FunctionalCode
public function testHrefLangRemoval() {
// Test the nodes markup contains hreflang with default settings.
$this->generator
->saveSetting('disable_language_hreflang', FALSE);
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertNotEmpty($this
->xpath("//link[@hreflang]"));
Cache::invalidateTags($this->node
->getCacheTags());
// Test the hreflang markup gets removed.
$this->generator
->saveSetting('disable_language_hreflang', TRUE);
$this
->drupalGet('node/' . $this->node
->id());
$this
->assertEmpty($this
->xpath("//link[@hreflang]"));
}