public function SimplesitemapTest::testAddCustomLink in Simple XML sitemap 8.3
Same name and namespace in other branches
- 8.2 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testAddCustomLink()
- 4.x tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testAddCustomLink()
Test custom link.
Throws
\Drupal\Component\Plugin\Exception\PluginException
\Behat\Mink\Exception\ExpectationException
File
- tests/
src/ Functional/ SimplesitemapTest.php, line 40
Class
- SimplesitemapTest
- Tests Simple XML Sitemap functional integration.
Namespace
Drupal\Tests\simple_sitemap\FunctionalCode
public function testAddCustomLink() {
$this->generator
->addCustomLink('/node/' . $this->node
->id(), [
'priority' => 0.2,
'changefreq' => 'monthly',
])
->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
$this
->drupalGet($this->defaultSitemapUrl);
$this
->assertSession()
->responseContains('node/' . $this->node
->id());
$this
->assertSession()
->responseContains('0.2');
$this
->assertSession()
->responseContains('monthly');
$this
->drupalLogin($this->privilegedUser);
$this
->drupalGet('admin/config/search/simplesitemap/custom');
$this
->assertSession()
->pageTextContains('/node/' . $this->node
->id() . ' 0.2 monthly');
$this->generator
->addCustomLink('/node/' . $this->node
->id(), [
'changefreq' => 'yearly',
])
->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
$this
->drupalGet('admin/config/search/simplesitemap/custom');
$this
->assertSession()
->pageTextContains('/node/' . $this->node
->id() . ' yearly');
}