Ejemplo n.º 1
0
 /**
  * Invalid Empty Realm Name
  *
  * @depends testStart
  * @param \Thruway\Peer\Router $router
  * @return array
  */
 public function testInvalidRealm(\Thruway\Peer\Router $router)
 {
     $transport = $this->getMock('Thruway\\Transport\\TransportInterface');
     // Configure the stub.
     $transport->expects($this->any())->method('getTransportDetails')->will($this->returnValue(["type" => "ratchet", "transportAddress" => "127.0.0.1"]));
     $transport->expects($this->once())->method('sendMessage')->with($this->callback(function (\Thruway\Message\AbortMessage $msg) {
         $this->assertInstanceOf('\\Thruway\\Message\\AbortMessage', $msg);
         $this->assertEquals('wamp.error.no_such_realm', $msg->getResponseURI());
         return $msg instanceof Thruway\Message\AbortMessage;
     }))->will($this->returnValue(null));
     //Simulate onOpen
     $router->onOpen($transport);
     //Simulate a HelloMessage with an empty Realm
     $helloMessage = new \Thruway\Message\HelloMessage("", []);
     $router->onMessage($transport, $helloMessage);
 }