function ContentLanguageSettingsTest::getExpectedCollectionCacheability

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php \Drupal\Tests\jsonapi\Functional\ContentLanguageSettingsTest::getExpectedCollectionCacheability()
  2. 10 core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php \Drupal\Tests\jsonapi\Functional\ContentLanguageSettingsTest::getExpectedCollectionCacheability()
  3. 11.x core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php \Drupal\Tests\jsonapi\Functional\ContentLanguageSettingsTest::getExpectedCollectionCacheability()

Overrides ResourceTestBase::getExpectedCollectionCacheability

File

core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php, line 151

Class

ContentLanguageSettingsTest
JSON:API integration test for "ContentLanguageSettings" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected static function getExpectedCollectionCacheability(AccountInterface $account, array $collection, array $sparse_fieldset = NULL, $filtered = FALSE) {
    $cacheability = parent::getExpectedCollectionCacheability($account, $collection, $sparse_fieldset, $filtered);
    if (static::entityAccess(reset($collection), 'view', $account)->isAllowed()) {
        $cacheability->addCacheContexts([
            'languages:language_interface',
        ]);
    }
    return $cacheability;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.