本文整理汇总了PHP中PhpAmqpLib\Channel\AMQPChannel::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP AMQPChannel::expects方法的具体用法?PHP AMQPChannel::expects怎么用?PHP AMQPChannel::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpAmqpLib\Channel\AMQPChannel
的用法示例。
在下文中一共展示了AMQPChannel::expects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDestruct
public function testDestruct()
{
$this->channelMock->expects($this->once())->method('close');
$this->clientMock->expects($this->once())->method('close');
$queue = new MessageQueue($this->clientMock);
unset($queue);
}
示例2: testQueueDeclaration
/**
* Test declaring a queue on the channel using the configured queue name
*/
public function testQueueDeclaration()
{
$qName = 'queue_name';
$this->setStubConfigData(['getQueueName' => $qName, 'getQueueConfiguration' => ['queue' => $qName, 'passive' => false, 'durable' => true, 'exclusive' => true, 'auto_delete' => true, 'nowait' => true]]);
$this->channel->expects($this->once())->method('queue_declare')->with($this->identicalTo($qName));
$this->invokeRestrictedMethod($this->amqpApi, 'declareQueue');
}
示例3: testPublish
/**
* 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('basic_publish')->willReturnCallback(function (AMQPMessage $message, $exchange, $routingKey) use($reply) {
$headers = ['base' => 'dec', 'to' => 'calc', 'topic' => 'add', 'version' => '1.0'];
$this->assertJsonStringEqualsJsonString('{"a": 10, "b": 53}', $message->body);
$this->assertEquals($headers, $message->get('application_headers')->getNativeData());
$this->assertEquals($this->exchange, $exchange);
$this->assertEquals('add', $routingKey);
return $reply;
});
$this->driver->publish(new Location('calc'), $this->createRequest());
}
示例4: prepareAMQPChannelExpectations
/**
* Preparing AMQP Channel Expectations
*
* @param $expectedMethod
* @param $expectedRequeue
*
* @return void
*/
private function prepareAMQPChannelExpectations($expectedMethod, $expectedRequeue)
{
$this->amqpChannel->expects($this->any())->method('basic_reject')->will($this->returnCallback(function ($delivery_tag, $requeue) use($expectedMethod, $expectedRequeue) {
\PHPUnit_Framework_Assert::assertSame($expectedMethod, 'basic_reject');
// Check if this function should be called.
\PHPUnit_Framework_Assert::assertSame($requeue, $expectedRequeue);
// Check if the message should be requeued.
}));
$this->amqpChannel->expects($this->any())->method('basic_ack')->will($this->returnCallback(function ($delivery_tag) use($expectedMethod) {
\PHPUnit_Framework_Assert::assertSame($expectedMethod, 'basic_ack');
// Check if this function should be called.
}));
}
示例5: testCallReplyResolving
public function testCallReplyResolving()
{
$message = $this->createMessage();
$this->channel->expects($this->once())->method('basic_publish');
$this->invoker->call($message, '', '')->resolve(10);
}
示例6: ensureAcknowledgement
private function ensureAcknowledgement(AMQPChannel $channel, $deliveryTag)
{
$channel->expects($this->once())->method('basic_ack')->with($this->equalTo($deliveryTag));
}
示例7: it_does_not_publish_a_domain_message_when_specification_is_not_satisfied
/**
* @test
*/
public function it_does_not_publish_a_domain_message_when_specification_is_not_satisfied()
{
$this->expectSpecificationIsNotSatisfied();
$this->amqpChannel->expects($this->never())->method('basic_publish');
$this->amqpPublisher->handle($this->domainMessage);
}