コード例 #1
0
 /**
  * @test
  */
 public function it_can_create_an_exchange()
 {
     $connection = $this->factory->createConnection('localhost');
     $channel = $this->factory->createChannel($connection);
     $exchange = $this->factory->createExchange($channel, 'xchg1');
     $this->assertInstanceOf(ExchangeInterface::class, $exchange);
     $this->assertEquals('xchg1', $exchange->getName());
     $this->assertEquals(ExchangeInterface::TYPE_DIRECT, $exchange->getType());
     // create exchange with different type
     $exchange = $this->factory->createExchange($channel, 'xchg2', ExchangeInterface::TYPE_FANOUT);
     $this->assertEquals(ExchangeInterface::TYPE_FANOUT, $exchange->getType());
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function createChannel(ConnectionInterface $connection)
 {
     $channel = $this->delegate->createChannel($connection);
     $this->channels[] = $channel;
     return $channel;
 }