function ConfigActionsTest::testConfigActions

Tests the application of configuration actions on a node type.

File

core/modules/node/tests/src/Kernel/ConfigActionsTest.php, line 48

Class

ConfigActionsTest
Tests Config Actions.

Namespace

Drupal\Tests\node\Kernel

Code

public function testConfigActions() : void {
  $node_type = $this->createContentType();
  $this->assertTrue($node_type->shouldCreateNewRevision());
  $this->assertSame(NodePreviewMode::Optional, $node_type->getPreviewMode(FALSE));
  $this->assertTrue($node_type->displaySubmitted());
  $this->configActionManager
    ->applyAction('entity_method:node.type:setNewRevision', $node_type->getConfigDependencyName(), FALSE);
  $this->configActionManager
    ->applyAction('entity_method:node.type:setPreviewMode', $node_type->getConfigDependencyName(), NodePreviewMode::Required);
  $this->configActionManager
    ->applyAction('entity_method:node.type:setDisplaySubmitted', $node_type->getConfigDependencyName(), FALSE);
  $node_type = NodeType::load($node_type->id());
  $this->assertFalse($node_type->shouldCreateNewRevision());
  $this->assertSame(NodePreviewMode::Required, $node_type->getPreviewMode(FALSE));
  $this->assertFalse($node_type->displaySubmitted());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.