You are here

public function OtherEventVariablesTest::testFormEvent in Hook Event Dispatcher 8.2

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

Test FormPreprocessEvent.

File

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

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit

Code

public function testFormEvent() : void {
  $variablesArray = $this
    ->createVariablesArray();
  $variablesArray['element'] = [
    'element array',
  ];

  /** @var \Drupal\preprocess_event_dispatcher\Variables\FormEventVariables $variables */
  $variables = $this
    ->getVariablesFromCreatedEvent(FormPreprocessEvent::class, $variablesArray);
  self::assertInstanceOf(FormEventVariables::class, $variables);
  $this
    ->assertAbstractEventVariables($variables);
  self::assertSame([
    'element array',
  ], $variables
    ->getElement());
}