Files
librenms-librenms/tests/unit/ClientTest.php
T
Walter Dal Mut 20a64e724b Test suite completely rewritten
Our test suite mixing integration and few unit tests, is difficult
to understand and expand with new features.

This commit rewrite completely the test suite in order to separate
both: integration and unit tests in different suites in a more
maintainable and useful way.
2015-06-23 08:16:58 +02:00

66 lines
1.7 KiB
PHP

<?php
namespace InfluxDB;
use DateTime;
use DateTimeZone;
use InfluxDB\Adapter\GuzzleAdapter as InfluxHttpAdapter;
use InfluxDB\Options;
use InfluxDB\Adapter\UdpAdapter;
use GuzzleHttp\Client as GuzzleHttpClient;
class ClientTest extends \PHPUnit_Framework_TestCase
{
public function testMarkNewMeasurementWithShortSyntax()
{
$mock = $this->prophesize("InfluxDB\\Adapter\\WritableInterface");
$mock->send([
"points" => [
[
"measurement" => "tcp.test",
"fields" => [
"mark" => "element"
]
]
]
])->shouldBeCalledTimes(1);
$object = new Client($mock->reveal());
$object->mark("tcp.test", ["mark" => "element"]);
}
public function testWriteDirectMessages()
{
$mock = $this->prophesize("InfluxDB\\Adapter\\WritableInterface");
$mock->send([
"tags" => [
"dc" => "eu-west-1",
],
"points" => [
[
"measurement" => "vm-serie",
"fields" => [
"cpu" => 18.12,
"free" => 712423,
]
]
]
])->shouldBeCalledTimes(1);
$object = new Client($mock->reveal());
$object->mark([
"tags" => [
"dc" => "eu-west-1",
],
"points" => [
[
"measurement" => "vm-serie",
"fields" => [
"cpu" => 18.12,
"free" => 712423,
],
],
]
]);
}
}