-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
ClientTest.php
117 lines (110 loc) · 3.71 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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\MicrosoftTeams;
use Guanguans\Notify\MicrosoftTeams\Authenticator;
use Guanguans\Notify\MicrosoftTeams\Client;
use Guanguans\Notify\MicrosoftTeams\Messages\Message;
use function Pest\Faker\faker;
it('can send message', function (): void {
$authenticator = new Authenticator('Your webhook url.');
$client = new Client($authenticator);
$message = Message::make([
'correlationId' => 'This is correlationId.',
'expectedActors' => [
],
'originator' => 'This is originator.',
'summary' => 'This is summary.',
'themeColor' => '0076D7',
'hideOriginalBody' => false,
'title' => 'This is title.',
'text' => 'This is text.',
'sections' => [],
'potentialAction' => [],
])
->addSection([
'title' => 'This is title.',
'startGroup' => true,
'activityImage' => 'This is activityImage.',
'activityTitle' => 'This is activityTitle.',
'activitySubtitle' => 'This is activitySubtitle.',
'activityText' => 'This is activityText.',
'heroImage' => 'This is heroImage.',
'text' => 'This is text.',
'facts' => [
[
'name' => 'This is name.',
'value' => 'This is value.',
],
],
'images' => [
'This is images.',
],
'potentialAction' => [],
])
->addPotentialAction([
'@type' => 'OpenUri',
'name' => 'This is name.',
'targets' => [
[
'os' => 'default',
'uri' => 'https://learn.microsoft.com/outlook/actionable-messages',
],
],
])
->addPotentialAction([
'@type' => 'HttpPOST',
'name' => 'This is name.',
'target' => 'https://learn.microsoft.com/outlook/actionable-messages',
'headers' => [
[
'name' => 'X-Version',
'value' => 'v1.0.0',
],
],
'body' => [
'field' => 'value',
],
'bodyContentType' => 'application/x-www-form-urlencoded',
])
->addPotentialAction([
'@type' => 'ActionCard',
'name' => 'This is name.',
'inputs' => [
[
'@type' => 'TextInput',
'id' => 'comment',
'isRequired' => true,
'title' => 'This is title.',
'value' => 'This is value.',
'isMultiline' => true,
],
],
'actions' => [],
])
->addPotentialAction([
'@type' => 'InvokeAddInCommand',
'name' => 'This is name.',
'addInId' => '527104a1-f1a5-475a-9199-7a968161c870',
'desktopCommandId' => 'show',
'initializationContext' => [
'property1' => 'This is property1.',
'property2' => 'This is property2.',
],
]);
expect($client)
->mock([
response(faker()->text()),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);