/** * @expectedException RuntimeException */ public function testAddEventListenerForWrongEvent() { $mock = $this->getMockBuilder('PhpDDD\\Domain\\Event\\Listener\\EventListenerInterface')->setMethods(array('getSupportedEventClassName', 'handle'))->getMock(); $mock->expects($this->once())->method('getSupportedEventClassName')->willReturn('WrongEvent'); $collection = new EventListenerCollection('event'); $collection->add($mock); }
/** * @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))); } }