-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added new hooks * Updated documentation * Added additional test coverage
- Loading branch information
Showing
11 changed files
with
229 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ | |
#, fuzzy | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: WpMailCatcher 2.1.4\n" | ||
"Project-Id-Version: WpMailCatcher 2.1.8\n" | ||
"Report-Msgid-Bugs-To: [email protected]\n" | ||
"POT-Creation-Date: 2023-11-09 20:31+0000\n" | ||
"POT-Creation-Date: 2024-05-29 19:52+0000\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <[email protected]>\n" | ||
|
@@ -131,7 +131,7 @@ msgid "" | |
" to perform the upgrade.</strong>" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:47 | ||
#: ../../src/Views/Log.php:50 | ||
#, php-format | ||
msgid "" | ||
"You have <strong>over %s</strong> messages stored and <a href=\"%s\">auto-" | ||
|
@@ -141,27 +141,27 @@ msgid "" | |
" auto-delete or delete some logs." | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:62 | ||
#: ../../src/Views/Log.php:65 | ||
msgid "New Message" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:67 ../../src/Views/Log.php:77 | ||
#: ../../src/Views/Log.php:70 ../../src/Views/Log.php:80 | ||
msgid "Export all messages" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:88 | ||
#: ../../src/Views/Log.php:91 | ||
msgid "All" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:96 | ||
#: ../../src/Views/Log.php:99 | ||
msgid "Successful" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:104 | ||
#: ../../src/Views/Log.php:107 | ||
msgid "Failed" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Log.php:118 | ||
#: ../../src/Views/Log.php:121 | ||
msgid "Search Logs" | ||
msgstr "" | ||
|
||
|
@@ -290,20 +290,20 @@ msgstr "" | |
msgid "Yes - delete messages that are over %s old" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Settings.php:141 | ||
#: ../../src/Views/Settings.php:144 | ||
#, php-format | ||
msgid "Will next run in: %s. <a href=\"" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Settings.php:155 | ||
#: ../../src/Views/Settings.php:158 | ||
msgid "Database version" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Settings.php:164 | ||
#: ../../src/Views/Settings.php:170 | ||
#, php-format | ||
msgid "%s. <a href=\"" | ||
msgstr "" | ||
|
||
#: ../../src/Views/Settings.php:178 | ||
#: ../../src/Views/Settings.php:184 | ||
msgid "Save Changes" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,22 @@ public function setUp(): void | |
Logs::truncate(); | ||
} | ||
|
||
public function testMail() | ||
private function isTimeBetwen($time, $compareToTime, $threshold) | ||
{ | ||
$to = '[email protected]'; | ||
$upperBound = $compareToTime + $threshold; | ||
$lowerBound = $compareToTime - $threshold; | ||
return $time < $upperBound && $time > $lowerBound; | ||
} | ||
|
||
// TODO: Tidy method up, make more generic rather than just setting current args | ||
// needed by other tests | ||
private function sendAndAssertMail($to, $additionalHeaders = [], $isHtml = false) | ||
{ | ||
// FIXME: Need a better way to mock `time()` | ||
$time = time(); | ||
$acceptableTimeThreshold = 5; | ||
$subject = 'subject'; | ||
$message = 'message'; | ||
$additionalHeaders = [GeneralHelper::$htmlEmailHeader, 'cc: [email protected]']; | ||
|
||
$imgAttachmentId = $this->factory()->attachment->create_upload_object(__DIR__ . '/../assets/img-attachment.png'); | ||
$pdfAttachmentId = $this->factory()->attachment->create_upload_object(__DIR__ . '/../assets/pdf-attachment.pdf'); | ||
|
@@ -31,10 +41,12 @@ public function testMail() | |
$this->assertEquals($to, $emailLogs[0]['email_to']); | ||
$this->assertEquals($subject, $emailLogs[0]['subject']); | ||
$this->assertEquals($message, $emailLogs[0]['message']); | ||
$this->assertTrue($emailLogs[0]['is_html']); | ||
$this->assertTrue($this->isTimeBetwen($emailLogs[0]['timestamp'], $time, $acceptableTimeThreshold)); | ||
$this->assertEquals($isHtml, $emailLogs[0]['is_html']); | ||
|
||
$this->assertEquals($additionalHeaders[0], $emailLogs[0]['additional_headers'][0]); | ||
$this->assertEquals($additionalHeaders[1], $emailLogs[0]['additional_headers'][1]); | ||
foreach ($additionalHeaders as $index => $additionalHeader) { | ||
$this->assertEquals($additionalHeader, $emailLogs[0]['additional_headers'][$index]); | ||
} | ||
|
||
$this->assertEquals($imgAttachmentId, $emailLogs[0]['attachments'][0]['id']); | ||
$this->assertEquals(wp_get_attachment_url($imgAttachmentId), $emailLogs[0]['attachments'][0]['url']); | ||
|
@@ -48,13 +60,13 @@ public function testMail() | |
|
||
public function testCorrectTos() | ||
{ | ||
wp_mail('[email protected]', 'subject', 'message'); | ||
$this->sendAndAssertMail('[email protected]', [GeneralHelper::$htmlEmailHeader, 'cc: [email protected]'], true); | ||
$this->assertTrue(Logs::getFirst()['status']); | ||
} | ||
|
||
public function testIncorrectTos() | ||
{ | ||
wp_mail('testtest.com', 'subject', 'message'); | ||
$this->sendAndAssertMail('testtest.com'); | ||
$this->assertFalse(Logs::getFirst()['status']); | ||
} | ||
|
||
|
Oops, something went wrong.