Exemple #1
0
 /**
  * This can only happen in an instance where Welcome is not sent immediately after Hello
  * (when a challenge has been sent)
  */
 public function testJoinSessionTwice()
 {
     $realm = new \Thruway\Realm("realm1");
     $authMgr = $this->getMockBuilder('\\Thruway\\Authentication\\AuthenticationManagerInterface')->getMock();
     $authMgr->expects($this->once())->method("onAuthenticationMessage")->with($this->isInstanceOf('\\Thruway\\Realm'), $this->isInstanceOf('\\Thruway\\Session'), $this->isInstanceOf('\\Thruway\\Message\\HelloMessage'));
     $realm->setAuthenticationManager($authMgr);
     $session = $this->getMockBuilder('\\Thruway\\Session')->disableOriginalConstructor()->setMethods(["sendMessage", "shutdown", "abort"])->getMock();
     $session->expects($this->once())->method("shutdown");
     $realm->onMessage($session, new \Thruway\Message\HelloMessage('realm1', ["roles" => []]));
     $realm->onMessage($session, new \Thruway\Message\HelloMessage('realm1', ["roles" => []]));
     $authMgr->expects($this->once())->method("onSessionClose")->with($this->isInstanceOf('\\Thruway\\Session'));
     $realm->leave($session);
 }