function ModerationFormTest::testAlternativeModerationStateWidget
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php \Drupal\Tests\content_moderation\Functional\ModerationFormTest::testAlternativeModerationStateWidget()
- 10 core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php \Drupal\Tests\content_moderation\Functional\ModerationFormTest::testAlternativeModerationStateWidget()
- 11.x 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.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.