StyleswitcherUpdate8201Test.php in Style Switcher 8.2
File
tests/src/Functional/Update/StyleswitcherUpdate8201Test.php
View source
<?php
namespace Drupal\Tests\styleswitcher\Functional\Update;
use Drupal\Core\Serialization\Yaml;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class StyleswitcherUpdate8201Test extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [];
if (floatval(\Drupal::VERSION) >= 8.800000000000001) {
$this->databaseDumpFiles[] = DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz';
}
else {
$this->databaseDumpFiles[] = DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz';
}
$this->databaseDumpFiles[] = __DIR__ . '/../../../fixtures/update/8201/drupal-8.8.0.styleswitcher.php';
}
public function testStyleswitcherUpdate8201() {
$config = $this
->config('styleswitcher.custom_styles');
$this
->assertNull($config
->get('styles'));
$this
->assertNotNull($config
->get('custom/default'));
$config = $this
->config('styleswitcher.styles_settings');
$this
->assertNull($config
->get('settings'));
$this
->assertNotNull($config
->get('seven.custom/default'));
$this
->runUpdates();
$config_names = [
'styleswitcher.custom_styles',
'styleswitcher.styles_settings',
];
foreach ($config_names as $name) {
$actual = $this
->config($name)
->getRawData();
$expected = Yaml::decode(file_get_contents(__DIR__ . '/../../../fixtures/update/8201/' . $name . '.after.yml'));
$this
->assertSame($expected, $actual);
}
}
}