You are here

public function ConfigTest::testNestedClear in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testNestedClear()
  2. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testNestedClear()

@covers ::clear @dataProvider nestedDataProvider

File

core/tests/Drupal/Tests/Core/Config/ConfigTest.php, line 318

Class

ConfigTest
Tests the Config.

Namespace

Drupal\Tests\Core\Config

Code

public function testNestedClear($data) {
  foreach ($data as $key => $value) {

    // Check that values are cleared.
    $this->config
      ->set($key, $value);

    // Check each nested value.
    foreach ($value as $nested_key => $nested_value) {
      $full_nested_key = $key . '.' . $nested_key;
      $this
        ->assertEquals($nested_value, $this->config
        ->get($full_nested_key));
      $this->config
        ->clear($full_nested_key);
      $this
        ->assertNull($this->config
        ->get($full_nested_key));
    }
  }
}