private function OtherEventVariablesTest::getVariablesFromCreatedEvent 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::getVariablesFromCreatedEvent()
Get the variables from the created event.
Parameters
string $class: Event class name.
array $variablesArray: Variables array.
Return value
\Drupal\preprocess_event_dispatcher\Variables\AbstractEventVariables Variables object.
12 calls to OtherEventVariablesTest::getVariablesFromCreatedEvent()
- OtherEventVariablesTest::testBlockEvent in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - Test a BlockPreprocessEvent.
- OtherEventVariablesTest::testBlockEventWithBlockContent in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - Test a BlockPreprocessEvent with block content entity.
- OtherEventVariablesTest::testFieldEvent in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - Test a FieldPreprocessEvent.
- OtherEventVariablesTest::testFormEvent in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - Test FormPreprocessEvent.
- OtherEventVariablesTest::testHtmlEvent in modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php - Test a HtmlPreprocessEvent.
File
- modules/
preprocess_event_dispatcher/ tests/ src/ Unit/ OtherEventVariablesTest.php, line 296
Class
- OtherEventVariablesTest
- Class OtherEventVariablesTest.
Namespace
Drupal\Tests\preprocess_event_dispatcher\UnitCode
private function getVariablesFromCreatedEvent(string $class, array $variablesArray) : AbstractEventVariables {
/** @var \Drupal\preprocess_event_dispatcher\Event\PreprocessEventInterface $class */
$hook = $class::getHook();
self::assertSame(AbstractPreprocessEvent::DISPATCH_NAME_PREFIX . $hook, $class::name());
$factory = $this->mapper
->getFactory($hook);
self::assertSame($hook, $factory
->getEventHook());
/** @var \Drupal\preprocess_event_dispatcher\Event\PreprocessEventInterface $event*/
$event = $factory
->createEvent($variablesArray);
self::assertInstanceOf($class, $event);
return $event
->getVariables();
}