/** * Driver should create response promise which will resolve AMQP reply and decode response. * This test ensures an exception is thrown when response contain x-error header. */ public function testCallErrorResponse() { $this->expectException(ReplyException::class); $this->expectExceptionMessage('foo'); $this->expectExceptionCode(129); $reply = $this->getMockBuilder(Invoker\Reply::class)->disableOriginalConstructor()->getMock(); $this->invoker->expects($this->once())->method('call')->willReturn($reply); $reply->expects($this->once())->method('resolve')->willReturn(new AMQPMessage('', ['application_headers' => new AMQPTable(['x-error' => 'foo', 'x-error-code' => 129])])); $this->driver->call(new Location('calc'), $this->createRequest())->resolve(); }