You are here

public function StyleswitcherUpdate8201Test::testStyleswitcherUpdate8201 in Style Switcher 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Functional/Update/StyleswitcherUpdate8201Test.php \Drupal\Tests\styleswitcher\Functional\Update\StyleswitcherUpdate8201Test::testStyleswitcherUpdate8201()

Tests the styleswitcher_update_8201().

File

tests/src/Functional/Update/StyleswitcherUpdate8201Test.php, line 36

Class

StyleswitcherUpdate8201Test
Tests the styleswitcher_update_8201().

Namespace

Drupal\Tests\styleswitcher\Functional\Update

Code

public function testStyleswitcherUpdate8201() {

  // Make sure we have the expected values before the update.
  $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();

  // Make sure we have the expected values after the update.
  $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);
  }
}