public function OtherEventVariablesTest::testFieldEvent in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/OtherEventVariablesTest.php \Drupal\Tests\preprocess_event_dispatcher\Unit\OtherEventVariablesTest::testFieldEvent()
Test a FieldPreprocessEvent.
File
- modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php, line 104
Class
- OtherEventVariablesTest
- Class OtherEventVariablesTest.
Namespace
Drupal\Tests\preprocess_event_dispatcher\UnitCode
public function testFieldEvent() : void {
$variablesArray = $this
->createVariablesArray();
$variablesArray['element'] = [
'element array',
];
$variablesArray['items'] = [
'items array',
];
/** @var \Drupal\preprocess_event_dispatcher\Variables\FieldEventVariables $variables */
$variables = $this
->getVariablesFromCreatedEvent(FieldPreprocessEvent::class, $variablesArray);
self::assertInstanceOf(FieldEventVariables::class, $variables);
$this
->assertAbstractEventVariables($variables);
self::assertSame([
'element array',
], $variables
->getElement());
self::assertSame([
'items array',
], $variables
->getItems());
}