Skip to content

Commit b6da8e9

Browse files
committed
test(ClientTest): Add attachment and device to message
- Added 'attachment' field with 'tests/fixtures/image.png' - Added 'device' field with 'This is device.' - Updated message fields: 'html', 'priority', 'sound', 'timestamp', 'title', 'ttl', 'url', 'url_title', 'retry', 'expire', 'monospace', 'callback'
1 parent dddb7fe commit b6da8e9

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

tests/Pushover/ClientTest.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Guanguans\Notify\Pushover\Authenticator;
1919
use Guanguans\Notify\Pushover\Client;
2020
use Guanguans\Notify\Pushover\Messages\Message;
21-
use Psr\Http\Message\ResponseInterface;
2221

2322
it('can send message', function (): void {
2423
$authenticator = new Authenticator(
@@ -28,26 +27,26 @@
2827
$client = new Client($authenticator);
2928
$message = Message::make([
3029
'message' => 'This is message.',
31-
// 'title' => 'This is title.',
32-
// 'timestamp' => time(),
33-
// 'priority' => 2,
34-
// 'url' => 'https://www.guanguans.cn',
35-
// 'url_title' => 'This is URL title.',
36-
// 'sound' => 'none',
37-
// 'retry' => 60,
38-
// 'expire' => 3600,
39-
// 'html' => 1,
40-
// 'monospace' => 0,
41-
// 'callback' => 'https://www.guanguans.cn/',
42-
// 'device' => 'This is device.',
43-
// 'attachment' => '/Users/yaozm/Downloads/images.jpeg',
30+
'attachment' => 'tests/fixtures/image.png',
31+
'device' => 'This is device.',
32+
'html' => 1,
33+
'priority' => 2,
34+
'sound' => 'none',
35+
'timestamp' => time(),
36+
'title' => 'This is title.',
37+
'ttl' => 3600,
38+
'url' => 'https://www.guanguans.cn',
39+
'url_title' => 'This is url title.',
40+
'retry' => 60,
41+
'expire' => 3600,
42+
'monospace' => 0,
43+
'callback' => 'https://www.guanguans.cn/',
4444
]);
4545

4646
expect($client)
4747
->mock([
4848
create_response('{"status":1,"request":"a84b20eb-b69e-4687-83d1-bab8ee2d0e40"}'),
4949
create_response('{"token":"invalid","errors":["application token is invalid, see https://pushover.net/api"],"status":0,"request":"5c4487c0-a61a-497e-9205-3441a99471b0"}', 400),
5050
])
51-
->send($message)->toBeInstanceOf(ResponseInterface::class)
52-
->send($message)->toBeInstanceOf(ResponseInterface::class);
51+
->assertCanSendMessage($message);
5352
})->group(__DIR__, __FILE__);

0 commit comments

Comments
 (0)