function EntityOperationsTest::createNodeType

Creates a page node type to test with, ensuring that it's moderated.

1 call to EntityOperationsTest::createNodeType()
EntityOperationsTest::setUp in core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php

File

core/modules/content_moderation/tests/src/Kernel/EntityOperationsTest.php, line 53

Class

EntityOperationsTest
Tests Drupal\content_moderation\EntityOperations.

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function createNodeType() : void {
  $node_type = NodeType::create([
    'type' => 'page',
    'name' => 'Page',
  ]);
  $node_type->save();
  $workflow = $this->createEditorialWorkflow();
  $workflow->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'page');
  $workflow->save();
}

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