You are here

private function OtherEventVariablesTest::assertAbstractEventVariables in Hook Event Dispatcher 8

Test the default event variable functions.

Parameters

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

11 calls to OtherEventVariablesTest::assertAbstractEventVariables()
OtherEventVariablesTest::testBlockEvent in tests/src/Unit/Preprocess/OtherEventVariablesTest.php
Test a BlockPreprocessEvent.
OtherEventVariablesTest::testFieldEvent in tests/src/Unit/Preprocess/OtherEventVariablesTest.php
Test a FieldPreprocessEvent.
OtherEventVariablesTest::testFormEvent in tests/src/Unit/Preprocess/OtherEventVariablesTest.php
Test FormPreprocessEvent.
OtherEventVariablesTest::testHtmlEvent in tests/src/Unit/Preprocess/OtherEventVariablesTest.php
Test a HtmlPreprocessEvent.
OtherEventVariablesTest::testImageEvent in tests/src/Unit/Preprocess/OtherEventVariablesTest.php
Test a ImagePreprocessEvent.

... See full list

File

tests/src/Unit/Preprocess/OtherEventVariablesTest.php, line 241

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

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