You are here

protected function MediaTest::createScheduledPublishField in Scheduled Publish 8.3

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

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

1 call to MediaTest::createScheduledPublishField()
MediaTest::setUp in tests/src/Kernel/MediaTest.php

File

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

Class

MediaTest
Class MediaTests

Namespace

Drupal\Tests\scheduled_publish\Kernel

Code

protected function createScheduledPublishField() {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'field_scheduled_publish',
    'type' => 'scheduled_publish',
    'entity_type' => 'media',
  ]);
  $field_storage
    ->save();
  FieldConfig::create([
    'entity_type' => 'media',
    'field_name' => 'field_scheduled_publish',
    'bundle' => $this->testMediaType
      ->id(),
    'label' => 'Test field',
  ])
    ->save();
  $workflow = Workflow::load('editorial');
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('media', $this->testMediaType
    ->id());
  $workflow
    ->save();
}