public function SimplesitemapTest::testLastmod in Simple XML sitemap 8.2
Same name and namespace in other branches
- 8.3 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testLastmod()
- 4.x tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testLastmod()
Test the lastmod parameter in different scenarios.
File
- tests/
src/ Functional/ SimplesitemapTest.php, line 177
Class
- SimplesitemapTest
- Tests Simple XML sitemap functional integration.
Namespace
Drupal\Tests\simple_sitemap\FunctionalCode
public function testLastmod() {
// Entity links should have 'lastmod'.
$this->generator
->setBundleSettings('node', 'page')
->removeCustomLinks()
->generateSitemap('nobatch');
$this
->drupalGet('sitemap.xml');
$this
->assertSession()
->responseContains('lastmod');
// Entity custom links should have 'lastmod'.
$this->generator
->setBundleSettings('node', 'page', [
'index' => FALSE,
])
->addCustomLink('/node/' . $this->node
->id())
->generateSitemap('nobatch');
$this
->drupalGet('sitemap.xml');
$this
->assertSession()
->responseContains('lastmod');
// Non-entity custom links should not have 'lastmod'.
$this->generator
->removeCustomLinks()
->addCustomLink('/')
->generateSitemap('nobatch');
$this
->drupalGet('sitemap.xml');
$this
->assertSession()
->responseNotContains('lastmod');
}