You are here

public function PageTest::testGetRootVariablesByReference in Hook Event Dispatcher 8

Test getting root variables by reference.

File

tests/src/Unit/Preprocess/PageTest.php, line 121

Class

PageTest
Class PageTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

public function testGetRootVariablesByReference() {
  $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());
}