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.
 
 
 
 

343 lines
9.3 KiB

<?php
declare(strict_types=1);
namespace App\Tests\Unit\Model\Grafana;
use App\Model\Grafana\EvalMatches;
use App\Model\Grafana\GrafanaMessage;
use App\Tests\Unit\UnitTester;
use ReflectionException;
final class GrafanaMessageTest extends UnitTester
{
/**
* @throws ReflectionException
*/
public function testGetDashboardId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
$property = $this->getClassProperty($grafanaMessage, 'dashboardId');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getDashboardId());
}
/**
* @throws ReflectionException
*/
public function testSetDashboardId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
self::assertEquals($grafanaMessage, $grafanaMessage->setDashboardId($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'dashboardId'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetEvalMatches(): void
{
$grafanaMessage = new GrafanaMessage();
$value = [new EvalMatches()];
$property = $this->getClassProperty($grafanaMessage, 'evalMatches');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getEvalMatches());
}
/**
* @throws ReflectionException
*/
public function testSetEvalMatches(): void
{
$grafanaMessage = new GrafanaMessage();
$value = [new EvalMatches()];
self::assertEquals($grafanaMessage, $grafanaMessage->setEvalMatches($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'evalMatches'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetImageUrl(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'imageUrl');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getImageUrl());
}
/**
* @throws ReflectionException
*/
public function testSetImageUrl(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setImageUrl($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'imageUrl'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetMessage(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'message');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getMessage());
}
/**
* @throws ReflectionException
*/
public function testSetMessage(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setMessage($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'message'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetOrgId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
$property = $this->getClassProperty($grafanaMessage, 'orgId');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getOrgId());
}
/**
* @throws ReflectionException
*/
public function testSetOrgId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
self::assertEquals($grafanaMessage, $grafanaMessage->setOrgId($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'orgId'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetPanelId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
$property = $this->getClassProperty($grafanaMessage, 'panelId');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getPanelId());
}
/**
* @throws ReflectionException
*/
public function testSetPanelId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
self::assertEquals($grafanaMessage, $grafanaMessage->setPanelId($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'panelId'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetRuleId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
$property = $this->getClassProperty($grafanaMessage, 'ruleId');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getRuleId());
}
/**
* @throws ReflectionException
*/
public function testSetRuleId(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->randomNumber();
self::assertEquals($grafanaMessage, $grafanaMessage->setRuleId($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'ruleId'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetRuleName(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'ruleName');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getRuleName());
}
/**
* @throws ReflectionException
*/
public function testSetRuleName(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setRuleName($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'ruleName'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetRuleUrl(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'ruleUrl');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getRuleUrl());
}
/**
* @throws ReflectionException
*/
public function testSetRuleUrl(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setRuleUrl($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'ruleUrl'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetState(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'state');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getState());
}
/**
* @throws ReflectionException
*/
public function testSetState(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setState($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'state'))
->getValue($grafanaMessage)
);
}
/**
* @throws ReflectionException
*/
public function testGetTitle(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
$property = $this->getClassProperty($grafanaMessage, 'title');
$property->setValue($grafanaMessage, $value);
self::assertEquals($value, $grafanaMessage->getTitle());
}
/**
* @throws ReflectionException
*/
public function testSetTitle(): void
{
$grafanaMessage = new GrafanaMessage();
$value = $this->faker->sha256();
self::assertEquals($grafanaMessage, $grafanaMessage->setTitle($value));
self::assertEquals(
$value,
($this->getClassProperty($grafanaMessage, 'title'))
->getValue($grafanaMessage)
);
}
}