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.
 
 
 
 

224 lines
5.4 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\Alert;
use App\Tests\Unit\UnitTester;
use ReflectionException;
final class AlertTest extends UnitTester
{
/**
* @throws ReflectionException
*/
public function testGetStatus(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
$property = $this->getClassProperty($alert, 'status');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getStatus());
}
/**
* @throws ReflectionException
*/
public function testSetStatus(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
self::assertEquals($alert, $alert->setStatus($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'status'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetLabels(): void
{
$alert = new Alert();
$value = new Label();
$property = $this->getClassProperty($alert, 'labels');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getLabels());
}
/**
* @throws ReflectionException
*/
public function testSetLabels(): void
{
$alert = new Alert();
$value = new Label();
self::assertEquals($alert, $alert->setLabels($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'labels'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetCommonAnnotations(): void
{
$alert = new Alert();
$value = new Annotation();
$property = $this->getClassProperty($alert, 'annotations');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getAnnotations());
}
/**
* @throws ReflectionException
*/
public function testSetCommonAnnotations(): void
{
$alert = new Alert();
$value = new Annotation();
self::assertEquals($alert, $alert->setAnnotations($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'annotations'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetStartsAt(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
$property = $this->getClassProperty($alert, 'startsAt');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getStartsAt());
}
/**
* @throws ReflectionException
*/
public function testSetStartsAt(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
self::assertEquals($alert, $alert->setStartsAt($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'startsAt'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetEndsAt(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
$property = $this->getClassProperty($alert, 'endsAt');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getEndsAt());
}
/**
* @throws ReflectionException
*/
public function testSetEndsAt(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
self::assertEquals($alert, $alert->setEndsAt($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'endsAt'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetGeneratorURL(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
$property = $this->getClassProperty($alert, 'generatorURL');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getGeneratorURL());
}
/**
* @throws ReflectionException
*/
public function testSetGeneratorURL(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
self::assertEquals($alert, $alert->setGeneratorURL($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'generatorURL'))
->getValue($alert)
);
}
/**
* @throws ReflectionException
*/
public function testGetFingerprint(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
$property = $this->getClassProperty($alert, 'fingerprint');
$property->setValue($alert, $value);
self::assertEquals($value, $alert->getFingerprint());
}
/**
* @throws ReflectionException
*/
public function testSetFingerprint(): void
{
$alert = new Alert();
$value = $this->faker->sha256();
self::assertEquals($alert, $alert->setFingerprint($value));
self::assertEquals(
$value,
($this->getClassProperty($alert, 'fingerprint'))
->getValue($alert)
);
}
}