You are here

public function MigrateVariablesTest::testVariablesMigration in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Migrate/d7/MigrateVariablesTest.php \Drupal\Tests\styleswitcher\Kernel\Migrate\d7\MigrateVariablesTest::testVariablesMigration()

Tests the variables migration.

File

tests/src/Kernel/Migrate/d7/MigrateVariablesTest.php, line 33

Class

MigrateVariablesTest
Tests migration of Style Switcher variables to configuration objects.

Namespace

Drupal\Tests\styleswitcher\Kernel\Migrate\d7

Code

public function testVariablesMigration() {
  $this
    ->executeMigrations([
    'd7_styleswitcher_settings',
    'd7_styleswitcher_custom_styles',
    'd7_styleswitcher_styles_settings',
  ]);

  // Make sure we have the expected values after the migration.
  $settings = $this
    ->config('styleswitcher.settings');
  $this
    ->assertFalse($settings
    ->get('enable_overlay'));
  $this
    ->assertSame('a_theme_name', $settings
    ->get('7206_theme_default'));
  $config_names = [
    'styleswitcher.custom_styles',
    'styleswitcher.styles_settings',
  ];
  foreach ($config_names as $name) {
    $actual = $this
      ->config($name)
      ->getRawData();
    unset($actual['_core']);
    $expected = Yaml::decode(file_get_contents(__DIR__ . '/../../../../fixtures/migrate/' . $name . '.after.yml'));
    $this
      ->assertSame($expected, $actual);
  }
}