/** * @param string $eventName * @param Table $table * @param array $fields * @param array $identifier */ protected function dispatchRowEvent($eventName, Table $table, array $fields = array(), array $identifier = array()) { if ($this->eventDispatcher) { $rowChangeEvent = new ConnectionRowChangeEvent($this, $table, $fields, $identifier); $this->eventDispatcher->dispatch($eventName, $rowChangeEvent); } }
/** * Adds mock listener via closure to event dispatcher * * @param EventDispatcher $eventDispatcher * @param Event[] $events * @param array $expectedEventsCalled */ protected function addMockListenerToEventDispatcher(EventDispatcher $eventDispatcher, array $events, array &$expectedEventsCalled) { $callOnEvent = function (Event $event, $eventName) use(&$expectedEventsCalled) { $expectedEventsCalled[] = $eventName; }; foreach ($events as $eventName) { $eventDispatcher->addListener($eventName, $callOnEvent); } }