File tree 2 files changed +55
-2
lines changed
src/Symfony/Component/Notifier/Bridge/GoogleChat
2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ public function toArray(): array
62
62
}
63
63
64
64
/**
65
+ * @deprecated google chat cards-v1 deprecated, use "cardV2()" instead.
66
+ *
65
67
* @return $this
66
68
*/
67
69
public function card (array $ card ): static
@@ -71,6 +73,16 @@ public function card(array $card): static
71
73
return $ this ;
72
74
}
73
75
76
+ /**
77
+ * @return $this
78
+ */
79
+ public function cardV2 (array $ card ): static
80
+ {
81
+ $ this ->options ['cardsV2 ' ][] = $ card ;
82
+
83
+ return $ this ;
84
+ }
85
+
74
86
/**
75
87
* @return $this
76
88
*/
Original file line number Diff line number Diff line change 16
16
17
17
final class GoogleChatOptionsTest extends TestCase
18
18
{
19
- public function testToArray ()
19
+ public function testToArray (): void
20
20
{
21
21
$ options = new GoogleChatOptions ();
22
22
@@ -34,7 +34,48 @@ public function testToArray()
34
34
$ this ->assertSame ($ expected , $ options ->toArray ());
35
35
}
36
36
37
- public function testOptionsWithThread ()
37
+ public function testToArrayWithCardV2 (): void
38
+ {
39
+ $ options = new GoogleChatOptions ();
40
+
41
+ $ cardV2 = [
42
+ 'header ' => [
43
+ 'title ' => 'Sasha ' ,
44
+ 'subtitle ' => 'Software Engineer ' ,
45
+ 'imageUrl ' => 'https://developers.google.com/chat/images/quickstart-app-avatar.png ' ,
46
+ 'imageType ' => 'CIRCLE ' ,
47
+ 'imageAltText ' => 'Avatar for Sasha '
48
+ ],
49
+ 'sections ' => [
50
+ [
51
+ 'header ' => 'Contact Info ' ,
52
+ "collapsible " => true ,
53
+ 'widgets ' => [
54
+ 'decoratedText ' => [
55
+ 'startIcon ' => ['knownIcon ' => 'EMAIL ' ],
56
+ 'text ' => 'sasha@example.com ' ,
57
+ ]
58
+ ]
59
+ ]
60
+ ]
61
+ ];
62
+
63
+ $ options
64
+ ->text ('Hello Bot ' )
65
+ ->cardV2 ($ cardV2 )
66
+ ;
67
+
68
+ $ expected = [
69
+ 'text ' => 'Hello Bot ' ,
70
+ 'cardsV2 ' => [
71
+ $ cardV2 ,
72
+ ],
73
+ ];
74
+
75
+ $ this ->assertSame ($ expected , $ options ->toArray ());
76
+ }
77
+
78
+ public function testOptionsWithThread (): void
38
79
{
39
80
$ thread = 'fgh.ijk ' ;
40
81
$ options = new GoogleChatOptions ();
You can’t perform that action at this time.
0 commit comments