19 changed files with 996 additions and 44 deletions
-
2.gitignore
-
1app/.gitignore
-
8app/composer.json
-
195app/composer.lock
-
45app/src/Controller/Api/v1/MattermostController.php
-
64app/src/Model/Grafana/EvalMatches.php
-
211app/src/Model/Grafana/GrafanaMessage.php
-
12app/src/Service/Mattermost/MattermostService.php
-
3app/src/Service/Mattermost/MattermostServiceInterface.php
-
6app/symfony.lock
-
2app/tests/Unit/Controller/Api/v1/MattermostControllerTest.php
-
2app/tests/Unit/KernelTest.php
-
110app/tests/Unit/Model/Grafana/EvalMatchesTest.php
-
313app/tests/Unit/Model/Grafana/GrafanaMessageTest.php
-
28app/tests/Unit/Service/Mattermost/MattermostServiceTest.php
-
10app/tests/Unit/UnitTester.php
-
17devops/docker/php/Dockerfile
-
1devops/docker/php/xdebug.ini
-
10docker-compose-local.yml
@ -0,0 +1,2 @@ |
|||||
|
/app/.phpunit.result.cache |
||||
|
/.phpunit.result.cache |
@ -1,3 +1,2 @@ |
|||||
/.env |
/.env |
||||
/.phpunit.result.cache |
|
||||
/phpunit.xml |
/phpunit.xml |
@ -0,0 +1,64 @@ |
|||||
|
<?php |
||||
|
|
||||
|
declare(strict_types=1); |
||||
|
|
||||
|
namespace App\Model\Grafana; |
||||
|
|
||||
|
use OpenApi\Annotations as OA; |
||||
|
|
||||
|
/** |
||||
|
* @OA\Schema( |
||||
|
* required={"value", "metric", "tags"} |
||||
|
* ) |
||||
|
*/ |
||||
|
class EvalMatches |
||||
|
{ |
||||
|
/** |
||||
|
* @OA\Property(description="", example="1") |
||||
|
*/ |
||||
|
protected int $value; |
||||
|
/** |
||||
|
* @OA\Property(description="", example="metric") |
||||
|
*/ |
||||
|
protected string $metric; |
||||
|
/** |
||||
|
* @OA\Property(description="") |
||||
|
*/ |
||||
|
protected ?string $tags; |
||||
|
|
||||
|
public function getValue(): int |
||||
|
{ |
||||
|
return $this->value; |
||||
|
} |
||||
|
|
||||
|
public function setValue(int $value): self |
||||
|
{ |
||||
|
$this->value = $value; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getMetric(): string |
||||
|
{ |
||||
|
return $this->metric; |
||||
|
} |
||||
|
|
||||
|
public function setMetric(string $metric): self |
||||
|
{ |
||||
|
$this->metric = $metric; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getTags(): ?string |
||||
|
{ |
||||
|
return $this->tags; |
||||
|
} |
||||
|
|
||||
|
public function setTags(?string $tags): self |
||||
|
{ |
||||
|
$this->tags = $tags; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
} |
@ -0,0 +1,211 @@ |
|||||
|
<?php |
||||
|
|
||||
|
declare(strict_types=1); |
||||
|
|
||||
|
namespace App\Model\Grafana; |
||||
|
|
||||
|
use OpenApi\Annotations as OA; |
||||
|
|
||||
|
/** |
||||
|
* @OA\Schema( |
||||
|
* required={ |
||||
|
* "dashboardId", |
||||
|
* "evalMatches", |
||||
|
* "imageUrl", |
||||
|
* "message", |
||||
|
* "orgId", |
||||
|
* "panelId", |
||||
|
* "ruleId", |
||||
|
* "ruleName", |
||||
|
* "ruleUrl", |
||||
|
* "state", |
||||
|
* "title" |
||||
|
* } |
||||
|
* ) |
||||
|
*/ |
||||
|
class GrafanaMessage |
||||
|
{ |
||||
|
/** |
||||
|
* @OA\Property(example="1") |
||||
|
*/ |
||||
|
protected int $dashboardId; |
||||
|
/** |
||||
|
* @var EvalMatches[] |
||||
|
* @OA\Property() |
||||
|
*/ |
||||
|
protected array $evalMatches; |
||||
|
/** |
||||
|
* @OA\Property(example="https://grafana.com/assets/img/blog/mixed_styles.png") |
||||
|
*/ |
||||
|
protected string $imageUrl; |
||||
|
/** |
||||
|
* @OA\Property(example="Notification Message") |
||||
|
*/ |
||||
|
protected string $message; |
||||
|
/** |
||||
|
* @OA\Property(example="1") |
||||
|
*/ |
||||
|
protected int $orgId; |
||||
|
/** |
||||
|
* @OA\Property(example="2") |
||||
|
*/ |
||||
|
protected int $panelId; |
||||
|
/** |
||||
|
* @OA\Property(example="3") |
||||
|
*/ |
||||
|
protected int $ruleId; |
||||
|
/** |
||||
|
* @OA\Property(example="Panel Title alert") |
||||
|
*/ |
||||
|
protected string $ruleName; |
||||
|
/** |
||||
|
* @OA\Property(example="http://localhost:3000/d/hZ7BuVbWz/test-dashboard?fullscreen\u0026edit\u0026tab=alert\u0026panelId=2\u0026orgId=1") |
||||
|
*/ |
||||
|
protected string $ruleUrl; |
||||
|
/** |
||||
|
* @OA\Property(example="alerting") |
||||
|
*/ |
||||
|
protected string $state; |
||||
|
/** |
||||
|
* @OA\Property(example="[Alerting] Panel Title alert") |
||||
|
*/ |
||||
|
protected string $title; |
||||
|
|
||||
|
public function getDashboardId(): int |
||||
|
{ |
||||
|
return $this->dashboardId; |
||||
|
} |
||||
|
|
||||
|
public function setDashboardId(int $dashboardId): self |
||||
|
{ |
||||
|
$this->dashboardId = $dashboardId; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return EvalMatches[] |
||||
|
*/ |
||||
|
public function getEvalMatches(): array |
||||
|
{ |
||||
|
return $this->evalMatches; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param EvalMatches[] $evalMatches |
||||
|
*/ |
||||
|
public function setEvalMatches(array $evalMatches): self |
||||
|
{ |
||||
|
$this->evalMatches = $evalMatches; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getImageUrl(): string |
||||
|
{ |
||||
|
return $this->imageUrl; |
||||
|
} |
||||
|
|
||||
|
public function setImageUrl(string $imageUrl): self |
||||
|
{ |
||||
|
$this->imageUrl = $imageUrl; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getMessage(): string |
||||
|
{ |
||||
|
return $this->message; |
||||
|
} |
||||
|
|
||||
|
public function setMessage(string $message): self |
||||
|
{ |
||||
|
$this->message = $message; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getOrgId(): int |
||||
|
{ |
||||
|
return $this->orgId; |
||||
|
} |
||||
|
|
||||
|
public function setOrgId(int $orgId): self |
||||
|
{ |
||||
|
$this->orgId = $orgId; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getPanelId(): int |
||||
|
{ |
||||
|
return $this->panelId; |
||||
|
} |
||||
|
|
||||
|
public function setPanelId(int $panelId): self |
||||
|
{ |
||||
|
$this->panelId = $panelId; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getRuleId(): int |
||||
|
{ |
||||
|
return $this->ruleId; |
||||
|
} |
||||
|
|
||||
|
public function setRuleId(int $ruleId): self |
||||
|
{ |
||||
|
$this->ruleId = $ruleId; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getRuleName(): string |
||||
|
{ |
||||
|
return $this->ruleName; |
||||
|
} |
||||
|
|
||||
|
public function setRuleName(string $ruleName): self |
||||
|
{ |
||||
|
$this->ruleName = $ruleName; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getRuleUrl(): string |
||||
|
{ |
||||
|
return $this->ruleUrl; |
||||
|
} |
||||
|
|
||||
|
public function setRuleUrl(string $ruleUrl): self |
||||
|
{ |
||||
|
$this->ruleUrl = $ruleUrl; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getState(): string |
||||
|
{ |
||||
|
return $this->state; |
||||
|
} |
||||
|
|
||||
|
public function setState(string $state): self |
||||
|
{ |
||||
|
$this->state = $state; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
public function getTitle(): string |
||||
|
{ |
||||
|
return $this->title; |
||||
|
} |
||||
|
|
||||
|
public function setTitle(string $title): self |
||||
|
{ |
||||
|
$this->title = $title; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
} |
@ -0,0 +1,110 @@ |
|||||
|
<?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()], |
||||
|
]; |
||||
|
} |
||||
|
} |
@ -0,0 +1,313 @@ |
|||||
|
<?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 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) |
||||
|
); |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue