grafana -> notification-provider -> mattermost | see https://gitlab.fedy95.com/dev/notification-provider
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.7 KiB
110 lines
2.7 KiB
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Unit\Model\Grafana;
|
|
|
|
use App\Model\Grafana\EvalMatches;
|
|
use App\Tests\Unit\UnitTester;
|
|
use ReflectionException;
|
|
|
|
final class EvalMatchesTest extends UnitTester
|
|
{
|
|
/**
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testGetValue(): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
$value = $this->faker->randomNumber();
|
|
|
|
$property = $this->getClassProperty($evalMatches, 'value');
|
|
$property->setValue($evalMatches, $value);
|
|
|
|
self::assertEquals($value, $evalMatches->getValue());
|
|
}
|
|
|
|
/**
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testSetValue(): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
$value = $this->faker->randomNumber();
|
|
|
|
self::assertEquals($evalMatches, $evalMatches->setValue($value));
|
|
self::assertEquals(
|
|
$value,
|
|
($this->getClassProperty($evalMatches, 'value'))
|
|
->getValue($evalMatches)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testGetMetric(): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
$value = $this->faker->sha256();
|
|
|
|
$property = $this->getClassProperty($evalMatches, 'metric');
|
|
$property->setValue($evalMatches, $value);
|
|
|
|
self::assertEquals($value, $evalMatches->getMetric());
|
|
}
|
|
|
|
/**
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testSetMetric(): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
$value = $this->faker->sha256();
|
|
|
|
self::assertEquals($evalMatches, $evalMatches->setMetric($value));
|
|
self::assertEquals(
|
|
$value,
|
|
($this->getClassProperty($evalMatches, 'metric'))
|
|
->getValue($evalMatches)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider dataProviderTags
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testGetTags(?string $value): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
|
|
$property = $this->getClassProperty($evalMatches, 'tags');
|
|
$property->setValue($evalMatches, $value);
|
|
|
|
self::assertEquals($value, $evalMatches->getTags());
|
|
}
|
|
|
|
/**
|
|
* @dataProvider dataProviderTags
|
|
* @throws ReflectionException
|
|
*/
|
|
public function testSetTags(?string $value): void
|
|
{
|
|
$evalMatches = new EvalMatches();
|
|
|
|
self::assertEquals($evalMatches, $evalMatches->setTags($value));
|
|
self::assertEquals(
|
|
$value,
|
|
($this->getClassProperty($evalMatches, 'tags'))
|
|
->getValue($evalMatches)
|
|
);
|
|
}
|
|
|
|
public function dataProviderTags(): array
|
|
{
|
|
return [
|
|
['tags' => null],
|
|
['tags' => $this->faker->sha256()],
|
|
];
|
|
}
|
|
}
|