-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathClientTest.php
More file actions
109 lines (104 loc) · 3.7 KB
/
Copy pathClientTest.php
File metadata and controls
109 lines (104 loc) · 3.7 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
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
<?php
/** @noinspection AnonymousFunctionStaticInspection */
/** @noinspection NullPointerExceptionInspection */
/** @noinspection PhpFieldAssignmentTypeMismatchInspection */
/** @noinspection PhpPossiblePolymorphicInvocationInspection */
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUnhandledExceptionInspection */
/** @noinspection PhpVoidFunctionResultUsedInspection */
/** @noinspection StaticClosureCanBeUsedInspection */
declare(strict_types=1);
/**
* Copyright (c) 2021-2026 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
*/
use Guanguans\Notify\ZohoCliqWebHook\Authenticator;
use Guanguans\Notify\ZohoCliqWebHook\Client;
use Guanguans\Notify\ZohoCliqWebHook\Messages\Message;
it('can send message', function (): void {
$authenticator = new Authenticator(
'https://cliq.zoho.com/api/v2/channelsbyname/announcements/message?zapikey=1001.4805235707f212af4b11be76483da614.d95141b05ae0550eabe503061a598'
);
$client = new Client($authenticator);
$message = Message::make([
'text' => 'This is text.',
'bot' => [
'name' => 'This is bot name.',
'image' => 'https://www.zoho.com/cliq/help/restapi/images/bot-custom.png',
],
'card' => [
'title' => 'This is card title.',
'theme' => 'modern-inline',
'thumbnail' => 'https://www.zoho.com/cliq/help/restapi/images/announce_icon.png',
],
'slides' => [
[
'type' => 'table',
'title' => 'This is slide table title.',
'data' => [
'headers' => [
'Name',
'Team',
'Reporting To',
],
'rows' => [
[
'Name' => 'Paula Rojas',
'Team' => 'Zylker-Sales',
'Reporting To' => 'Li Jung',
],
[
'Name' => 'Quinn Rivers',
'Team' => 'Zylker-Marketing',
'Reporting To' => 'Patricia James',
],
],
],
],
],
'buttons' => [
[
'label' => 'View button',
'type' => '+',
'action' => [
'type' => 'invoke.function',
'data' => [
'name' => 'internlist',
],
],
],
],
])
->addSlide([
'type' => 'list',
'title' => 'This is slide list title.',
'data' => [
'Time - Tracking for Tasks',
'Prioritize requirements effectively',
'Identify and work on a fix for bugs instantly',
],
])
->addButton([
'label' => 'Cancel button',
'type' => '-',
'action' => [
'type' => 'invoke.function',
'data' => [
'name' => 'internlist',
],
],
])
->threadMessageId('1599044334698_117280617320')
->threadTitle('This is thread title.')
->postInParent(true);
expect($client)
->mock([
response(status: 204),
response('{"code":"oauthtoken_invalid","message":"Invalid OAuth token passed."}', 401),
])
->assertCanSendMessage($message);
})->group(__DIR__, __FILE__);