public function setUp()
{
$this->mockClient = $this->getMockBuilder('\\InfluxDB\\Client')->disableOriginalConstructor()->getMock();
$this->resultData = file_get_contents(dirname(__FILE__) . '/json/result.example.json');
$this->mockClient->expects($this->any())->method('getBaseURI')->will($this->returnValue($this->equalTo('http://localhost:8086')));
$this->mockClient->expects($this->any())->method('query')->will($this->returnCallback(function ($db, $query) {
Client::$lastQuery = $query;
return new ResultSet($this->resultData);
}));
$this->mockClient->expects($this->any())->method('write')->will($this->returnValue(true));
$httpMockClient = new GuzzleDriver($this->buildHttpMockClient(''));
// make sure the client has a valid driver
$this->mockClient->expects($this->any())->method('getDriver')->will($this->returnValue($httpMockClient));
$this->database = new Database('influx_test_db', $this->mockClient);
}