public function AccessResultTest::testCacheUntilConfigurationChanges in Drupal 8
@expectedDeprecation Drupal\Core\Access\AccessResult::cacheUntilConfigurationChanges 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 992 - Contains \Drupal\Tests\Core\Access\AccessResultTest.
Class
- AccessResultTest
- @coversDefaultClass \Drupal\Core\Access\AccessResult @group Access
Namespace
Drupal\Tests\Core\AccessCode
public function testCacheUntilConfigurationChanges() {
$config = $this
->prophesize(Config::class);
$config
->getCacheContexts()
->willReturn([
'context',
]);
$config
->getCacheTags()
->willReturn([
'tag',
]);
$config
->getCacheMaxAge()
->willReturn(10);
$access_result = AccessResult::neutral()
->cacheUntilConfigurationChanges($config
->reveal());
$this
->assertSame([
'context',
], $access_result
->getCacheContexts());
$this
->assertSame([
'tag',
], $access_result
->getCacheTags());
$this
->assertSame(10, $access_result
->getCacheMaxAge());
}