function ConfigCase::testConfigExportImport

8.0.x configTest.php ConfigCase::testConfigExportImport()
7.x configTest.php ConfigCase::testConfigExportImport()
master configTest.php ConfigCase::testConfigExportImport()

File

tests/configTest.php, line 44

Namespace

Unish

Class

ConfigCase
Tests for Configuration Management commands for D8+. @group commands

Code

function testConfigExportImport() {
  $options = $this->options();
  // Get path to staging dir.
  $this->drush('core-status', array(), $options + array('format' => 'json'));
  $staging = $this->webroot() . '/' . $this->getOutputFromJSON('config-staging');
  $system_site_yml = $staging . '/system.site.yml';

  // Test export
  $this->drush('config-export', array(), $options);
  $this->assertFileExists($system_site_yml);

  // Test import by finish the round trip.
  $contents = file_get_contents($system_site_yml);
  $contents = str_replace('front: user', 'front: unish', $contents);
  $contents = file_put_contents($system_site_yml, $contents);
  $this->drush('config-import', array(), $options);
  $this->drush('config-get', array('system.site', 'page'), $options + array('format' => 'json'));
  $page = $this->getOutputFromJSON('system.site:page');
  $this->assertContains('unish', $page->front, 'Config was successfully imported.');
}