function ModerationStateWidgetTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateWidgetTest::setUp()
  2. 8.9.x core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateWidgetTest::setUp()
  3. 10 core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateWidgetTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php, line 39

Class

ModerationStateWidgetTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21content_moderation%21src%21Plugin%21Field%21FieldWidget%21ModerationStateWidget.php/class/ModerationStateWidget/11.x" title="Plugin implementation of the &#039;moderation_state_default&#039; widget." class="local">\Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget</a> @group content_moderation

Namespace

Drupal\Tests\content_moderation\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('content_moderation_state');
    $this->installEntitySchema('user');
    $this->installConfig([
        'content_moderation',
        'system',
    ]);
    NodeType::create([
        'type' => 'moderated',
        'name' => 'Moderated',
    ])->save();
    NodeType::create([
        'type' => 'unmoderated',
        'name' => 'Unmoderated',
    ])->save();
    $workflow = $this->createEditorialWorkflow();
    $workflow->getTypePlugin()
        ->addEntityTypeAndBundle('node', 'moderated');
    $workflow->save();
}

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