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();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -71,7 +75,7 @@ class ResultSet
|
||||
*
|
||||
* @return array $series
|
||||
*/
|
||||
private function getSeries()
|
||||
public function getSeries()
|
||||
{
|
||||
$pickSeries = function ($object) {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user