22 $mock = $this->getMockForAbstractClass(
'Guzzle\Common\AbstractHasDispatcher');
23 $this->assertSame($mock, $mock->setEventDispatcher($d));
24 $this->assertSame($d, $mock->getEventDispatcher());
29 $mock = $this->getMockForAbstractClass(
'Guzzle\Common\AbstractHasDispatcher');
30 $this->assertInstanceOf(
'Symfony\Component\EventDispatcher\EventDispatcher', $mock->getEventDispatcher());
36 $mock = $this->getMockForAbstractClass(
'Guzzle\Common\AbstractHasDispatcher');
37 $mock->getEventDispatcher()->addListener(
'test',
function(
Event $e) use (&$data) {
40 $mock->dispatch(
'test', array(
43 $this->assertEquals(array(
50 $mock = $this->getMockForAbstractClass(
'Guzzle\Common\AbstractHasDispatcher');
51 $subscriber = $this->getMockForAbstractClass(
'Symfony\Component\EventDispatcher\EventSubscriberInterface');
53 $dispatcher = $this->getMockBuilder(
'Symfony\Component\EventDispatcher\EventDispatcher')
54 ->setMethods(array(
'addSubscriber'))
57 $dispatcher->expects($this->once())
58 ->method(
'addSubscriber');
60 $mock->setEventDispatcher($dispatcher);
61 $mock->addSubscriber($subscriber);