Пример #1
0
 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();
 }
Пример #2
0
 public function it_should_give_queue_context(Queue $a, Queue $b, Context $contextA, Context $contextB)
 {
     $a->getName()->willReturn('a');
     $b->getName()->willReturn('b');
     $a->getFingerPrint()->shouldBeCalled()->willReturn('a');
     $b->getFingerPrint()->shouldBeCalled()->willReturn('b');
     $a->getContext()->willReturn($contextA);
     $b->getContext()->willReturn($contextB);
     $this->addQueue($a);
     $this->addQueue($b);
     $this->getQueueContext('a')->shouldReturn($contextA);
 }
Пример #3
0
 public function initialize()
 {
     $this->connection->connect();
     if (false === $this->channel->isInitialized()) {
         $this->channel->initialize();
     }
     if (false === $this->exchange->isInitialized()) {
         $this->exchange->initialize();
     }
     if (false === $this->queue->isInitialized()) {
         $this->queue->initialize();
     }
     $this->initialized = true;
 }
Пример #4
0
 /**
  * @param Queue $queue
  */
 public function addQueue(Queue $queue)
 {
     $this->queues[$queue->getFingerPrint()] = $queue;
 }