public function AbstractFieldSettingsSummaryAlterEventTestCase::testContext in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/field_event_dispatcher/tests/src/Unit/Field/AbstractFieldSettingsSummaryAlterEventTestCase.php \Drupal\Tests\field_event_dispatcher\Unit\Field\AbstractFieldSettingsSummaryAlterEventTestCase::testContext()
AbstractFieldSettingsSummaryAlterEventTestCase context test.
This tests that the context parameter returns expected values.
File
- modules/
field_event_dispatcher/ tests/ src/ Unit/ Field/ AbstractFieldSettingsSummaryAlterEventTestCase.php, line 101
Class
- AbstractFieldSettingsSummaryAlterEventTestCase
- Class AbstractFieldSettingsSummaryAlterEventTestCase.
Namespace
Drupal\Tests\field_event_dispatcher\Unit\FieldCode
public function testContext() : void {
$fieldDefinition = new BaseFieldDefinition();
$context = $this
->getTestContext($fieldDefinition);
$context['field_definition'] = $fieldDefinition;
$expectedContext = $context;
$summary = [];
// Run the procedural hook which should trigger the event.
$hook = $this
->getProceduralHookName();
$hook($summary, $context);
/** @var \Drupal\field_event_dispatcher\Event\Field\AbstractFieldSettingsSummaryFormEvent $event */
$event = $this->manager
->getRegisteredEvent($this
->getEventName());
self::assertSame($expectedContext, $event
->getContext());
}