InfluxDB\Test\ClientTest::testGuzzleQuery PHP Метод

testGuzzleQuery() публичный Метод

public testGuzzleQuery ( )
    public function testGuzzleQuery()
    {
        $client = $this->getClient('test', 'test');
        $query = "some-bad-query";
        $bodyResponse = file_get_contents(dirname(__FILE__) . '/json/result.example.json');
        $httpMockClient = $this->buildHttpMockClient($bodyResponse);
        $guzzle = new Guzzle($httpMockClient);
        $client->setDriver($guzzle);
        /** @var \InfluxDB\ResultSet $result */
        $result = $client->query('somedb', $query);
        $parameters = $client->getDriver()->getParameters();
        $this->assertEquals(['test', 'test'], $parameters['auth']);
        $this->assertEquals('somedb', $parameters['database']);
        $this->assertInstanceOf('\\InfluxDB\\ResultSet', $result);
        $point = new Point('test', 1.0);
        $this->assertEquals(true, $client->write(['url' => 'http://localhost', 'database' => 'influx_test_db', 'method' => 'post'], (string) $point));
        $this->assertEquals(true, $client->write(['url' => 'http://localhost', 'database' => 'influx_test_db', 'method' => 'post'], [(string) $point]));
        $this->setExpectedException('\\InvalidArgumentException');
        $client->query('test', 'bad-query');
        $this->setExpectedException('\\InfluxDB\\Driver\\Exception');
        $client->query('test', 'bad-query');
    }