You are here

ModerationStateFieldTest.php in Workbench Moderation 8

Same filename and directory in other branches
  1. 8.2 tests/src/Kernel/ModerationStateFieldTest.php

File

tests/src/Kernel/ModerationStateFieldTest.php
View source
<?php

namespace Drupal\Tests\workbench_moderation\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
 * Tests moderation state field.
 *
 * @group workbench_moderation
 */
class ModerationStateFieldTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'workbench_moderation',
    'node',
    'views',
    'options',
    'user',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this
      ->installEntitySchema('node');
  }

  /**
   * {@inheritdoc}
   *
   * Covers moderation_state_install().
   */
  public function testModerationStateFieldIsCreated() {

    // There should be no updates as moderation_state_install() should have
    // applied the new field.
    $this
      ->assertTrue(empty($this->container
      ->get('entity.definition_update_manager')
      ->needsUpdates()['node']));
    $this
      ->assertTrue(!empty($this->container
      ->get('entity_field.manager')
      ->getFieldStorageDefinitions('node')['moderation_state']));
  }

}

Classes

Namesort descending Description
ModerationStateFieldTest Tests moderation state field.