You are here

public function XmlSitemapRebuildTest::testSimpleRebuild in XML sitemap 2.x

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

Test sitemap rebuild process.

File

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

Class

XmlSitemapRebuildTest
Tests the rebuild process of sitemaps.

Namespace

Drupal\Tests\xmlsitemap\Functional

Code

public function testSimpleRebuild() {
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet('admin/config/search/xmlsitemap/rebuild');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains("This action rebuilds your site's XML sitemap and regenerates the cached files, and may be a lengthy process. If you just installed XML sitemap, this can be helpful to import all your site's content into the sitemap. Otherwise, this should only be used in emergencies.");
  $this
    ->drupalPostForm(NULL, [], 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('The sitemap links were rebuilt.');
}