public function testRun_RenderableAndResponse()
 {
     $this->emitter->attach('controller.load', array($this, 'handleControllerLoad'));
     $this->emitter->attach('controller.invoke', array($this, 'handleControllerInvoke_Presenter'));
     $this->emitter->attach('controller.view_context', array($this, 'handleControllerViewContext'));
     $this->emitter->attach('controller.view', array($this, 'handleControllerView'));
     $response = $this->object->run($this->createRoute());
     $this->assertThat($response, $this->isInstanceOf('IResponse'));
 }
 public function testNotifyUntil()
 {
     $name = 'test.listener';
     $mocks = array();
     $listeners = array();
     for ($i = 0; $i < 4; $i++) {
         $mocks[$i] = $this->getMock('IMockListener');
         $listeners[$i] = array($mocks[$i], 'testCallback');
         $this->dispatcher->attach($name, $listeners[$i]);
     }
     $this->assertThat($listeners, $this->equalTo($this->dispatcher->getListeners($name)), 'Both listener arrays must are equal');
     $e = new Event(null, $name);
     $mocks[0]->expects($this->once())->method('testCallback');
     $mocks[1]->expects($this->once())->method('testCallback')->will($this->returnValue(true));
     $mocks[2]->expects($this->never())->method('testCallback');
     $mocks[3]->expects($this->never())->method('testCallback');
     // notifies only first 2 mocks, other 2 mocks are not called
     $this->dispatcher->notifyUntil($e, true);
 }