You are here

public function PageTest::testGetRootVariablesByReference in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\PageTest::testGetRootVariablesByReference()

Test getting root variables by reference.

File

modules/preprocess_event_dispatcher/tests/src/Unit/PageTest.php, line 106

Class

PageTest
Class PageTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testGetRootVariablesByReference() : void {
  $vars = [];
  $vars['test'] = 'something';
  $page = new PageEventVariables($vars);
  $retrievedVars =& $page
    ->getRootVariablesByReference();
  self::assertSame($vars, $retrievedVars);
  $retrievedVars['test2'] = 'other';
  self::assertSame($vars, $retrievedVars);
  self::assertSame($vars, $page
    ->getRootVariablesByReference());
}