-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
ClientTest.php
49 lines (42 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
<?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\Mattermost;
use Guanguans\Notify\Mattermost\Authenticator;
use Guanguans\Notify\Mattermost\Client;
use Guanguans\Notify\Mattermost\Messages\Message;
use function Pest\Faker\faker;
it('can send message', function (): void {
$authenticator = new Authenticator('r7jezodttibgueijpahyyfh1qa');
$client = new Client($authenticator);
$message = Message::make([
'channel_id' => 'sat5ohbs5byixd86tmxtk13',
'message' => 'This is message.',
'is_pinned' => true,
'create_at' => 1639041968509,
'edit_at' => 1639041968509,
'root_id' => '',
'original_id' => '',
'type' => '',
'pending_post_id' => '1639041968509abc',
'participants' => null,
'props' => ['key' => 'value'],
'file_ids' => ['o3x4y157jff5xydf5m91bft1oo'],
]);
expect($client)
// ->baseUri('https://guanguans.cloud.mattermost.com')
->baseUri('Your mattermost server url.')
->mock([
response(faker()->text()),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);