File tree Expand file tree Collapse file tree
tests/Requests/PostNotification Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Keboola \NotificationClient \Tests \Requests \PostNotification ;
6+
7+ use Keboola \NotificationClient \Requests \PostNotification \ProjectEmail ;
8+ use Keboola \NotificationClient \Requests \PostSubscription \EmailRecipient ;
9+ use PHPUnit \Framework \TestCase ;
10+
11+ class ProjectEmailTest extends TestCase
12+ {
13+ public function testJsonSerialize (): void
14+ {
15+ $ recipient = new EmailRecipient ('john.doe@example.com ' );
16+ $ projectId = '12345 ' ;
17+ $ projectName = 'Test Project ' ;
18+ $ title = 'Test Notification ' ;
19+ $ message = 'This is a test notification message ' ;
20+
21+ $ projectEmail = new ProjectEmail (
22+ $ recipient ,
23+ $ projectId ,
24+ $ projectName ,
25+ $ title ,
26+ $ message ,
27+ );
28+
29+ self ::assertSame (
30+ [
31+ 'type ' => 'direct-project-email ' ,
32+ 'recipient ' => [
33+ 'channel ' => 'email ' ,
34+ 'address ' => 'john.doe@example.com ' ,
35+ ],
36+ 'data ' => [
37+ 'project ' => [
38+ 'id ' => $ projectId ,
39+ 'name ' => $ projectName ,
40+ ],
41+ 'title ' => $ title ,
42+ 'message ' => $ message ,
43+ ],
44+ ],
45+ $ projectEmail ->jsonSerialize (),
46+ );
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments