function NodeAccessGrantsCacheContextTest::assertUserCacheContext
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php \Drupal\Tests\node\Functional\NodeAccessGrantsCacheContextTest::assertUserCacheContext()
- 10 core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php \Drupal\Tests\node\Functional\NodeAccessGrantsCacheContextTest::assertUserCacheContext()
- 11.x core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php \Drupal\Tests\node\Functional\NodeAccessGrantsCacheContextTest::assertUserCacheContext()
Asserts that for each given user, the expected cache context is returned.
Parameters
array $expected: Expected values, keyed by user ID, expected cache contexts as values.
1 call to NodeAccessGrantsCacheContextTest::assertUserCacheContext()
- NodeAccessGrantsCacheContextTest::testCacheContext in core/
modules/ node/ tests/ src/ Functional/ NodeAccessGrantsCacheContextTest.php - Tests NodeAccessGrantsCacheContext::getContext().
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeAccessGrantsCacheContextTest.php, line 80
Class
- NodeAccessGrantsCacheContextTest
- Tests the node access grants cache context service.
Namespace
Drupal\Tests\node\FunctionalCode
protected function assertUserCacheContext(array $expected) {
foreach ($expected as $uid => $context) {
if ($uid > 0) {
$this->drupalLogin($this->userMapping[$uid]);
}
$this->assertIdentical($context, $this->container
->get('cache_context.user.node_grants')
->getContext('view'));
}
$this->drupalLogout();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.