function ResourceTestBase::getExpectedUnauthorizedAccessCacheability
Same name in this branch
- 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
Same name and namespace in other branches
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 10 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
Returns the expected cacheability for an unauthorized response.
Return value
\Drupal\Core\Cache\CacheableMetadata The expected cacheability.
1 method overrides ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- BlockTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockTest.php - Returns the expected cacheability for an unauthorized response.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 479
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function getExpectedUnauthorizedAccessCacheability() {
return (new CacheableMetadata())->setCacheTags([
'4xx-response',
'http_response',
])
->setCacheContexts([
'url.site',
'user.permissions',
])
->addCacheContexts($this->entity
->getEntityType()
->isRevisionable() ? [
'url.query_args:resourceVersion',
] : []);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.