function ConfigImportUITest::testImportLock
Same name in other branches
- 8.9.x core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testImportLock()
- 10 core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testImportLock()
- 11.x core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testImportLock()
Tests concurrent importing of configuration.
File
-
core/
modules/ config/ tests/ src/ Functional/ ConfigImportUITest.php, line 240
Class
- ConfigImportUITest
- Tests the user interface for importing configuration.
Namespace
Drupal\Tests\config\FunctionalCode
public function testImportLock() {
// Create updated configuration object.
$new_site_name = 'Config import test ' . $this->randomString();
$this->prepareSiteNameUpdate($new_site_name);
// Verify that there are configuration differences to import.
$this->drupalGet('admin/config/development/configuration');
$this->assertSession()
->pageTextNotContains('The staged configuration is identical to the active configuration.');
// Acquire a fake-lock on the import mechanism.
$config_importer = $this->configImporter();
$this->container
->get('lock.persistent')
->acquire($config_importer::LOCK_NAME);
// Attempt to import configuration and verify that an error message appears.
$this->submitForm([], 'Import all');
$this->assertSession()
->pageTextContains('Another request may be synchronizing configuration already.');
// Release the lock, just to keep testing sane.
$this->container
->get('lock.persistent')
->release($config_importer::LOCK_NAME);
// Verify site name has not changed.
$this->assertNotEquals($this->config('system.site')
->get('name'), $new_site_name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.