function ModerationStateWidgetTest::testIsApplicable

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

@covers ::isApplicable

File

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

Class

ModerationStateWidgetTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21content_moderation%21src%21Plugin%21Field%21FieldWidget%21ModerationStateWidget.php/class/ModerationStateWidget/10" 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

public function testIsApplicable() : void {
    // The moderation_state field definition should be applicable to our widget.
    $fields = $this->container
        ->get('entity_field.manager')
        ->getFieldDefinitions('node', 'test_type');
    $this->assertTrue(ModerationStateWidget::isApplicable($fields['moderation_state']));
    $this->assertFalse(ModerationStateWidget::isApplicable($fields['status']));
    // A config override should still be applicable.
    $field_config = $fields['moderation_state']->getConfig('moderated');
    $this->assertTrue(ModerationStateWidget::isApplicable($field_config));
}

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