subscribe() public method

Subscribe to events based on configuration parameters
public subscribe ( Imbo\EventManager\EventInterface $event )
$event Imbo\EventManager\EventInterface The event instance
Beispiel #1
0
 /**
  * @dataProvider getAllowedMethodsParams
  * @covers Imbo\EventListener\Cors::subscribe
  */
 public function testWillSubscribeToTheCorrectEventsBasedOnParams($params, $events)
 {
     $listener = new Cors($params);
     $headers = $this->getMock('Symfony\\Component\\HttpFoundation\\ResponseHeaderBag');
     $headers->expects($this->once())->method('set')->with('Allow', 'OPTIONS', false);
     $response = $this->getMock('Imbo\\Http\\Response\\Response');
     $response->headers = $headers;
     $manager = $this->getMock('Imbo\\EventManager\\EventManager');
     $manager->expects($this->once())->method('addCallbacks')->with('handler', $events);
     $event = $this->getMock('Imbo\\EventManager\\EventInterface');
     $event->expects($this->once())->method('getManager')->will($this->returnValue($manager));
     $event->expects($this->once())->method('getHandler')->will($this->returnValue('handler'));
     $event->expects($this->once())->method('getResponse')->will($this->returnValue($response));
     $listener->subscribe($event);
 }