/** * Driver should compose AMQP message and publish it to the channel. */ public function testPublish() { $reply = $this->getMockBuilder(Invoker\Reply::class)->disableOriginalConstructor()->getMock(); $this->channel->expects($this->once())->method('publish')->willReturnCallback(function (Message $message, $exchange, $routingKey) use($reply) { $headers = ['base' => 'dec', 'topic' => 'add']; $this->assertJsonStringEqualsJsonString('{"a": 10, "b": 53}', $message->getBody()); $this->assertEquals($headers, $message->getHeaders()); $this->assertEquals($this->exchange, $exchange); $this->assertEquals('add', $routingKey); return $reply; }); $this->driver->publish($this->createIdentity(), $this->createRequest()); }
public function testCallReplyResolving() { $message = $this->createMessage(); $this->channel->expects($this->once())->method('publish'); $this->invoker->call($message, '', '')->resolve(10); }