-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
ClientTest.php
39 lines (32 loc) · 1.15 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
<?php
/** @noinspection StaticClosureCanBeUsedInspection */
/** @noinspection PhpUnhandledExceptionInspection */
declare(strict_types=1);
/**
* Copyright (c) 2021-2024 guanguans<[email protected]>
*
* 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\WPush;
use Guanguans\Notify\WPush\Authenticator;
use Guanguans\Notify\WPush\Client;
use Guanguans\Notify\WPush\Messages\Message;
it('can send message', function (): void {
$authenticator = new Authenticator('WPUSHXtvzuCujtOcL1cFkF1NC9aef');
$client = new Client($authenticator);
$message = Message::make([
'title' => 'This is title.',
'content' => 'This is content.',
'channel' => 'wechat',
// 'topic_code' => 'topic_code',
]);
expect($client)
->mock([
response('{"code":0,"message":"success","data":"50285451654725632"}'),
response('{"code":401,"message":"API Key错误","data":null}'),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);