You are here

public function SimplesitemapTest::testMaxLinksSetting 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::testMaxLinksSetting()
  2. 4.x tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testMaxLinksSetting()

Test max links setting and the sitemap index.

File

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

Class

SimplesitemapTest
Tests Simple XML sitemap functional integration.

Namespace

Drupal\Tests\simple_sitemap\Functional

Code

public function testMaxLinksSetting() {
  $this->generator
    ->setBundleSettings('node', 'page')
    ->saveSetting('max_links', 1)
    ->removeCustomLinks()
    ->generateSitemap('nobatch');
  $this
    ->drupalGet('sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('sitemaps/1/sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('sitemaps/2/sitemap.xml');
  $this
    ->drupalGet('sitemaps/1/sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('node/' . $this->node
    ->id());
  $this
    ->assertSession()
    ->responseContains('0.5');
  $this
    ->assertSession()
    ->responseNotContains('node/' . $this->node2
    ->id());
  $this
    ->drupalGet('sitemaps/2/sitemap.xml');
  $this
    ->assertSession()
    ->responseContains('node/' . $this->node2
    ->id());
  $this
    ->assertSession()
    ->responseContains('0.5');
  $this
    ->assertSession()
    ->responseNotContains('node/' . $this->node
    ->id());
}