function AccessResultTest::testCacheUntilEntityChanges
@expectedDeprecation Drupal\Core\Access\AccessResult::cacheUntilEntityChanges is deprecated in drupal:8.0.0 and is removed in drupal:9.0.0. Use \Drupal\Core\Access\AccessResult::addCacheableDependency() instead. @group legacy
File
-
core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php, line 977
Class
- AccessResultTest
- @coversDefaultClass \Drupal\Core\Access\AccessResult @group Access
Namespace
Drupal\Tests\Core\AccessCode
public function testCacheUntilEntityChanges() {
$entity = $this->prophesize(EntityInterface::class);
$entity->getCacheContexts()
->willReturn([
'context',
]);
$entity->getCacheTags()
->willReturn([
'tag',
]);
$entity->getCacheMaxAge()
->willReturn(10);
$access_result = AccessResult::neutral()->cacheUntilEntityChanges($entity->reveal());
$this->assertSame([
'context',
], $access_result->getCacheContexts());
$this->assertSame([
'tag',
], $access_result->getCacheTags());
$this->assertSame(10, $access_result->getCacheMaxAge());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.