You are here

protected function FormatterTest::createNodeType in Scheduled Publish 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/FormatterTest.php \Drupal\Tests\scheduled_publish\Kernel\FormatterTest::createNodeType()

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

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

File

tests/src/Kernel/FormatterTest.php, line 66

Class

FormatterTest
Class FormatterTest

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();
}