added some tiny tests

This commit is contained in:
César D. Rodas 2013-11-12 14:33:37 -03:00
parent a953393d15
commit 5f96d8bc48
4 changed files with 59 additions and 2 deletions

12
.travis.yml Normal file
View File

@ -0,0 +1,12 @@
language: php
script: phpunit
php:
- 5.4
- 5.5
before_script:
- curl -s http://getcomposer.org/installer | php
- wget http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb
- sudo dpkg -i influxdb_latest_amd64.deb
- php composer.phar install

View File

@ -70,7 +70,7 @@ class BaseHTTP
//$type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
if ($status[0] != 2) {
throw new \Exception($response);
throw new \RuntimeException($response);
}
return $json ? json_decode($response, true) : $response;
}
@ -85,7 +85,7 @@ class BaseHTTP
return $this->execCurl($ch);
}
protected function get($url, Array $args)
protected function get($url, Array $args = [])
{
$ch = $this->getCurl($url, $args);
return $this->execCurl($ch, true);

View File

@ -50,6 +50,16 @@ class DB extends BaseHTTP
$this->base = "db/$name/";
}
public function getName()
{
return $this->name;
}
public function drop()
{
return $this->client->deleteDatabase($this->name);
}
public function insert($name, Array $data)
{
$points = [];

35
phpunit.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnError = "true"
stopOnFailure = "true"
stopOnIncomplete = "true"
stopOnSkipped = "ture"
syntaxCheck = "true"
strict = "false"
verbose = "true"
debug = "true"
bootstrap = "tests/bootstrap.php" >
<testsuites>
<testsuite name="InfluxPHP tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>tests/</directory>
<directory suffix=".php">lib/</directory>
</whitelist>
</filter>
</phpunit>