当前位置: 首页>>代码示例>>PHP>>正文


PHP AMQPChannel::expects方法代码示例

本文整理汇总了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);
 }
开发者ID:picahielos,项目名称:mtp,代码行数:7,代码来源:MessageQueueTest.php

示例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');
 }
开发者ID:ryaan-anthony,项目名称:RetailOrderManagement-SDK,代码行数:10,代码来源:AmqpApiTest.php

示例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());
 }
开发者ID:skolodyazhnyy,项目名称:message-bus-client,代码行数:16,代码来源:DriverTest.php

示例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.
     }));
 }
开发者ID:lemoinem,项目名称:RabbitMqBundle,代码行数:21,代码来源:MultipleConsumerTest.php

示例5: testCallReplyResolving

 public function testCallReplyResolving()
 {
     $message = $this->createMessage();
     $this->channel->expects($this->once())->method('basic_publish');
     $this->invoker->call($message, '', '')->resolve(10);
 }
开发者ID:skolodyazhnyy,项目名称:message-bus-client,代码行数:6,代码来源:InvokerTest.php

示例6: ensureAcknowledgement

 private function ensureAcknowledgement(AMQPChannel $channel, $deliveryTag)
 {
     $channel->expects($this->once())->method('basic_ack')->with($this->equalTo($deliveryTag));
 }
开发者ID:gloubster,项目名称:worker,代码行数:4,代码来源:AbstractWorkerTest.php

示例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);
 }
开发者ID:cultuurnet,项目名称:broadway-amqp,代码行数:9,代码来源:AMQPPublisherTest.php


注:本文中的PhpAmqpLib\Channel\AMQPChannel::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。