-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathPostmarkClientEmailsAsStringOrArrayTest.php
More file actions
61 lines (52 loc) · 2.05 KB
/
PostmarkClientEmailsAsStringOrArrayTest.php
File metadata and controls
61 lines (52 loc) · 2.05 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
<?php
namespace Postmark\Tests;
use Postmark\PostmarkClient;
require_once __DIR__ . '/PostmarkClientBaseTest.php';
/**
* @internal
*
* @coversNothing
*/
class PostmarkClientEmailsAsStringOrArrayTest extends PostmarkClientBaseTest
{
public function testCanSendArray(): void
{
$tk = parent::$testKeys;
$client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT);
$currentTime = date('c');
$emailsAsArray = [];
for ($i = 1; $i <= 50; ++$i) {
$emailsAsArray[] = str_replace('@', '+' . $i . '@', $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS);
}
// Generate a unique recipient email to avoid suppression issues
$uniqueRecipient = 'test-' . uniqid() . '@postmarkapp.com';
$response = $client->sendEmail(
$tk->WRITE_TEST_SENDER_EMAIL_ADDRESS,
[$uniqueRecipient],
"Hello from the PHP Postmark Client Tests! ({$currentTime})",
'<b>Hi there!</b>',
'This is a text body for a test email.',
);
$this->assertNotEmpty($response, 'The client could not send a basic message.');
}
public function testCanSendString(): void
{
$tk = parent::$testKeys;
$client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT);
$currentTime = date('c');
$emailsAsString = '';
for ($i = 1; $i <= 50; ++$i) {
$emailsAsString .= str_replace('@', '+' . $i . '@', $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS) . ',';
}
// Generate a unique recipient email to avoid suppression issues
$uniqueRecipient = 'test-' . uniqid() . '@postmarkapp.com';
$response = $client->sendEmail(
$tk->WRITE_TEST_SENDER_EMAIL_ADDRESS,
$uniqueRecipient,
"Hello from the PHP Postmark Client Tests! ({$currentTime})",
'<b>Hi there!</b>',
'This is a text body for a test email.',
);
$this->assertNotEmpty($response, 'The client could not send a basic message.');
}
}