assertInstanceOf(Alert::class, $alert); $this->assertEquals(Priority::moderate(), $alert->getPriority()); } public function testCanCreateAlertWithPriority() { $alert = new Alert("entity", 'alias', "message", "source", Priority::informational()); $this->assertInstanceOf(Alert::class, $alert); $this->assertEquals(Priority::informational(), $alert->getPriority()); } public function testCanReadEntity() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEquals("entity", $alert->getEntity()); } public function testCanReadAlias() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEquals("alias", $alert->getAlias()); } public function testCanReadMessage() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEquals("message", $alert->getMessage()); } public function testCanReadSource() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEquals("source", $alert->getSource()); } public function testDescriptionIsOptional() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertNull($alert->getDescription()); } public function testCanSetDescription() { $alert = new Alert("entity", 'alias', "message", "source"); $alert->setDescription("dingens"); $this->assertEquals("dingens", $alert->getDescription()); } public function testResponderIsOptional() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEmpty($alert->getResponders()); } public function testSetResponder() { $alert = new Alert("entity", 'alias', "message", "source"); $alert->appendResponder($this->createMock(Responder::class)); $this->assertCount(1, $alert->getResponders()); } public function testTagIsOptional() { $alert = new Alert("entity", 'alias', "message", "source"); $this->assertEmpty($alert->getTags()); } public function testAppendTag() { $alert = new Alert("entity", 'alias', "message", "source"); $alert->appendTag('foo') ->appendTag(2); $this->assertCount(2, $alert->getTags()); $this->assertEquals(['foo', '2'], $alert->getTags()); } }