You are here

public function ConfigTest::testSaveNew 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::testSaveNew()
  2. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSaveNew()

@covers ::save @dataProvider nestedDataProvider

File

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

Class

ConfigTest
Tests the Config.

Namespace

Drupal\Tests\Core\Config

Code

public function testSaveNew($data) {
  $this->cacheTagsInvalidator
    ->expects($this
    ->never())
    ->method('invalidateTags');

  // Set initial data.
  $this->config
    ->setData($data);

  // Check that original data has not been set yet.
  foreach ($data as $key => $value) {
    $this
      ->assertNull($this->config
      ->getOriginal($key, FALSE));
  }

  // Save so that the original data is set.
  $config = $this->config
    ->save();

  // Check that returned $config is instance of Config.
  $this
    ->assertInstanceOf('\\Drupal\\Core\\Config\\Config', $config);

  // Check that the original data it saved.
  $this
    ->assertOriginalConfigDataEquals($data, TRUE);
}