You are here

public function SimplesitemapTest::testBaseUrlSetting in Simple XML sitemap 8.2

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

Test setting the base URL.

File

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

Class

SimplesitemapTest
Tests Simple XML sitemap functional integration.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

public function testBaseUrlSetting() {
  $this->generator
    ->setBundleSettings('node', 'page')
    ->saveSetting('base_url', 'http://base_url_test')
    ->generateSitemap('nobatch');
  $this
    ->drupalGet('sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('http://base_url_test');

  // Set base URL in the sitemap index.
  $this->generator
    ->saveSetting('max_links', 1)
    ->generateSitemap('nobatch');
  $this
    ->drupalGet('sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('http://base_url_test/sitemaps/1/sitemap.xml');
}