public function testReferenceProcess() { $eventType = EventType::createByParams("ws.tools", __METHOD__); $first = 1; // subscribe, only one param by reference $this->manager()->subscribe($eventType, new TestReferenceHandler()); $this->manager()->subscribe($eventType, function (&$one) { $one += 1; }); // process $events = GetModuleEvents($eventType->getModule(), $eventType->getSubject(), true); foreach ($events as $arEvent) { ExecuteModuleEventEx($arEvent, array(&$first)); } // test $this->assertEquals($first, 4); }
/** * @param EventType $eventType */ public function registerCall(EventType $eventType) { $this->_calls[] = $eventType->getModule() . ' ' . $eventType->getSubject(); }