Skip to content

Commit f5d1686

Browse files
committed
tests: Requests/PostNotification/ProjectEmail
1 parent 6add2f9 commit f5d1686

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
}

0 commit comments

Comments
 (0)