-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathClientTest.php
39 lines (32 loc) · 1.2 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-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\PushDeer;
use Guanguans\Notify\PushDeer\Authenticator;
use Guanguans\Notify\PushDeer\Client;
use Guanguans\Notify\PushDeer\Messages\Message;
use function Pest\Faker\faker;
it('can send message', function (): void {
$authenticator = new Authenticator('PDU3062THLWPFpHEmFQrKhFp9Tlz9q0qE9Nfz');
$client = new Client($authenticator);
$message = Message::make([
'text' => '## This is text.',
'desp' => '> This is desp.',
'type' => 'markdown',
]);
expect($client)
->mock([
response('{"code":0,"content":{"result":["{\"counts\":1,\"logs\":[],\"success\":\"ok\"}","{\"counts\":1,\"logs\":[],\"success\":\"ok\"}"]}}'),
response(faker()->randomHtml(), 500),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);