function ResourceTestBase::getExpectedUnauthorizedAccessCacheability
Same name in this branch
- 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- 9 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()
- 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()
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
8 methods override ResourceTestBase::getExpectedUnauthorizedAccessCacheability()
- BlockContentTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockContentTest.php - BlockTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ BlockTest.php - CommentTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentTest.php - FileUploadTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ FileUploadTest.php - MediaTest::getExpectedUnauthorizedAccessCacheability in core/
modules/ jsonapi/ tests/ src/ Functional/ MediaTest.php
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 484
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.query_args',
'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.