You are here

public function ConfigTest::testSaveExisting 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::testSaveExisting()
  2. 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 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);
}