// Finally, assert that when Content Moderation is installed, a new revision
// is automatically created when PATCHing for entity types that have a
// moderation handler.
// @see \Drupal\content_moderation\Entity\Handler\ModerationHandler::onPresave()
// @see \Drupal\content_moderation\EntityTypeInfo::$moderationHandlers
if ($updated_entity instanceof EntityPublishedInterface
) { $updated_entity->
setPublished()->
save();
} $this->
assertTrue($this->container->
get('module_installer'
)->
install(['content_moderation'
], TRUE
), 'Installed modules.'
);
if (!\Drupal::
service('content_moderation.moderation_information'
)->
canModerateEntitiesOfEntityType($this->entity->
getEntityType())) { return;
} $workflow =
$this->
createEditorialWorkflow();
$workflow->
getTypePlugin()->
addEntityTypeAndBundle(static::
$entityTypeId,
$this->entity->
bundle());
$workflow->
save();
$this->
grantPermissionsToTestedRole(['use editorial transition publish'
]);
$doc_add_items['data'
]['attributes'
]['field_rest_test_multivalue'
][2
] =
['value' => '3'
];
$request_options[RequestOptions::BODY
] = Json::
encode($doc_add_items);
$response =
$this->
request('PATCH',
$url,
$request_options);
$this->
assertResourceResponse(200, FALSE,
$response);