Example #1
0
 public function testRconShortGoldSrcServer()
 {
     $server = new GoldSrcServer(new InetAddress("127.0.0.1"));
     $server->rconAuth("test");
     $rconReply = $server->rconExec("version");
     echo "{$rconReply}\n";
     $this->assertTrue(strpos($rconReply, "Protocol version") !== false && strpos($rconReply, "Exe version") !== false && strpos($rconReply, "Exe build") !== false, "Did not receive correct version response.");
 }
Example #2
0
 public function testRandomGoldsrcServer()
 {
     $masterServer = new MasterServer(MasterServer::GOLDSRC_MASTER_SERVER);
     $serverArray = $masterServer->getServers(MasterServer::REGION_ALL, "\\type\\d\\empty\\1\\full\\1\\gamedir\\valve");
     $serverAddress = $serverArray[array_rand($serverArray)];
     $server = new GoldSrcServer(new InetAddress($serverAddress[0]), $serverAddress[1]);
     $server->initialize();
     $server->updatePlayerInfo();
     $server->updateRulesInfo();
     $this->assertNotNull($server->getPing());
     $this->assertNotNull($server->getPlayers());
     $this->assertNotNull($server->getRules());
     $this->assertNotNull($server->getServerInfo());
     echo $server;
 }