$expected_response =
static::
getExpectedCollectionResponse([$entity],
$rel_working_copy_collection_url->
toString(),
$request_options);
$expected_collection_document =
$expected_response->
getResponseData();
$expected_collection_document['data'
] =
[];
$expected_cacheability =
$expected_response->
getCacheableMetadata();
$access_denied_response =
static::
getAccessDeniedResponse($entity,
$result,
$url, NULL,
$detail)->
getResponseData();
static::
addOmittedObject($expected_collection_document,
static::
errorsToOmittedObject($access_denied_response['errors'
]));
$this->
assertResourceResponse(200,
$expected_collection_document,
$actual_response,
$expected_cacheability->
getCacheTags(),
$expected_cacheability->
getCacheContexts(), FALSE, 'MISS'
);
} // Since additional permissions are required to see 'draft' entities,
// grant those permissions.
$this->
grantPermissionsToTestedRole($this->
getEditorialPermissions());
// Now, the `working-copy` link should be latest revision and be accessible.
$actual_response =
$this->
request('GET',
$rel_working_copy_url,
$request_options);
$expected_document['data'
]['attributes'
][$revision_id_key] =
$forward_revision_id;
$expected_document['data'
]['attributes'
]['moderation_state'
] = 'draft';
$expected_document['data'
]['attributes'
][$published_key] = FALSE;
$expected_document['data'
]['attributes'
]['field_revisionable_number'
] = 42;
$expected_document['links'
]['self'
]['href'
] =
$rel_working_copy_url->
setAbsolute()->
toString();
$expected_document['data'
]['attributes'
][$revision_translation_affected_key] =
$entity->
isRevisionTranslationAffected();
// The resource object now must link to the forward revision.
$forward_revision_id_url =
clone $url;