Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates PHPMailer for WP 5.5 #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rask/wp-test-framework
# msaari/wp-test-framework

Extracted and librarized version of WordPress core's PHPUnit test framework to help with writing integration tests in WordPress plugins and themes.

Expand All @@ -10,7 +10,7 @@ The sources are updated when needed, so there may be minor differences between t

This library should be installed as a Composer dependency inside your plugin or theme:

$ composer require --dev rask/wp-test-framework
$ composer require --dev msaari/wp-test-framework

### WordPress testing installation setup

Expand All @@ -34,15 +34,15 @@ Inside your plugin/theme directory you need to setup PHPUnit. Any regular-ish `p

require_once './vendor/autoload.php';

\rask\WpTestFramework\Framework::load();
\msaari\WpTestFramework\Framework::load();

Then you should load your plugin or theme. In the same bootstrap file you can do the following:

<?php

require_once './vendor/autoload.php';

\rask\WpTestFramework\Framework::load();
\msaari\WpTestFramework\Framework::load();

// Load your plugin

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "rask/wp-test-framework",
"name": "msaari/wp-test-framework",
"description": "Extracted library from WordPress PHPUnit framework to aid in integration testing of plugins and themes",
"type": "library",
"keywords": ["wordpress", "testing", "tests", "phpunit"],
"license": "GPL-3.0-or-later",
"support": {
"source": "https://github.com/rask/wp-test-framework"
"source": "https://github.com/msaari/wp-test-framework"
},

"autoload": {
"psr-4": {
"rask\\WpTestFramework\\": "src/"
"msaari\\WpTestFramework\\": "src/"
}
},

Expand Down
13 changes: 11 additions & 2 deletions src/phpunit/includes/mock-mailer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<?php
require_once( ABSPATH . '/wp-includes/class-phpmailer.php' );
global $wp_version;

if ( version_compare( $wp_version, '5.5', '>=' ) ) {
require_once ABSPATH . '/wp-includes/PHPMailer/PHPMailer.php';
class MailerClass extends PHPMailer\PHPMailer\PHPMailer {}
} else {
require_once ABSPATH . '/wp-includes/class-phpmailer.php';
class MailerClass extends PHPMailer {}
}

class MockPHPMailer extends MailerClass {

class MockPHPMailer extends PHPMailer {
var $mock_sent = array();

function preSend() {
Expand Down