You are here

public function ConfigActionsTransformTest::testChange in Config Actions 8

@covers ::change

File

tests/src/Unit/ConfigActionsTransformTest.php, line 78

Class

ConfigActionsTransformTest
test the ConfigActionsTransform class

Namespace

Drupal\Tests\config_actions\Unit

Code

public function testChange() {
  $source = Yaml::decode(file_get_contents(dirname(__FILE__) . "/node.type.page.yml"));
  $path = [
    "third_party_settings",
    "workbench_moderation",
    "enabled",
  ];
  $output = ConfigActionsTransform::change($source, $path, FALSE);
  $source['third_party_settings']['workbench_moderation']['enabled'] = FALSE;
  self::assertEquals($source, $output);
  $output = ConfigActionsTransform::change($source, $path, 123);
  $source['third_party_settings']['workbench_moderation']['enabled'] = 123;
  self::assertEquals($source, $output);
  $output = ConfigActionsTransform::change($source, $path, 'test');
  $source['third_party_settings']['workbench_moderation']['enabled'] = 'test';
  self::assertEquals($source, $output);
  $output = ConfigActionsTransform::change($source, $path, [
    'my_key' => 'test',
  ]);
  $source['third_party_settings']['workbench_moderation']['enabled'] = [
    'my_key' => 'test',
  ];
  self::assertEquals($source, $output);
}