function ConfigTest::testNestedClear

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testNestedClear()
  2. 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testNestedClear()
  3. 11.x 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 325

Class

ConfigTest
Tests the Config.

Namespace

Drupal\Tests\Core\Config

Code

public function testNestedClear($data) : void {
    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));
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.