public function ModerationStateWidgetTest::testIsApplicable in Drupal 10
Same name and namespace in other branches
- 8 core/modules/content_moderation/tests/src/Kernel/ModerationStateWidgetTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateWidgetTest::testIsApplicable()
- 9 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 84
Class
- ModerationStateWidgetTest
- @coversDefaultClass \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget @group content_moderation
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testIsApplicable() {
// 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));
}