public function SimplesitemapTest::testLocking in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 tests/src/Functional/SimplesitemapTest.php \Drupal\Tests\simple_sitemap\Functional\SimplesitemapTest::testLocking()
Tests locks
File
- tests/
src/ Functional/ SimplesitemapTest.php, line 92
Class
- SimplesitemapTest
- Tests Simple XML Sitemap functional integration.
Namespace
Drupal\Tests\simple_sitemap\FunctionalCode
public function testLocking() {
$this->generator
->customLinkManager()
->remove()
->add('/node/' . $this->node
->id());
$this->generator
->generateSitemap(QueueWorker::GENERATE_TYPE_BACKEND);
$this
->drupalLogin($this
->createUser([
'administer sitemap settings',
]));
$this
->drupalGet('/admin/config/search/simplesitemap/settings');
$this
->submitForm([
'simple_sitemap_regenerate_now' => TRUE,
], 'Save configuration');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
$this
->assertSession()
->pageTextNotContains('Unable to acquire a lock for sitemap generation.');
\Drupal::lock()
->acquire(QueueWorker::LOCK_ID);
$this
->submitForm([
'simple_sitemap_regenerate_now' => TRUE,
], 'Save configuration');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
$this
->assertSession()
->pageTextContainsOnce('Unable to acquire a lock for sitemap generation.');
}