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.
 
 
 
 

121 lines
3.0 KiB

<?php
declare(strict_types=1);
namespace App\Tests\Unit\Model\Alertmanager;
use App\Model\Alertmanager\Annotation;
use App\Model\Alertmanager\Label;
use App\Model\Alertmanager\Message;
use App\Model\Alertmanager\Status;
use App\Tests\Unit\UnitTester;
use ReflectionException;
final class StatusTest extends UnitTester
{
/**
* @throws ReflectionException
*/
public function testGetState(): void
{
$status = new Status();
$state = $this->faker->sha256();
$property = $this->getClassProperty($status, 'state');
$property->setValue($status, $state);
self::assertEquals($state, $status->getState());
}
/**
* @throws ReflectionException
*/
public function testSetLabels(): void
{
$status = new Status();
$state = $this->faker->sha256();
self::assertEquals($status, $status->setState($state));
self::assertEquals(
$state,
($this->getClassProperty($status, 'state'))
->getValue($status)
);
}
/**
* @dataProvider dataProviderSilencedBy
* @throws ReflectionException
*/
public function testGetSilencedBy(?string $silencedBy): void
{
$status = new Status();
$property = $this->getClassProperty($status, 'silencedBy');
$property->setValue($status, $silencedBy);
self::assertEquals($silencedBy, $status->getSilencedBy());
}
/**
* @dataProvider dataProviderSilencedBy
* @throws ReflectionException
*/
public function testSetSilencedBy(?string $silencedBy): void
{
$status = new Status();
self::assertEquals($status, $status->setSilencedBy($silencedBy));
self::assertEquals(
$silencedBy,
($this->getClassProperty($status, 'silencedBy'))
->getValue($status)
);
}
public function dataProviderSilencedBy(): array
{
return [
['silencedBy' => null],
['silencedBy' => $this->faker->sha256()],
];
}
/**
* @dataProvider dataProviderInhibitedBy
* @throws ReflectionException
*/
public function testGetInhibitedBy(?string $inhibitedBy): void
{
$status = new Status();
$property = $this->getClassProperty($status, 'inhibitedBy');
$property->setValue($status, $inhibitedBy);
self::assertEquals($inhibitedBy, $status->getInhibitedBy());
}
/**
* @dataProvider dataProviderInhibitedBy
* @throws ReflectionException
*/
public function testSetInhibitedBy(?string $inhibitedBy): void
{
$status = new Status();
self::assertEquals($status, $status->setInhibitedBy($inhibitedBy));
self::assertEquals(
$inhibitedBy,
($this->getClassProperty($status, 'inhibitedBy'))
->getValue($status)
);
}
public function dataProviderInhibitedBy(): array
{
return [
['inhibitedBy' => null],
['inhibitedBy' => $this->faker->sha256()],
];
}
}