-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from aaemnnosttv/patch-2
Update test `wp_mail`
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 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 |
---|---|---|
@@ -1,18 +1,26 @@ | ||
<?php | ||
/** | ||
* This file is copied as amu-plugin into new WP installs to reroute normal | ||
* This file is copied as a mu-plugin into new WP installs to reroute normal | ||
* mails into log entries. | ||
*/ | ||
|
||
/** | ||
* Replace WP native pluggable wp_mail function for test purposes. | ||
* | ||
* @param string $to Email address. | ||
* @param string|string[] $to Array or comma-separated list of email addresses to send message. | ||
* @return bool Whether the email was sent successfully. | ||
* | ||
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- WP native function. | ||
*/ | ||
function wp_mail( $to ) { | ||
if ( is_array( $to ) ) { | ||
$to = join( ', ', $to ); | ||
} | ||
|
||
// Log for testing purposes | ||
WP_CLI::log( "WP-CLI test suite: Sent email to {$to}." ); | ||
|
||
// Assume sending mail always succeeds. | ||
return true; | ||
} | ||
// phpcs:enable |