You are here

protected function ConfigHandlerTest::tearDown in Update helper 8

Overrides KernelTestBase::tearDown

File

tests/src/Kernel/ConfigHandlerTest.php, line 92

Class

ConfigHandlerTest
Automated tests for ConfigName class.

Namespace

Drupal\Tests\update_helper\Kernel

Code

protected function tearDown() {
  $moduleHandler = \Drupal::service('module_handler');
  $dirName = $moduleHandler
    ->getModule('node')
    ->getPath() . '/config/update';
  $fileName = 'update_helper__node_test.yml';
  if (is_file($dirName . '/' . $fileName)) {
    unlink($dirName . '/' . $fileName);
  }
  if (is_dir($dirName)) {
    rmdir($dirName);
  }

  /** @var \Drupal\Core\Config\FileStorage $extensionStorage */
  $extensionStorage = \Drupal::service('config_update.extension_storage');
  $configFilePath = $extensionStorage
    ->getFilePath('field.storage.node.body');
  $this
    ->assertEqual(TRUE, copy($this->configFileBackup, $configFilePath));
  unlink($this->configFileBackup);
  parent::tearDown();
}