Testing database

This commit is contained in:
danibrutal
2015-06-18 16:18:46 +02:00
parent 43c89a161d
commit 74219895ef
3 changed files with 60 additions and 0 deletions
+1
View File
@@ -110,6 +110,7 @@ class Database
return $this->query(sprintf('SHOW RETENTION POLICIES %s', $this->name))->getPoints();
}
/**
* Drop this database
*/
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace Leaseweb\InfluxDB\Test;
use Leaseweb\InfluxDB\Client;
use Leaseweb\InfluxDB\Database;
class DatabaseTest extends \PHPUnit_Framework_TestCase
{
/** @var Database $db */
protected $db = null;
/** @var Client $client */
protected $mockClient;
protected $dataToInsert;
public function setUp()
{
$this->mockClient = $this->getMockBuilder('\Leaseweb\InfluxDB\Client')
->disableOriginalConstructor()
->getMock();
$this->mockClient->expects($this->any())
->method('getBaseURI')
->will($this->returnValue($this->equalTo('http://localhost:8086')));
$this->db = new Database('influx_test_db', $this->mockClient);
$this->dataToInsert = file_get_contents(dirname(__FILE__) . '/input.example.json');
}
public function testWrite()
{
$this->assertTrue(
'mockClient'
);
}
}
+17
View File
@@ -0,0 +1,17 @@
{
"database": "mydb",
"retentionPolicy": "mypolicy",
"points": [
{
"measurement": "cpu_load_short",
"tags": {
"host": "server01",
"region": "us-west"
},
"time": "2009-11-10T23:00:00Z",
"fields": {
"value": 0.64
}
}
]
}