$parameters =
$state->
getOpenerParameters();
$parameters['entity_id'
] =
$neutral_entity->
id();
$state = MediaLibraryState::
create( $state->
getOpenerId(),
$state->
getAllowedTypeIds(),
$state->
getSelectedTypeId(),
$state->
getAvailableSlots(),
$parameters );
$access_result =
$ui_builder->
checkAccess($this->
createUser(),
$state);
$this->
assertTrue($access_result->
isNeutral());
$this->
assertAccess($access_result, FALSE, NULL,
[],
['url.query_args', 'user.permissions'
]);
// Give the user permission to edit the entity and assert that access is
// granted.
$account =
$this->
createUser([ 'administer entity_test content',
'view media',
]);
$access_result =
$ui_builder->
checkAccess($account,
$state);
$this->
assertAccess($access_result, TRUE, NULL, Views::
getView('media_library'
)->storage->
getCacheTags(),
['url.query_args', 'user.permissions'
]);
}