function ModerationStateFieldItemListTest::assertEmptiedModerationFieldItemList
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::assertEmptiedModerationFieldItemList()
- 8.9.x core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::assertEmptiedModerationFieldItemList()
- 11.x core/modules/content_moderation/tests/src/Kernel/ModerationStateFieldItemListTest.php \Drupal\Tests\content_moderation\Kernel\ModerationStateFieldItemListTest::assertEmptiedModerationFieldItemList()
Assert the set of expectations when the moderation state field is emptied.
@internal
5 calls to ModerationStateFieldItemListTest::assertEmptiedModerationFieldItemList()
- ModerationStateFieldItemListTest::testAssignNullItemList in core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php - Tests the field item when it is assigned NULL.
- ModerationStateFieldItemListTest::testEmptyFieldItem in core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php - Tests an empty value assigned to the field item.
- ModerationStateFieldItemListTest::testEmptyFieldItemList in core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php - Tests an empty value assigned to the field item list.
- ModerationStateFieldItemListTest::testEmptyStateAndAppend in core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php - Tests the item list when it is emptied and appended to.
- ModerationStateFieldItemListTest::testUnsetItemList in core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php - Tests the field item when it is unset.
File
-
core/
modules/ content_moderation/ tests/ src/ Kernel/ ModerationStateFieldItemListTest.php, line 172
Class
- ModerationStateFieldItemListTest
- @coversDefaultClass \Drupal\content_moderation\Plugin\Field\ModerationStateFieldItemList
Namespace
Drupal\Tests\content_moderation\KernelCode
protected function assertEmptiedModerationFieldItemList() : void {
$this->assertTrue($this->testNode->moderation_state
->isEmpty());
// Test the empty value causes a violation in the entity.
$violations = $this->testNode
->validate();
$this->assertCount(1, $violations);
$this->assertEquals('This value should not be null.', $violations->get(0)
->getMessage());
// Test that incorrectly saving the entity regardless will not produce a
// change in the moderation state.
$this->testNode
->save();
$this->assertEquals('draft', Node::load($this->testNode
->id())->moderation_state->value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.