-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathElasticEmailTest.php
More file actions
40 lines (31 loc) · 927 Bytes
/
ElasticEmailTest.php
File metadata and controls
40 lines (31 loc) · 927 Bytes
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
<?php
namespace Tests\E2E;
use Utopia\Messaging\Adapters\Email\ElasticEmail;
use Utopia\Messaging\Messages\Email;
class ElasticEmailTest extends Base
{
/**
* @throws \Exception
*/
public function testSendEmail()
{
$key = getenv('ElasticEmail_API_KEY');
$sender = new ElasticEmail(
apiKey: $key,
);
$to = getenv('TEST_EMAIL');
$subject = 'Test Subject';
$content = 'Test Content';
$from = 'sender@'.$domain;
$message = new Email(
to: [$to],
from: $from,
subject: $subject,
content: $content,
);
$result = (array) \json_decode($sender->send($message));
$this->assertArrayHasKey('transactionId', $result);
$this->assertArrayHasKey('message', $result);
$this->assertTrue(str_contains(strtolower($result['message']), 'queued'));
}
}