public function PageTest::testGet in Hook Event Dispatcher 8
Test the getter.
File
- tests/
src/ Unit/ Preprocess/ PageTest.php, line 36
Class
- PageTest
- Class PageTest.
Namespace
Drupal\Tests\hook_event_dispatcher\Unit\PreprocessCode
public function testGet() {
$vars = [];
$vars['page']['test'] = TRUE;
$vars['page']['array'] = [
'array key' => 1,
];
$vars['page']['object'] = new stdClass();
$page = new PageEventVariables($vars);
self::assertTrue($page
->get('test'));
self::assertArrayHasKey('array key', $page
->get('array'));
self::assertInstanceOf(stdClass::class, $page
->get('object'));
self::assertFalse($page
->get('doesNotExists', FALSE));
}