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. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSaveExisting()
  3. 11.x 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 156

Class

ConfigTest
Tests the Config.

Namespace

Drupal\Tests\Core\Config

Code

public function testSaveExisting($data) {
    $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.