/** * Test onOpen * * @depends testStart * @param \Thruway\Peer\Router $router * @return array */ public function testOnOpen(\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"])); $router->onOpen($transport); $this->assertGreaterThan(0, count($router->managerGetSessionCount())); return ['router' => $router, 'transport' => $transport]; }
/** * Test ConnectionOpen * * @depends testStart * @param \Thruway\Peer\Router $router * @return array */ public function testConnectionOpen(\Thruway\Peer\Router $router) { $transport = $this->getMock('Thruway\\Transport\\TransportInterface'); // Configure the stub. $transport->expects($this->any())->method('getTransportDetails')->will($this->returnValue(["type" => "ratchet", "transport_address" => "127.0.0.1"])); $session = new \Thruway\Session($transport); $router->getEventDispatcher()->dispatch("connection_open", new \Thruway\Event\ConnectionOpenEvent($session)); $this->assertGreaterThan(0, count($router->managerGetSessionCount())); return ['router' => $router, 'session' => $session]; }