Skip to content

Commit 9257a0a

Browse files
committed
Send, reply, forward tests optional
1 parent 2e66c5e commit 9257a0a

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ The test suite requires the following environment variables to be set:
316316
```sh
317317
export MAILOSAUR_API_KEY=your_api_key
318318
export MAILOSAUR_SERVER=server_id
319-
export MAILOSAUR_VERIFIED_DOMAIN=server_domain
320319
```
321320
322321
Run all tests:

tests/EmailsTests.php

+12
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ public function testAll()
248248

249249
public function testCreateSendText()
250250
{
251+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
252+
251253
$subject = "New message";
252254

253255
$options = new MessageCreateOptions($serverName);
@@ -264,6 +266,8 @@ public function testCreateSendText()
264266

265267
public function testCreateSendHtml()
266268
{
269+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
270+
267271
$subject = "New HTML message";
268272

269273
$options = new MessageCreateOptions($serverName);
@@ -280,6 +284,8 @@ public function testCreateSendHtml()
280284

281285
public function testForwardText()
282286
{
287+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
288+
283289
$body = "Forwarded message";
284290
$targetEmailId = self::$emails[0]->id;
285291

@@ -295,6 +301,8 @@ public function testForwardText()
295301

296302
public function testForwardHtml()
297303
{
304+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
305+
298306
$body = "<p>Forwarded <strong>HTML</strong> message.</p>";
299307
$targetEmailId = self::$emails[0]->id;
300308

@@ -310,6 +318,8 @@ public function testForwardHtml()
310318

311319
public function testReplyText()
312320
{
321+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
322+
313323
$body = "Reply message";
314324
$targetEmailId = self::$emails[0]->id;
315325

@@ -324,6 +334,8 @@ public function testReplyText()
324334

325335
public function testReplyHtml()
326336
{
337+
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }
338+
327339
$body = "<p>Reply <strong>HTML</strong> message.</p>";
328340
$targetEmailId = self::$emails[0]->id;
329341

tests/Mailer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static function sendEmail(MailosaurClient $client, $server, $sendToAddres
2727
));
2828

2929
$randomString = Servers::randomString();
30-
$verifiedDomain = getenv('MAILOSAUR_VERIFIED_DOMAIN');
30+
$verifiedDomain = ($vd = getenv('MAILOSAUR_VERIFIED_DOMAIN')) ? $vd : 'mailosaur.net';
3131

3232
$from = join(' ', array($randomString, $randomString, '<' . $randomString . '@' . $verifiedDomain . '>'));
3333
$sendToAddress = join(' ', array($randomString, $randomString, '<' . (($sendToAddress === null) ? $client->servers->generateEmailAddress($server) : $sendToAddress) . '>'));

0 commit comments

Comments
 (0)