public function CdnDefaultSettingsUpdateTest::testDefaultSettingsAreUpdated in CDN 8.3
Tests default settings can be detected, and are updated.
It's possible to automatically update the settings as long as the only thing that's modified by the end user is the 'domain' (NULL by default).
File
- tests/
src/ Functional/ Update/ CdnDefaultSettingsUpdateTest.php, line 34
Class
- CdnDefaultSettingsUpdateTest
- Tests that existing sites are updated to the new defaults unless customized.
Namespace
Drupal\Tests\cdn\Functional\UpdateCode
public function testDefaultSettingsAreUpdated() {
$expected_original_mapping = [
'type' => 'simple',
'domain' => 'cdn.example.com',
'conditions' => [],
];
$expected_updated_mapping = [
'type' => 'simple',
'domain' => 'cdn.example.com',
'conditions' => [
'not' => [
'extensions' => [
'css',
'js',
],
],
],
];
// Make sure we have the expected values before the update.
$cdn_settings = $this
->config('cdn.settings');
$this
->assertSame($expected_original_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_updated_mapping, $cdn_settings
->get('mapping'));
}