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 in other branches
- 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()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 10 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\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()
Returns the expected cacheability for an unauthorized response.
Return value
\Drupal\Core\Cache\CacheableMetadata The expected cacheability.
3 calls to ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- ResourceTestBase::testGetIndividual in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests GETting an individual resource, plus edge cases to ensure good DX.
- ResourceTestBase::testRevisions in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Tests individual and collection revisions.
- TermTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ TermTest.php - Returns the expected cacheability for an unauthorized response.
7 methods override ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- BlockContentTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockContentTest.php - Returns the expected cacheability for an unauthorized response.
- BlockTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockTest.php - Returns the expected cacheability for an unauthorized response.
- CommentTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentTest.php - Returns the expected cacheability for an unauthorized response.
- FileUploadTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ FileUploadTest.php - Returns the expected cacheability for an unauthorized response.
- MediaTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ MediaTest.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.