You are here

public function ConfigTest::testSaveExisting in Drupal 9

Same name and namespace in other branches
  1. 8 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 155

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);
}