public function testAddEventListenerForGoodEvent() { $mock = $this->getMockBuilder('PhpDDD\\Domain\\Event\\Listener\\EventListenerInterface')->setMethods(array('getSupportedEventClassName', 'handle'))->getMock(); $mock->expects($this->once())->method('getSupportedEventClassName')->willReturn('GoodEvent'); $collection = new EventListenerCollection('GoodEvent'); $collection->add($mock); $this->assertEquals(1, count($collection->getIterator())); $this->assertEquals('GoodEvent', $collection->getEventName()); }
/** * @param Table $table * @param EventListenerCollection $eventListenerCollection */ private function addEventListenerCollectionRows(Table $table, EventListenerCollection $eventListenerCollection) { foreach ($eventListenerCollection as $eventListener) { $table->addRow(array($eventListenerCollection->getEventName(), get_class($eventListener))); } }