Skip to content

Commit

Permalink
Merge pull request #124 from aaemnnosttv/patch-2
Browse files Browse the repository at this point in the history
Update test `wp_mail`
  • Loading branch information
schlessera authored Jun 7, 2021
2 parents f07bd5a + 89af419 commit 2f85d91
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions utils/no-mail.php
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

0 comments on commit 2f85d91

Please sign in to comment.