-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
ClientTest.php
51 lines (44 loc) · 1.47 KB
/
ClientTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/** @noinspection StaticClosureCanBeUsedInspection */
/** @noinspection PhpUnhandledExceptionInspection */
declare(strict_types=1);
/**
* Copyright (c) 2021-2024 guanguans<ityaozm@gmail.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/guanguans/notify
*/
namespace Guanguans\NotifyTests\SimplePush;
use Guanguans\Notify\SimplePush\Authenticator;
use Guanguans\Notify\SimplePush\Client;
use Guanguans\Notify\SimplePush\Messages\Message;
it('can send message', function (): void {
$authenticator = new Authenticator('tw8xxx');
$client = new Client($authenticator);
$message = Message::make([
'msg' => 'This is message.',
'title' => 'This is title.',
'event' => 'This is event.',
'actions' => [
[
'name' => 'notify',
'url' => 'https://github.com/guanguans/notify',
],
[
'name' => 'laravel-exception-notify',
'url' => 'https://github.com/guanguans/laravel-exception-notify',
],
],
'attachments' => [
'https://raw.githubusercontent.com/guanguans/notify/main/tests/fixtures/image.png',
],
]);
expect($client)
->mock([
response('{"status":"OK"}'),
response('', 406),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);