You are here

public static function UpdatePathTestInstallHelper::addConfigYml in Style Switcher 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/Update/UpdatePathTestInstallHelper.php \Drupal\Tests\styleswitcher\Functional\Update\UpdatePathTestInstallHelper::addConfigYml()

Imports a config from a YAML file.

Parameters

string $name: Config name.

string $filename: Path and name of the YAML file to import.

1 call to UpdatePathTestInstallHelper::addConfigYml()
drupal-8.8.0.styleswitcher.php in tests/fixtures/update/8201/drupal-8.8.0.styleswitcher.php
DB additions for the update path testing of styleswitcher_update_8201().

File

tests/src/Functional/Update/UpdatePathTestInstallHelper.php, line 92

Class

UpdatePathTestInstallHelper
Helps install database additions for a testing of update paths.

Namespace

Drupal\Tests\styleswitcher\Functional\Update

Code

public static function addConfigYml(string $name, string $filename) {
  $config = Yaml::decode(file_get_contents($filename));
  static::getConnection()
    ->insert('config')
    ->fields([
    'collection' => '',
    'name' => $name,
    'data' => serialize($config),
  ])
    ->execute();
}