You are here

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

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

Test the default event variable functions.

Parameters

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

12 calls to OtherEventVariablesTest::assertAbstractEventVariables()
OtherEventVariablesTest::testBlockEvent in modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php
Test a BlockPreprocessEvent.
OtherEventVariablesTest::testBlockEventWithBlockContent in modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php
Test a BlockPreprocessEvent with block content entity.
OtherEventVariablesTest::testFieldEvent in modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php
Test a FieldPreprocessEvent.
OtherEventVariablesTest::testFormEvent in modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php
Test FormPreprocessEvent.
OtherEventVariablesTest::testHtmlEvent in modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php
Test a HtmlPreprocessEvent.

... See full list

File

modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php, line 269

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

private function assertAbstractEventVariables(AbstractEventVariables $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'));
}