/** @test */ public function requestsShouldTriggersGloubsterErrorCallback() { $exception = new \Exception('This is an exception'); $reactor = $this->getReactSocketServerMock(); $server = new HttpServer($reactor); $handler = $this->getMessageHandlerMock(); $handler->expects($this->once())->method('error')->with($this->equalTo($exception)); $httpListener = new HTTPListener($server, $reactor, $this->getLogger()); $httpListener->attach($handler); $httpListener->listen(); $request = new \React\Http\Request('GET', '/'); $response = $this->getReactHttpResponseMock(); $server->emit('request', array($request, $response)); $request->emit('error', array($exception)); }