You are here

private function EntityEventVariablesTest::assertAbstractEventVariables in Hook Event Dispatcher 8

Test the default event variable methods.

Parameters

\Drupal\hook_event_dispatcher\Event\Preprocess\Variables\AbstractEntityEventVariables $variables: Variables object.

1 call to EntityEventVariablesTest::assertAbstractEventVariables()
EntityEventVariablesTest::assertAbstractEntityEventVariables in tests/src/Unit/Preprocess/EntityEventVariablesTest.php
Test the default entity event variable methods.

File

tests/src/Unit/Preprocess/EntityEventVariablesTest.php, line 159

Class

EntityEventVariablesTest
Class EntityEventVariablesTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

private function assertAbstractEventVariables(AbstractEntityEventVariables $variables) {
  $this
    ->assertEquals('success', $variables
    ->get('test'));
  $this
    ->assertEquals('default', $variables
    ->get('test2', 'default'));
  $reference =& $variables
    ->getByReference('reference');
  $this
    ->assertEquals('first', $reference);
  $reference = 'second';
  $this
    ->assertEquals('second', $variables
    ->get('reference'));
  $variables
    ->set('test3', 'new set');
  $this
    ->assertEquals('new set', $variables
    ->get('test3'));
  $variables
    ->remove('test');
  $this
    ->assertNull($variables
    ->get('test'));
}