'external' =>
new ResourceTypeRelationship('external'
),
'internal' =>
new ResourceTypeRelationship('internal'
),
'both' =>
new ResourceTypeRelationship('both'
),
];
$type_1 =
new ResourceType('entity_type_1', 'bundle_1_1', EntityInterface::
class, FALSE, TRUE, TRUE, FALSE,
$relationship_fields);
$type_2 =
new ResourceType('entity_type_2', 'bundle_2_1', EntityInterface::
class, TRUE, TRUE, TRUE, FALSE,
$relationship_fields);
$relatable_resource_types =
[ 'external' =>
[$type_1],
'internal' =>
[$type_2],
'both' =>
[$type_1,
$type_2],
];
$type_1->
setRelatableResourceTypes($relatable_resource_types);
$type_2->
setRelatableResourceTypes($relatable_resource_types);
// This type ensures that we can create routes for bundle IDs which might be
// cast from strings to integers. It should not affect related resource
// routing.
$type_3 =
new ResourceType('entity_type_3', '123', EntityInterface::
class, TRUE
);
$type_3->
setRelatableResourceTypes([]);
$resource_type_repository =
$this->
prophesize(ResourceTypeRepository::
class);
$resource_type_repository->
all()->
willReturn([$type_1,
$type_2,
$type_3]);
$container =
$this->
prophesize(ContainerInterface::
class);
$container->
get('jsonapi.resource_type.repository'
)->
willReturn($resource_type_repository->
reveal());
$container->
getParameter('jsonapi.base_path'
)->
willReturn('/jsonapi'
);