Skip to content

Commit

Permalink
Send, reply, forward tests optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Oct 27, 2021
1 parent 2e66c5e commit 9257a0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ The test suite requires the following environment variables to be set:
```sh
export MAILOSAUR_API_KEY=your_api_key
export MAILOSAUR_SERVER=server_id
export MAILOSAUR_VERIFIED_DOMAIN=server_domain
```
Run all tests:
Expand Down
12 changes: 12 additions & 0 deletions tests/EmailsTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ public function testAll()

public function testCreateSendText()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$subject = "New message";

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

public function testCreateSendHtml()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$subject = "New HTML message";

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

public function testForwardText()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$body = "Forwarded message";
$targetEmailId = self::$emails[0]->id;

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

public function testForwardHtml()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$body = "<p>Forwarded <strong>HTML</strong> message.</p>";
$targetEmailId = self::$emails[0]->id;

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

public function testReplyText()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$body = "Reply message";
$targetEmailId = self::$emails[0]->id;

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

public function testReplyHtml()
{
if (empty(self::$verifiedDomain)) { $this->markTestSkipped(); }

$body = "<p>Reply <strong>HTML</strong> message.</p>";
$targetEmailId = self::$emails[0]->id;

Expand Down
2 changes: 1 addition & 1 deletion tests/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function sendEmail(MailosaurClient $client, $server, $sendToAddres
));

$randomString = Servers::randomString();
$verifiedDomain = getenv('MAILOSAUR_VERIFIED_DOMAIN');
$verifiedDomain = ($vd = getenv('MAILOSAUR_VERIFIED_DOMAIN')) ? $vd : 'mailosaur.net';

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

0 comments on commit 9257a0a

Please sign in to comment.