You are here

public function SimplesitemapTest::testBaseUrlSetting in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testBaseUrlSetting()
  2. 8.2 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testBaseUrlSetting()

Test setting the base URL.

Throws

\Drupal\Component\Plugin\Exception\PluginException

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/SimplesitemapTest.php, line 351

Class

SimplesitemapTest
Tests Simple XML Sitemap functional integration.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

public function testBaseUrlSetting() {
  $this->generator
    ->entityManager()
    ->setBundleSettings('node', 'page');
  $this->generator
    ->saveSetting('base_url', 'http://base_url_test')
    ->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
  $this
    ->drupalGet($this->defaultSitemapUrl);
  $this
    ->assertSession()
    ->responseContains('http://base_url_test');

  // Set base URL in the sitemap index.
  $this->generator
    ->saveSetting('max_links', 1)
    ->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
  $this
    ->drupalGet($this->defaultSitemapUrl);
  $this
    ->assertSession()
    ->responseContains('http://base_url_test/sitemap.xml?page=1');
}