public function ModerationStateFieldItemListTest::testModerationStateSampleValues in Drupal 10
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::testModerationStateSampleValues()
Test generating sample values for entities with a moderation state.
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php, line 412
Class
- ModerationStateFieldItemListTest
- @coversDefaultClass \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testModerationStateSampleValues() {
$this->container
->get('current_user')
->setAccount($this
->createUser([
'use editorial transition create_new_draft',
'use editorial transition publish',
]));
$sample = $this->container
->get('entity_type.manager')
->getStorage('node')
->createWithSampleValues('example');
$this
->assertCount(0, $sample
->validate());
$this
->assertEquals('draft', $sample->moderation_state->value);
}