/** * Tests firing named events from the collection, until a callable returns true * @return void */ public function testFireEventUntil() { $collection = new Collection(); $mock = $this->getMock('Tests\\Lib\\Nimbles\\Core\\Event\\ListenerMock', array('listen1', 'listen3')); $collection->connect('event1', array($mock, 'listen1')); $collection->connect('event1', array($mock, 'listen2')); $collection->connect('event1', array($mock, 'listen3')); $collection->connect('event2', array($mock, 'listen2')); $collection->connect('event2', array($mock, 'listen3')); $mock->expects($this->once())->method('listen1')->with($this->isInstanceOf('Nimbles\\Core\\Event'), $this->equalTo('hello')); $mock->expects($this->never())->method('listen2'); $collection->fireEventUntil('event1', 'hello'); $collection->fireEventUntil('event2'); }