Added some Travis-CI tests

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-09 00:57:41 +01:00
parent 90c8ac1461
commit c46eee611f
3 changed files with 39 additions and 1 deletions

23
.travis.yml Normal file
View File

@ -0,0 +1,23 @@
language: php
php:
- 5.4
- 5.5
matrix:
allow_failures:
- php: 5.5
before_script:
- sudo pecl install channel://pecl.php.net/pthreads-0.0.42
script:
- phpunit tests/
notifications:
email: false
irc:
channels:
- "irc.freenode.org#mcpedevs"
template:
"PocketMine-MP #%{build_number} %{commit}: %{message} (%{build_url})

View File

@ -252,7 +252,7 @@ class ServerAPI{
if(!$this->config->exists("invisible")){
$this->config->set("invisible", false);
}
if(is_object($this->server)){
if($this->server instanceof PocketMinecraftServer){
$this->server->setType($this->getProperty("server-type"));
$this->server->timePerSecond = $this->getProperty("time-per-second");
$this->server->invisible = $this->getProperty("invisible");

15
tests/BinaryRW.php Normal file
View File

@ -0,0 +1,15 @@
<?php
require_once(dirname(__FILE__)."/../src/common/dependencies.php");
class BinaryRWTest extends PHPUnit_Framework_TestCase{
public function testRead(){
$this->assertTrue(Utils::readTriad("\x02\x01\x03") === 131331, "Utils::readTriad");
$this->assertTrue(Utils::readInt("\xff\x02\x01\x03") === -16645885, "Utils::readInt");
$this->assertTrue(abs(Utils::readFloat("\x49\x02\x01\x03") - 532496.1875) < 0.0001, "Utils::readFloat");
$this->assertTrue(abs(Utils::readDouble("\x41\x02\x03\x04\x05\x06\x07\x08") - 147552.5024529) < 0.0001, "Utils::readDouble");
$this->assertTrue(Utils::readLong("\x41\x02\x03\x04\x05\x06\x07\x08") === "4684309878217770760", "Utils::readLong");
$item = Utils::readSlot("\x00\x09\x08\x00\x00");
$this->assertTrue(($item instanceof Item) and $item->getID() === STILL_WATER and $item->count === 8 and $item->getMetadata() === 0, "Utils::readSlot");
}
}