You are here

protected function ConfigInstallerTestBase::setUp in Configuration installer 8

Overrides InstallerTestBase::setUp

2 calls to ConfigInstallerTestBase::setUp()
ConfigInstallerFrDirectorySyncTest::setUp in tests/src/Functional/ConfigInstallerFrDirectorySyncTest.php
ConfigInstallerSyncTest::setUp in tests/src/Functional/ConfigInstallerSyncTest.php
2 methods override ConfigInstallerTestBase::setUp()
ConfigInstallerFrDirectorySyncTest::setUp in tests/src/Functional/ConfigInstallerFrDirectorySyncTest.php
ConfigInstallerSyncTest::setUp in tests/src/Functional/ConfigInstallerSyncTest.php

File

tests/src/Functional/ConfigInstallerTestBase.php, line 29

Class

ConfigInstallerTestBase
Provides functionality for testing the config_installer profile.

Namespace

Drupal\Tests\config_installer\Functional

Code

protected function setUp() {
  parent::setUp();

  // Drupal is installed perform some basic assertions that all
  // config_installer tests need.
  if ($this->isInstalled) {

    // Ensure the test environment has the latest container.
    $this
      ->rebuildAll();
    $sync = \Drupal::service('config.storage.sync');
    $sync_core_extension = $sync
      ->read('core.extension');

    // Ensure that the correct install profile is active.
    if (version_compare(\Drupal::VERSION, '8.3', '>=')) {
      $this
        ->assertEqual($sync_core_extension['profile'], \Drupal::installProfile());
    }
    else {
      $listing = new ExtensionDiscovery(\Drupal::root());
      $listing
        ->setProfileDirectories([]);
      $profiles = array_intersect_key($listing
        ->scan('profile'), $sync_core_extension['module']);
      $current_profile = Settings::get('install_profile');
      $this
        ->assertFalse(empty($current_profile), 'The $install_profile setting exists');
      $this
        ->assertEqual($current_profile, key($profiles));
    }

    // Ensure that the configuration has been completely synced.
    $this
      ->assertNoSynDifferences();
  }
}