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.
 
 
 
 

162 lines
4.1 KiB

<?php
declare(strict_types=1);
namespace App\Tests\Unit\Model\Alertmanager;
use App\Model\Alertmanager\Label;
use App\Tests\Unit\UnitTester;
use ReflectionException;
final class CommonLabelTest extends UnitTester
{
/**
* @throws ReflectionException
*/
public function testGetAlertName(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
$property = $this->getClassProperty($commonLabel, 'alertname');
$property->setValue($commonLabel, $value);
self::assertEquals($value, $commonLabel->getAlertName());
}
/**
* @throws ReflectionException
*/
public function testSetAlertName(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
self::assertEquals($commonLabel, $commonLabel->setAlertName($value));
self::assertEquals(
$value,
($this->getClassProperty($commonLabel, 'alertname'))
->getValue($commonLabel)
);
}
/**
* @throws ReflectionException
*/
public function testGetInstance(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
$property = $this->getClassProperty($commonLabel, 'instance');
$property->setValue($commonLabel, $value);
self::assertEquals($value, $commonLabel->getInstance());
}
/**
* @throws ReflectionException
*/
public function testSetInstance(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
self::assertEquals($commonLabel, $commonLabel->setInstance($value));
self::assertEquals(
$value,
($this->getClassProperty($commonLabel, 'instance'))
->getValue($commonLabel)
);
}
/**
* @throws ReflectionException
*/
public function testGetJob(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
$property = $this->getClassProperty($commonLabel, 'job');
$property->setValue($commonLabel, $value);
self::assertEquals($value, $commonLabel->getJob());
}
/**
* @throws ReflectionException
*/
public function testSetJob(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
self::assertEquals($commonLabel, $commonLabel->setJob($value));
self::assertEquals(
$value,
($this->getClassProperty($commonLabel, 'job'))
->getValue($commonLabel)
);
}
/**
* @throws ReflectionException
*/
public function testGetMonitor(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
$property = $this->getClassProperty($commonLabel, 'monitor');
$property->setValue($commonLabel, $value);
self::assertEquals($value, $commonLabel->getMonitor());
}
/**
* @throws ReflectionException
*/
public function testSetMonitor(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
self::assertEquals($commonLabel, $commonLabel->setMonitor($value));
self::assertEquals(
$value,
($this->getClassProperty($commonLabel, 'monitor'))
->getValue($commonLabel)
);
}
/**
* @throws ReflectionException
*/
public function testGetSeverity(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
$property = $this->getClassProperty($commonLabel, 'severity');
$property->setValue($commonLabel, $value);
self::assertEquals($value, $commonLabel->getSeverity());
}
/**
* @throws ReflectionException
*/
public function testSetSeverity(): void
{
$commonLabel = new Label();
$value = $this->faker->sha256();
self::assertEquals($commonLabel, $commonLabel->setSeverity($value));
self::assertEquals(
$value,
($this->getClassProperty($commonLabel, 'severity'))
->getValue($commonLabel)
);
}
}