You are here

public function DefineTest::test in Drupal 7 to 8/9 Module Upgrader 8

File

tests/src/Unit/Plugin/DMU/Fixer/DefineTest.php, line 13

Class

DefineTest
@group DMU.Fixer

Namespace

Drupal\Tests\drupalmoduleupgrader\Unit\Plugin\DMU\Fixer

Code

public function test() {
  $config = [
    'key' => 'foo.settings/baz',
    'value' => 'wambooli',
    'in' => '~/foo.settings.yml',
  ];
  $plugin = new Define($config, uniqid(), []);
  $plugin
    ->setTarget($this->target);
  $plugin
    ->execute();
  $url = $this->dir
    ->getChild('foo.settings.yml')
    ->url();
  $this
    ->assertFileExists($url);
  $expected = <<<END
foo.settings:
  baz: wambooli

END;
  $this
    ->assertEquals($expected, file_get_contents($url));
}