test again

This commit is contained in:
Shoghi Cervantes 2013-08-28 17:02:04 +02:00
parent 5d27a40a6e
commit feea39a97f
2 changed files with 32 additions and 35 deletions

View File

@ -26,7 +26,9 @@ class PocketMinecraftServer{
private function load(){ private function load(){
$this->version = new VersionString(); $this->version = new VersionString();
if(!defined("DEBUG") or DEBUG >= 0){
@cli_set_process_title("PocketMine-MP ".MAJOR_VERSION); @cli_set_process_title("PocketMine-MP ".MAJOR_VERSION);
}
if($this->version->isDev()){ if($this->version->isDev()){
console("[INFO] \x1b[31;1mThis is a Development version"); console("[INFO] \x1b[31;1mThis is a Development version");
} }
@ -87,7 +89,7 @@ class PocketMinecraftServer{
public function titleTick(){ public function titleTick(){
$time = microtime(true); $time = microtime(true);
if(ENABLE_ANSI === true){ if((!defined("DEBUG") or DEBUG >= 0) and ENABLE_ANSI === true){
echo "\x1b]0;PocketMine-MP ".MAJOR_VERSION." | Online ". count($this->clients)."/".$this->maxClients." | RAM ".round((memory_get_usage() / 1024) / 1024, 2)."MB | U ".round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." D ".round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." kB/s | TPS ".$this->getTPS()."\x07"; echo "\x1b]0;PocketMine-MP ".MAJOR_VERSION." | Online ". count($this->clients)."/".$this->maxClients." | RAM ".round((memory_get_usage() / 1024) / 1024, 2)."MB | U ".round(($this->interface->bandwidth[1] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." D ".round(($this->interface->bandwidth[0] / max(1, $time - $this->interface->bandwidth[2])) / 1024, 2)." kB/s | TPS ".$this->getTPS()."\x07";
} }
$this->interface->bandwidth = array(0, 0, $time); $this->interface->bandwidth = array(0, 0, $time);

View File

@ -1,21 +1,9 @@
<?php <?php
/***REM_START***/ /***REM_START***/
if(class_exists("PocketMinecraftServer", false)){ if(!class_exists("PocketMinecraftServer", false)){
return;
}
class ServerSuiteTest extends PHPUnit_Framework_TestCase{ class ServerSuiteTest extends PHPUnit_Framework_TestCase{
private $server; private $server;
public function hook(){ public function testStart(){
$this->assertTrue(true);
$server = ServerAPI::request();
//Everything done!
$server->close();
}
public function testRead(){
define("NO_THREADS", true); define("NO_THREADS", true);
define("DEBUG", -1); //No output define("DEBUG", -1); //No output
require_once(dirname(__FILE__)."/../dependencies.php"); require_once(dirname(__FILE__)."/../dependencies.php");
@ -30,11 +18,18 @@
$this->assertTrue(Utils::readLong("\x41\x02\x03\x04\x05\x06\x07\x08") === "4684309878217770760", "Utils::readLong"); $this->assertTrue(Utils::readLong("\x41\x02\x03\x04\x05\x06\x07\x08") === "4684309878217770760", "Utils::readLong");
//PocketMine-MP server startup //PocketMine-MP server startup
$this->server = new ServerAPI(); $server = new ServerAPI();
$this->server->load(); $server->load();
$this->assertTrue(is_integer($this->server->event("server.start", array($this, "hook")))); $this->assertTrue(is_integer($server->event("server.start", array($this, "hook"))));
$this->server->init(); $server->init();
exit(0); }
public function hook(){
$this->server = ServerAPI::request();
//Everything done!
$this->server->close();
}
} }
} }
/***REM_END***/ /***REM_END***/