Fixes import guzzle as http client description

This commit is contained in:
Walter Dal Mut
2014-09-11 19:52:17 +02:00
parent 08a1b75ea2
commit 16f8b9ec48
2 changed files with 7 additions and 9 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ Use your DiC or Service Locator in order to provide a configured client
use InfluxDB\Client;
use InfluxDB\Options;
use InfluxDB\Adapter\GuzzleAdapter;
use InfluxDB\Adapter\GuzzleAdapter as InfluxHttpAdapter;
use GuzzleHttp\Client as GuzzleHttpClient;
$options = new Options();
@@ -60,7 +60,7 @@ $options->setUsername("root");
$options->setPassword("root");
$guzzleHttp = new GuzzleHttpClient();
$adapter = new GuzzleAdapter($guzzleHttp, $options);
$adapter = new InfluxHttpAdapter($guzzleHttp, $options);
$adapter->setDatabase("mine");
$influx = new Client();
+5 -7
View File
@@ -1,17 +1,15 @@
<?php
namespace InfluxDB;
use InfluxDB\Adapter\GuzzleAdapter;
use InfluxDB\Adapter\GuzzleAdapter as InfluxHttpAdapter;
use InfluxDB\Options;
use GuzzleHttp\Client as GuzzleHttpClient;
use Zend\Stdlib\Hydrator\ArraySerializable;
use crodas\InfluxPHP\Client as Crodas;
class ClientTest extends \PHPUnit_Framework_TestCase
{
private $object;
private $options;
private $hydrator;
private $anotherClient;
@@ -21,7 +19,6 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this->options = $options;
$this->object = new Client();
$this->hydrator = new ArraySerializable();
$client = new Crodas(
$options["tcp"]["host"],
@@ -39,7 +36,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$this->anotherClient = $client;
}
public function testHttpApiWorksCorrectly()
public function testGuzzleHttpApiWorksCorrectly()
{
$tcpOptions = $this->options["tcp"];
@@ -50,7 +47,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$options->setPassword($tcpOptions["password"]);
$guzzleHttp = new GuzzleHttpClient();
$adapter = new GuzzleAdapter($guzzleHttp, $options);
$adapter = new InfluxHttpAdapter($guzzleHttp, $options);
$adapter->setDatabase($tcpOptions["database"]);
$influx = new Client();
@@ -58,7 +55,8 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$influx->mark("tcp.test", ["mark" => "element"]);
$cursor = $this->anotherClient->getDatabase("mine")->query("select * from tcp.test");
$cursor = $this->anotherClient->getDatabase($tcpOptions["database"])
->query("select * from tcp.test");
$this->assertCount(1, $cursor);
$this->assertEquals("element", $cursor[0]->mark);
}