mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
ResultSet::getPoints empty parameters
This commit is contained in:
@@ -55,7 +55,11 @@ class ResultSet
|
|||||||
$points = array();
|
$points = array();
|
||||||
|
|
||||||
foreach ($this->getSeries() as $serie) {
|
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));
|
$points = array_merge($points, $this->getPointsFromSerie($serie));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,10 +72,10 @@ class ResultSet
|
|||||||
*
|
*
|
||||||
* results is an array of objects, one for each query,
|
* results is an array of objects, one for each query,
|
||||||
* each containing the keys for a series
|
* each containing the keys for a series
|
||||||
*
|
*
|
||||||
* @return array $series
|
* @return array $series
|
||||||
*/
|
*/
|
||||||
private function getSeries()
|
public function getSeries()
|
||||||
{
|
{
|
||||||
$pickSeries = function ($object) {
|
$pickSeries = function ($object) {
|
||||||
return $object['series'];
|
return $object['series'];
|
||||||
|
|||||||
20
tests/unit/ClientTest.php
Normal file
20
tests/unit/ClientTest.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Leaseweb\InfluxDB\Test;
|
||||||
|
|
||||||
|
use Leaseweb\InfluxDB\Client;
|
||||||
|
|
||||||
|
class ClientTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var Client $client */
|
||||||
|
protected $client = null;
|
||||||
|
|
||||||
|
|
||||||
|
public function testBaseURl()
|
||||||
|
{
|
||||||
|
$this->assertTrue(
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,23 @@ EOD;
|
|||||||
new ResultSet($errorResult);
|
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
|
* We can get points from measurement
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user