You are here

public function ConfigIgnoreTest::testConfigIgnored in Config Ignore Keys 8

Verifies that items are ignored correctly.

File

tests/src/Kernel/ConfigIgnoreTest.php, line 106

Class

ConfigIgnoreTest
Class ConfigIgnoreTest.

Namespace

Drupal\Tests\config_ignore_keys\Kernel

Code

public function testConfigIgnored() {
  $content_type = NodeType::load(static::NODE_TYPE_NAME);

  // Change the content type name.
  $content_type
    ->set('name', 'New node type name');
  $content_type
    ->save();
  $this->configImporter
    ->reset();
  $updates = $this->configImporter
    ->getUnprocessedConfiguration('update');
  self::assertEquals(1, count($updates), 'There is 1 configuration item to update.');

  // Import the configuration containing the old content type node.
  $this->configImporter
    ->reset()
    ->import();

  // Load the content type after import.
  $content_type = NodeType::load(static::NODE_TYPE_NAME);

  // Check that the content type name change was not imported.
  self::assertNotEquals($content_type
    ->get('name'), 'Test node type');
}