You are here

protected function ModerationStateAccessTest::createNodeType in Workbench Moderation 8.2

Creates a new node type.

Parameters

string $label: The human-readable label of the type to create.

string $machine_name: The machine name of the type to create.

Return value

NodeType The node type just created.

1 call to ModerationStateAccessTest::createNodeType()
ModerationStateAccessTest::testViewShowsCorrectStates in tests/src/Functional/ModerationStateAccessTest.php
Test the view operation access handler with the view permission.

File

tests/src/Functional/ModerationStateAccessTest.php, line 121
Contains \Drupal\Tests\workbench_moderation\Functional\ModerationStateAccessTest.

Class

ModerationStateAccessTest
Tests the view access control handler for moderation state entities.

Namespace

Drupal\Tests\workbench_moderation\Functional

Code

protected function createNodeType($label, $machine_name) {

  /** @var NodeType $node_type */
  $node_type = NodeType::create([
    'type' => $machine_name,
    'label' => $label,
  ]);
  $node_type
    ->setThirdPartySetting('workbench_moderation', 'enabled', TRUE);
  $node_type
    ->save();
  return $node_type;
}