added some tiny tests
This commit is contained in:
parent
a953393d15
commit
5f96d8bc48
12
.travis.yml
Normal file
12
.travis.yml
Normal 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
|
|
@ -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);
|
||||
|
|
|
@ -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
35
phpunit.xml
Normal 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>
|
Loading…
Reference in New Issue
Block a user