/** * 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 Delivery($this->channel, 'consumer', 1, false, 'inbox', 'topic', '{"result": 63}', ['headers' => ['x-error' => 'foo', 'x-error-code' => 129]])); $this->driver->call($this->createIdentity(), $this->createRequest())->resolve(); }