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()); }