You are here

protected function FixtureBase::config in Lightning Core 8.5

Same name and namespace in other branches
  1. 8.3 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::config()
  2. 8.4 tests/src/FixtureBase.php \Drupal\Tests\lightning_core\FixtureBase::config()

Returns a config object and caches its data for automatic restoration.

Parameters

string $id: The name of the config object to return.

Return value

\Drupal\Core\Config\Config The editable config object.

See also

::tearDown()

File

tests/src/FixtureBase.php, line 124

Class

FixtureBase
Base class for contexts which set up and tear down a complete test fixture.

Namespace

Drupal\Tests\lightning_core

Code

protected function config($id) {

  /** @var \Drupal\Core\Config\Config $config */
  $config = $this->container
    ->get('config.factory')
    ->getEditable($id);
  if (empty($this->config[$id])) {
    $this->config[$id] = $config
      ->getRawData();
  }
  return $config;
}