public function PageTest::testAddCacheContext in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\PageTest::testAddCacheContext()
Test add cache context.
File
- modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ PageTest.php, line 121
Class
- PageTest
- Class PageTest.
Namespace
Drupal\Tests\preprocess_event_dispatcher\UnitCode
public function testAddCacheContext() : void {
$vars = [];
$page = new PageEventVariables($vars);
$page
->addCacheContext('url.path');
$expectedVars = [];
$expectedVars['#cache']['contexts'][] = 'url.path';
self::assertSame($expectedVars, $vars);
}