Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
doTestRelationshipGet example
public
function
testRelationships
(
)
{
if
(
$this
->entity instanceof ConfigEntityInterface
)
{
$this
->
markTestSkipped
(
'Configuration entities cannot have relationships.'
)
;
}
$request_options
=
[
]
;
$request_options
[
RequestOptions::HEADERS
]
[
'Accept'
]
= 'application/vnd.api+json';
$request_options
= NestedArray::
mergeDeep
(
$request_options
,
$this
->
getAuthenticationRequestOptions
(
)
)
;
// Test GET.
$this
->
doTestRelationshipGet
(
$request_options
)
;
$this
->
setUpAuthorization
(
'GET'
)
;
$this
->
doTestRelationshipGet
(
$request_options
)
;
// Test POST.
$this
->
config
(
'jsonapi.settings'
)
->
set
(
'read_only', FALSE
)
->
save
(
TRUE
)
;
$this
->
doTestRelationshipMutation
(
$request_options
)
;
// Grant entity-level edit access.
$this
->
setUpAuthorization
(
'PATCH'
)
;
$this
->
doTestRelationshipMutation
(
$request_options
)
;
// Field edit access is still forbidden, grant it.
$this
->
grantPermissionsToTestedRole
(
[