-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientTest.php
More file actions
44 lines (37 loc) · 1.44 KB
/
ClientTest.php
File metadata and controls
44 lines (37 loc) · 1.44 KB
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
<?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\PushPlus;
use Guanguans\Notify\PushPlus\Authenticator;
use Guanguans\Notify\PushPlus\Client;
use Guanguans\Notify\PushPlus\Messages\Message;
it('can send message', function (): void {
$authenticator = new Authenticator('f8fbd292ba3a4875967fd81bf0290');
$client = new Client($authenticator);
$message = Message::make([
// 'topic' => 'This is group.', // 群组消息
// 'to' => '5813c18bb0fa462789028312dae30224', // 好友消息
'title' => 'This is title.',
'content' => 'This is content',
'template' => 'html',
'channel' => 'wechat',
'webhook' => 'pushplus',
'callbackUrl' => 'https://www.guanguans.cn',
'timestamp' => time() * 1001,
]);
expect($client)
->mock([
create_response('{"code":200,"msg":"请求成功","data":"aab34a37c1ff49ef8087cb3cd2c0d1ff","count":null}'),
create_response('{"code":903,"msg":"无效的用户token","data":null}'),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);