// comment and uninstall the query access test module.
$this->
revokePermissionsFromTestedRole(['administer comments'
]);
$this->entity->
setPublished()->
save();
$this->
assertTrue($this->container->
get('module_installer'
)->
uninstall(['jsonapi_test_field_filter_access'
], TRUE
), 'Uninstalled modules.'
);
// ?filter[spotlight.LABEL]: 1 result. Just as already tested above in
// ::doTestCollectionFilterAccessForPublishableEntities().
$collection_filter_url =
$collection_url->
setOption('query',
["filter[spotlight.subject]" =>
$this->entity->
label()]);
$response =
$this->
request('GET',
$collection_filter_url,
$request_options);
$doc = Json::
decode((string) $response->
getBody());
$this->
assertCount(1,
$doc['data'
]);
// Mark the commented entity as inaccessible.
\Drupal::
state()->
set('jsonapi__entity_test_filter_access_blacklist',
[$this->entity->
getCommentedEntityId()]);
Cache::
invalidateTags(['state:jsonapi__entity_test_filter_access_blacklist'
]);
// ?filter[spotlight.LABEL]: 0 results.
$response =
$this->
request('GET',
$collection_filter_url,
$request_options);
$doc = Json::
decode((string) $response->
getBody());
$this->
assertCount(0,
$doc['data'
]);
} /**
* {@inheritdoc}
*/
protected static function getExpectedCollectionCacheability(AccountInterface
$account, array
$collection, array
$sparse_fieldset = NULL,
$filtered = FALSE
) {