public function ModerationFormTest::testAlternativeModerationStateWidget in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php \Drupal\Tests\content_moderation\Functional\ModerationFormTest::testAlternativeModerationStateWidget()
Test the moderation_state field when an alternative widget is set.
File
- core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationFormTest.php, line 484
Class
- ModerationFormTest
- Tests the moderation form, specifically on nodes.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testAlternativeModerationStateWidget() {
$entity_form_display = EntityFormDisplay::load('node.moderated_content.default');
$entity_form_display
->setComponent('moderation_state', [
'type' => 'string_textfield',
'region' => 'content',
]);
$entity_form_display
->save();
$this
->drupalPostForm('node/add/moderated_content', [
'title[0][value]' => 'Test content',
'moderation_state[0][value]' => 'published',
], 'Save');
$this
->assertSession()
->pageTextContains('Moderated content Test content has been created.');
}