Example #1
0
 /**
  * @return ActiveMq
  * @throws \Stomp\Broker\Exception\UnsupportedBrokerException
  */
 protected function getProtocol()
 {
     $protocol = $this->client->getProtocol();
     if (!$protocol instanceof ActiveMq) {
         throw new UnsupportedBrokerException($protocol, ActiveMq::class);
     }
     return $protocol;
 }
Example #2
0
 public function testClientDetectedActiveMq()
 {
     if (!$this->Stomp->isConnected()) {
         $this->Stomp->connect();
     }
     $this->assertInstanceOf(ActiveMq::class, $this->Stomp->getProtocol(), 'Expected an ActiveMq Broker.');
     $this->Stomp->disconnect();
 }
Example #3
0
 /**
  * @return Protocol
  */
 protected function getProtocol()
 {
     return $this->client->getProtocol();
 }
Example #4
0
 public function testClientWillAutoConnectOnGetProtocol()
 {
     $connection = $this->getMockBuilder(Connection::class)->setMethods(['connect', 'getParser'])->disableOriginalConstructor()->getMock();
     $connection->expects($this->once())->method('connect');
     $connection->expects($this->any())->method('getParser')->willReturn(new Parser());
     $client = new Client($connection);
     try {
         $client->getProtocol();
     } catch (ConnectionException $connectionFailed) {
         $this->addToAssertionCount(1);
     }
 }
Example #5
0
 public function testConnectOnApollo()
 {
     $this->assertTrue($this->client->connect(), 'Expected reachable broker.');
     $this->assertInstanceOf(Apollo::class, $this->client->getProtocol(), 'Expected a Apollo broker.');
 }