You are here

function KernelTestBaseTest::testInstallConfig in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/Tests/KernelTestBaseTest.php \Drupal\simpletest\Tests\KernelTestBaseTest::testInstallConfig()

Tests expected behavior of installConfig().

File

core/modules/simpletest/src/Tests/KernelTestBaseTest.php, line 217
Contains \Drupal\simpletest\Tests\KernelTestBaseTest.

Class

KernelTestBaseTest
Tests KernelTestBase functionality.

Namespace

Drupal\simpletest\Tests

Code

function testInstallConfig() {

  // The user module has configuration that depends on system.
  $this
    ->enableModules(array(
    'system',
  ));
  $module = 'user';

  // Verify that default config can only be installed for enabled modules.
  try {
    $this
      ->installConfig(array(
      $module,
    ));
    $this
      ->fail('Exception for non-enabled module found.');
  } catch (\Exception $e) {
    $this
      ->pass('Exception for non-enabled module found.');
  }
  $this
    ->assertFalse($this->container
    ->get('config.storage')
    ->exists('user.settings'));

  // Verify that default config can be installed.
  $this
    ->enableModules(array(
    'user',
  ));
  $this
    ->installConfig(array(
    'user',
  ));
  $this
    ->assertTrue($this->container
    ->get('config.storage')
    ->exists('user.settings'));
  $this
    ->assertTrue($this
    ->config('user.settings')
    ->get('register'));
}