/** * Gets the events added to the handler by the plugin * @param string $type * @return array | null */ public function getResponseEvents($type = null) { if (is_string($type) && strlen($type) > 0) { return $this->handler->getEventsOfType($type); } return $this->handler->getEvents(); }
/** * Tests that the handler supports iteration of the events it contains. * * @return void * @depends testAddEventWithValidData */ public function testImplementsGetIterator() { $reflector = new ReflectionClass('Phergie_Event_Handler'); $this->assertTrue($reflector->implementsInterface('IteratorAggregate')); $this->addMockEvent(); $events = $this->events->getEvents(); $expected = array_shift($events); foreach ($this->events as $actual) { $this->assertSame($expected, $actual); } }