From 7d91bb05195a3480bc3629e48eb478b4239a3772 Mon Sep 17 00:00:00 2001 From: danibrutal Date: Thu, 18 Jun 2015 14:21:30 +0200 Subject: [PATCH] Changing measurement to name in result set --- src/Leaseweb/InfluxDB/ResultSet.php | 2 +- tests/unit/ResultSetTest.php | 16 ++++++++++++++++ tests/unit/result.example.json | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Leaseweb/InfluxDB/ResultSet.php b/src/Leaseweb/InfluxDB/ResultSet.php index dd9b91f1f..360151d9a 100644 --- a/src/Leaseweb/InfluxDB/ResultSet.php +++ b/src/Leaseweb/InfluxDB/ResultSet.php @@ -55,7 +55,7 @@ class ResultSet $points = array(); foreach ($this->getSeries() as $serie) { - if ($serie['measurement'] == $metricName || array_intersect($tags, $serie['tags'])) { + if ($serie['name'] == $metricName || array_intersect($tags, $serie['tags'])) { $points = array_merge($points, $this->getPointsFromSerie($serie)); } } diff --git a/tests/unit/ResultSetTest.php b/tests/unit/ResultSetTest.php index 82c50b526..a7a2a170d 100644 --- a/tests/unit/ResultSetTest.php +++ b/tests/unit/ResultSetTest.php @@ -24,6 +24,22 @@ class ResultSetTest extends \PHPUnit_Framework_TestCase new ResultSet($invalidJSON); } + /** + * Throws Exception if something went wrong with influxDB + * @expectedException \Leaseweb\InfluxDB\InfluxDBClientError + */ + public function testThrowsInfluxDBException() + { + + $errorResult = <<