You are here

public function OtherEventVariablesTest::testFormEvent in Hook Event Dispatcher 8

Test FormPreprocessEvent.

File

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

Class

OtherEventVariablesTest
Class OtherEventVariablesTest.

Namespace

Drupal\Tests\hook_event_dispatcher\Unit\Preprocess

Code

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

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