You are here

public function NodeRevisionDeleteConfigTest::testDeleteContentTypeConfig in Node Revision Delete 8

Tests the NodeRevisionDelete::deleteContentTypeConfig method.

File

tests/src/Kernel/NodeRevisionDeleteConfigTest.php, line 91

Class

NodeRevisionDeleteConfigTest
Test the module configurations related to the node_revision_delete service.

Namespace

Drupal\Tests\node_revision_delete\Kernel

Code

public function testDeleteContentTypeConfig() {
  foreach ($this->testTrackArray as $content_type => $content_type_info) {

    // Getting the config file.
    $config = $this->container
      ->get('config.factory')
      ->getEditable('node.type.' . $content_type);

    // Saving the array to have values in the config.
    $config
      ->set('third_party_settings', $content_type_info)
      ->save();

    // Deleting the configuration for a content type.
    $this->nodeRevisionDelete
      ->deleteContentTypeConfig($content_type);

    // Asserting.
    $this
      ->assertEquals($this->testTrackArray[$content_type], $config
      ->get('third_party_settings'));
  }
}