You are here

public function XmlSitemapRebuildTest::testUserLinksRebuild in XML sitemap 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/XmlSitemapRebuildTest.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapRebuildTest::testUserLinksRebuild()

Test if user links are included in sitemap after rebuild.

File

tests/src/Functional/XmlSitemapRebuildTest.php, line 54

Class

XmlSitemapRebuildTest
Tests the rebuild process of sitemaps.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

public function testUserLinksRebuild() {
  xmlsitemap_link_bundle_settings_save('user', 'user', [
    'status' => 1,
    'priority' => 0.4,
    'changefreq' => XMLSITEMAP_FREQUENCY_MONTHLY,
  ]);
  $dummy_user = $this
    ->drupalCreateUser([]);
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalPostForm('admin/config/search/xmlsitemap/rebuild', [], t('Save configuration'));
  $this
    ->assertSession()
    ->pageTextContains('The sitemap links were rebuilt.');
  $this
    ->assertSitemapLinkValues('user', $dummy_user
    ->id(), [
    'status' => 1,
    'priority' => 0.4,
    'changefreq' => XMLSITEMAP_FREQUENCY_MONTHLY,
    'access' => 1,
  ]);
  $this
    ->drupalGet('sitemap.xml');
  $this
    ->assertSession()
    ->responseContains("user/{$dummy_user->id()}");
}