Beispiel #1
0
 public function testConnectWillUseConfiguredVersions()
 {
     $connection = $this->getMockBuilder(Connection::class)->setMethods(['readFrame', 'writeFrame', 'getParser', 'isConnected', 'disconnect'])->disableOriginalConstructor()->getMock();
     $connection->expects($this->once())->method('readFrame')->will($this->returnValue(new Frame('CONNECTED')));
     $sendFrame = null;
     $connection->expects($this->once())->method('writeFrame')->willReturnCallback(function ($frame) use(&$sendFrame) {
         $sendFrame = $frame;
     });
     $connection->expects($this->any())->method('getParser')->willReturn(new Parser());
     $connection->expects($this->any())->method('isConnected')->willReturn(true);
     $client = new Client($connection);
     $client->setVersions([Version::VERSION_1_0, Version::VERSION_1_2]);
     $client->connect();
     self::$stomp = $client;
     $this->assertInstanceOf(Frame::class, $sendFrame);
     $this->assertEquals(Version::VERSION_1_0 . ',' . Version::VERSION_1_2, $sendFrame['accept-version']);
 }