コード例 #1
0
 public function it_should_give_specified_connection(Connection $connectionA, Connection $connectionB)
 {
     $connectionA->getName()->willReturn('foo');
     $connectionB->getName()->willReturn('bar');
     $this->addConnection($connectionA);
     $this->addConnection($connectionB);
     $this->getConnection('foo')->shouldBeLike($connectionA);
     $this->getConnection('bar')->shouldBeLike($connectionB);
 }
コード例 #2
0
ファイル: Publisher.php プロジェクト: Evaneos/Hector
 public function initialize()
 {
     $this->connection->connect();
     if (false === $this->channel->isInitialized()) {
         $this->channel->initialize();
     }
     if (false === $this->exchange->isInitialized()) {
         $this->exchange->initialize();
     }
     $this->initialized = true;
 }
コード例 #3
0
ファイル: ConsumerSpec.php プロジェクト: Evaneos/Hector
 public function it_should_configure_connection(Connection $connection, Channel $channel, Exchange $exchange, Queue $queue)
 {
     $connection->connect()->shouldBeCalled();
     $channel->isInitialized()->willReturn(false);
     $channel->initialize()->shouldBeCalled();
     $exchange->isInitialized()->willReturn(false);
     $exchange->initialize()->shouldBeCalled();
     $queue->isInitialized()->willReturn(false);
     $queue->initialize()->shouldBeCalled();
     $this->initialize();
 }
コード例 #4
0
ファイル: PublisherSpec.php プロジェクト: Evaneos/Hector
 public function it_should_publish_message_with_routing_key_null(EventDispatcher $eventDispatcher, Exchange $exchange, Channel $channel, \AMQPExchange $AMQPExchange, Connection $connection, Identity $identity)
 {
     $message = 'foo.bar';
     $routingKey = null;
     $flags = AMQP_NOPARAM;
     $attributes = ['x-expires' => 1000];
     $event = new PublisherEvent($message, $routingKey, $flags, $attributes, $exchange->getWrappedObject());
     $successEvent = new SuccessPublisherEvent($event);
     $connection->connect()->shouldBeCalled();
     $channel->isInitialized()->willReturn(true);
     $exchange->isInitialized()->willReturn(true);
     $eventDispatcher->dispatch(PublisherEvents::PRE_PUBLISH, $event)->shouldBeCalled();
     $AMQPExchange->publish($message, $routingKey, $flags, $attributes)->willReturn(true);
     $exchange->getWrappedExchange()->willReturn($AMQPExchange);
     $eventDispatcher->dispatch(PublisherEvents::SUCCESS_PUBLISH, $successEvent)->shouldBeCalled();
     $this->publish($message, $routingKey, $flags, $attributes, false)->shouldReturn(true);
 }
コード例 #5
0
ファイル: Channel.php プロジェクト: Evaneos/Hector
 public function initialize()
 {
     $this->connection->connect();
     $this->channel = new \AMQPChannel($this->connection->getWrappedConnection());
     $this->initialized = true;
 }
コード例 #6
0
ファイル: ConnectionRegistry.php プロジェクト: Evaneos/Hector
 /**
  * @param Connection $connection
  */
 public function addConnection(Connection $connection)
 {
     $this->connections[$connection->getName()] = $connection;
 }