You are here

protected function CommonTest::createNodeType in Scheduled Publish 8

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

1 call to CommonTest::createNodeType()
CommonTest::setUp in tests/src/Kernel/CommonTest.php
Set the default field storage backend for fields created during tests.

File

tests/src/Kernel/CommonTest.php, line 62

Class

CommonTest
Class CommonTest

Namespace

Drupal\Tests\scheduled_publish\Kernel

Code

protected function createNodeType() {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_scheduled_publish',
    'type' => 'scheduled_publish',
    'entity_type' => 'node',
  ]);
  $field_storage
    ->save();
  $node_type = NodeType::create([
    'type' => 'page',
  ]);
  $node_type
    ->save();
  FieldConfig::create([
    'entity_type' => 'node',
    'field_name' => 'field_scheduled_publish',
    'bundle' => 'page',
    'label' => 'Test field',
  ])
    ->save();
  $workflow = Workflow::load('editorial');
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('node', 'page');
  $workflow
    ->save();
}