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);
}