forked from wearerequired/digest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1584a0b
commit bfd354f
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Required\Digest\Tests; | ||
|
||
use MockPHPMailer; | ||
use Required\Digest\Queue; | ||
use \WP_UnitTestCase; | ||
use \MockAction; | ||
|
@@ -35,4 +36,27 @@ public function test_send_email_empty_queue() { | |
|
||
$this->assertSame( 0, $action->get_call_count() ); | ||
} | ||
|
||
public function test_send_email_non_empty_queue() { | ||
Queue::add( '[email protected]', 'foo', 'bar' ); | ||
|
||
digest()->send_email( 'Foo' ); | ||
|
||
/** @var MockPHPMailer $mailer */ | ||
$mailer = tests_retrieve_phpmailer_instance(); | ||
|
||
$this->assertSame( 'Foo', $mailer->Subject ); | ||
} | ||
|
||
public function test_send_email_non_empty_queue_registered_events() { | ||
Queue::add( '[email protected]', 'core_update_success', '100.1.0' ); | ||
|
||
digest()->send_email( 'Foo' ); | ||
|
||
/** @var MockPHPMailer $mailer */ | ||
$mailer = tests_retrieve_phpmailer_instance(); | ||
|
||
$this->assertSame( 'Foo', $mailer->get_sent()->subject ); | ||
$this->assertContains( 'Hi there', $mailer->get_sent()->body ); | ||
} | ||
} |