You are here

private function EntityEventVariablesTest::assertAbstractEventVariables in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventVariablesTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\EntityEventVariablesTest::assertAbstractEventVariables()

Test the default event variable methods.

Parameters

\Drupal\preprocess_event_dispatcher\Variables\AbstractEntityEventVariables $variables: Variables object.

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

File

modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventVariablesTest.php, line 168

Class

EntityEventVariablesTest
Class EntityEventVariablesTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

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