function ConfigTest::testSaveExisting

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSaveExisting()
  2. 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSaveExisting()
  3. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSaveExisting()

@covers ::save @dataProvider nestedDataProvider

File

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

Class

ConfigTest
Tests the Config.

Namespace

Drupal\Tests\Core\Config

Code

public function testSaveExisting($data) : void {
    $this->cacheTagsInvalidator
        ->expects($this->once())
        ->method('invalidateTags')
        ->with([
        'config:config.test',
    ]);
    // Set initial data.
    $this->config
        ->setData($data);
    $this->config
        ->save();
    // Update.
    $new_data = $data;
    $new_data['a']['d'] = 2;
    $this->config
        ->setData($new_data);
    $this->config
        ->save();
    $this->assertOriginalConfigDataEquals($new_data, TRUE);
}

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