$this->assertEquals(array('listenToBar'),$dispatcher->getListeners('bar'),'->connect() connects a listener to an event name');
$dispatcher->connect('bar','listenToBarBar');
$this->assertEquals(array('listenToBar','listenToBarBar'),$dispatcher->getListeners('bar'),'->connect() can connect several listeners for the same event name');
$dispatcher->connect('barbar','listenToBarBar');
$dispatcher->disconnect('bar','listenToBarBar');
$this->assertEquals(array('listenToBar'),$dispatcher->getListeners('bar'),'->disconnect() disconnects a listener for an event name');
$this->assertEquals(array('listenToBarBar'),$dispatcher->getListeners('barbar'),'->disconnect() disconnects a listener for an event name');
$this->assertFalse($dispatcher->disconnect('foobar','listen'),'->disconnect() returns false if the listener does not exist');
}
publicfunctiontestGetHasListeners()
{
$dispatcher=newEventDispatcher();
$this->assertFalse($dispatcher->hasListeners('foo'),'->hasListeners() returns false if the event has no listener');
$dispatcher->connect('foo','listenToFoo');
$this->assertEquals(true,$dispatcher->hasListeners('foo'),'->hasListeners() returns true if the event has some listeners');
$dispatcher->disconnect('foo','listenToFoo');
$this->assertFalse($dispatcher->hasListeners('foo'),'->hasListeners() returns false if the event has no listener');
$dispatcher->connect('bar','listenToBar');
$this->assertEquals(array('listenToBar'),$dispatcher->getListeners('bar'),'->getListeners() returns an array of listeners connected to the given event name');
$this->assertEquals(array(),$dispatcher->getListeners('foobar'),'->getListeners() returns an empty array if no listener are connected to the given event name');
$this->assertEquals('listenToFoolistenToFooBis',$listener->getValue(),'->notifyUntil() notifies all registered listeners in order and stops if it returns true');
$this->assertEquals($event,$e,'->notifyUntil() returns the event object');