public function ContentModerationStateTest::testModerationWithSpecialLanguages in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Kernel/ContentModerationStateTest.php \Drupal\Tests\content_moderation\Kernel\ContentModerationStateTest::testModerationWithSpecialLanguages()
Tests that entities with special languages can be moderated.
@dataProvider moderationWithSpecialLanguagesTestCases
File
- core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationStateTest.php, line 440
Class
- ContentModerationStateTest
- Tests links between a content entity and a content_moderation_state entity.
Namespace
Drupal\Tests\content_moderation\KernelCode
public function testModerationWithSpecialLanguages($original_language, $updated_language) {
$workflow = $this
->createEditorialWorkflow();
$this
->addEntityTypeAndBundleToWorkflow($workflow, $this->revEntityTypeId, $this->revEntityTypeId);
// Create a test entity.
$storage = $this->entityTypeManager
->getStorage($this->revEntityTypeId);
$entity = $storage
->create([
'langcode' => $original_language,
]);
$entity
->save();
$this
->assertEquals('draft', $entity->moderation_state->value);
$entity->moderation_state->value = 'published';
$entity->langcode = $updated_language;
$entity
->save();
$this
->assertEquals('published', $storage
->load($entity
->id())->moderation_state->value);
}