Skip to content

Commit c7810ee

Browse files
committed
fix: add tests for callback url and correct codestyle
1 parent 89542cd commit c7810ee

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/PushoverMessage.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ class PushoverMessage
8787
public string|null $image = null;
8888
/**
8989
* The (optional) publicly-accessible url that Pushover will use to notify your system when a user
90-
* acknowledges an Emergency notification
90+
* acknowledges an Emergency notification.
91+
*
9192
* @var string|null
9293
*/
9394
public string|null $callback = null;
@@ -332,9 +333,9 @@ public function emergencyPriority(int $retryTimeout, int $expireAfter): static
332333

333334
/**
334335
* Set the callback url used by pushover to let your system
335-
* know when a emergency notification has been acknowledged
336+
* know when a emergency notification has been acknowledged.
336337
*
337-
* @param string $url
338+
* @param string $url
338339
* @return $this
339340
*/
340341
public function callback(string $url): static
@@ -364,7 +365,7 @@ public function toArray(): array
364365
'expire' => $this->expire,
365366
'html' => $this->format === static::FORMAT_HTML,
366367
'monospace' => $this->format === static::FORMAT_MONOSPACE,
367-
'callback' => $this->callback
368+
'callback' => $this->callback,
368369
];
369370
}
370371

tests/PushoverMessageTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,13 @@ public function it_can_set_the_priority_to_emergency(): void
190190

191191
$this->assertEquals(2, $this->message->priority);
192192
}
193+
194+
public function it_can_set_the_callback_url(): void
195+
{
196+
$callbackUrl = 'https://www.example.com/callback';
197+
198+
$this->message->callback($callbackUrl);
199+
200+
$this->assertEquals($callbackUrl, $this->message->callback);
201+
}
193202
}

0 commit comments

Comments
 (0)