summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes/mock-mailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/mock-mailer.php')
-rw-r--r--tests/phpunit/includes/mock-mailer.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/phpunit/includes/mock-mailer.php b/tests/phpunit/includes/mock-mailer.php
new file mode 100644
index 0000000000..f52a95a064
--- /dev/null
+++ b/tests/phpunit/includes/mock-mailer.php
@@ -0,0 +1,26 @@
+<?php
+require_once( ABSPATH . '/wp-includes/class-phpmailer.php' );
+
+class MockPHPMailer extends PHPMailer {
+ var $mock_sent = array();
+
+ // override the Send function so it doesn't actually send anything
+ function Send() {
+ try {
+ if ( ! $this->PreSend() )
+ return false;
+
+ $this->mock_sent[] = array(
+ 'to' => $this->to,
+ 'cc' => $this->cc,
+ 'bcc' => $this->bcc,
+ 'header' => $this->MIMEHeader,
+ 'body' => $this->MIMEBody,
+ );
+
+ return true;
+ } catch ( phpmailerException $e ) {
+ return false;
+ }
+ }
+}