diff --git a/src/Leaseweb/InfluxDB/ResultSet.php b/src/Leaseweb/InfluxDB/ResultSet.php index 360151d9a9..fedcbe3bee 100644 --- a/src/Leaseweb/InfluxDB/ResultSet.php +++ b/src/Leaseweb/InfluxDB/ResultSet.php @@ -55,7 +55,11 @@ class ResultSet $points = array(); foreach ($this->getSeries() as $serie) { - if ($serie['name'] == $metricName || array_intersect($tags, $serie['tags'])) { + + if ((empty($metricName) && empty($tags)) + || $serie['name'] == $metricName + || array_intersect($tags, $serie['tags']) + ) { $points = array_merge($points, $this->getPointsFromSerie($serie)); } } @@ -68,10 +72,10 @@ class ResultSet * * results is an array of objects, one for each query, * each containing the keys for a series - * + * * @return array $series */ - private function getSeries() + public function getSeries() { $pickSeries = function ($object) { return $object['series']; diff --git a/tests/unit/ClientTest.php b/tests/unit/ClientTest.php new file mode 100644 index 0000000000..4485be7e6e --- /dev/null +++ b/tests/unit/ClientTest.php @@ -0,0 +1,20 @@ +assertTrue( + true + ); + } +} \ No newline at end of file diff --git a/tests/unit/ResultSetTest.php b/tests/unit/ResultSetTest.php index a7a2a170dd..0d0aee18cc 100644 --- a/tests/unit/ResultSetTest.php +++ b/tests/unit/ResultSetTest.php @@ -40,6 +40,23 @@ EOD; new ResultSet($errorResult); } + /** + * We can get points from measurement + */ + public function testGetPoints() + { + $expectedNumberOfPoints = 3; + + $points = $this->resultSet->getPoints(); + + $this->assertTrue( + is_array($points) + ); + + $this->assertCount($expectedNumberOfPoints, $points); + + } + /** * We can get points from measurement */