-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathClientTest.php
41 lines (34 loc) · 1.28 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
<?php
/** @noinspection AnonymousFunctionStaticInspection */
/** @noinspection PhpPossiblePolymorphicInvocationInspection */
/** @noinspection PhpUnhandledExceptionInspection */
/** @noinspection StaticClosureCanBeUsedInspection */
declare(strict_types=1);
/**
* Copyright (c) 2021-2025 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\AnPush;
use Guanguans\Notify\AnPush\Authenticator;
use Guanguans\Notify\AnPush\Client;
use Guanguans\Notify\AnPush\Messages\Message;
it('can send message', function (): void {
$authenticator = new Authenticator('FE3LGGYQZXRZ6A50BN66M42H0BY');
$client = new Client($authenticator);
$message = Message::make([
'title' => 'This is title.',
'content' => 'This is content.',
'channel' => '94412',
// 'to' => 'ov_1i8jk39d****',
]);
expect($client)
->mock([
response('{"msg":"success","code":200,"data":{"msgIds":[{"channelId":"94412","msgId":1715333937401}]}}'),
response('{"msg":"Token not found","code":10006}'),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);