public function CdnDefaultSettingsUpdateTest::testCustomizedSettingsAreIgnored in CDN 8.3
Tests customized settings can be detected, and are ignored.
We consider the CDN mapping settings "customized" as soon as the 'type' or 'conditions' keys are modified.
File
- tests/
src/ Functional/ Update/ CdnDefaultSettingsUpdateTest.php, line 67
Class
- CdnDefaultSettingsUpdateTest
- Tests that existing sites are updated to the new defaults unless customized.
Namespace
Drupal\Tests\cdn\Functional\UpdateCode
public function testCustomizedSettingsAreIgnored() {
// First, customize the settings, like an end user would.
$this
->config('cdn.settings')
->set('mapping.conditions', [
'extensions' => [
'zip',
],
])
->save();
$expected_mapping = [
'type' => 'simple',
'domain' => 'cdn.example.com',
'conditions' => [
'extensions' => [
'zip',
],
],
];
// Make sure we have the expected values before the update.
$cdn_settings = $this
->config('cdn.settings');
$this
->assertSame($expected_mapping, $cdn_settings
->get('mapping'));
$this
->runUpdates();
// Make sure we have the expected values after the update.
$cdn_settings = $this
->config('cdn.settings');
$this
->assertSame($expected_mapping, $cdn_settings
->get('mapping'));
}