public function PageTest::testVarByRef in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\PageTest::testVarByRef()
The the vars by ref.
File
- modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ PageTest.php, line 52
Class
- PageTest
- Class PageTest.
Namespace
Drupal\Tests\preprocess_event_dispatcher\UnitCode
public function testVarByRef() : void {
$vars = [];
$page = new PageEventVariables($vars);
$vars['page']['test'] = TRUE;
$vars['page']['array'] = [
'array key' => 1,
];
$vars['page']['object'] = new stdClass();
self::assertTrue($page
->get('test'));
self::assertArrayHasKey('array key', $page
->get('array'));
self::assertInstanceOf(stdClass::class, $page
->get('object'));
}