Skip to content

Commit 8443ace

Browse files
authored
Merge pull request #124 from aaemnnosttv/patch-2
Update test `wp_mail`
2 parents 03fdabd + faa4ae1 commit 8443ace

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

utils/no-mail.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
<?php
22
/**
3-
* This file is copied as amu-plugin into new WP installs to reroute normal
3+
* This file is copied as a mu-plugin into new WP installs to reroute normal
44
* mails into log entries.
55
*/
66

77
/**
88
* Replace WP native pluggable wp_mail function for test purposes.
99
*
10-
* @param string $to Email address.
10+
* @param string|string[] $to Array or comma-separated list of email addresses to send message.
11+
* @return bool Whether the email was sent successfully.
1112
*
1213
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- WP native function.
1314
*/
1415
function wp_mail( $to ) {
16+
if ( is_array( $to ) ) {
17+
$to = join( ', ', $to );
18+
}
19+
1520
// Log for testing purposes
1621
WP_CLI::log( "WP-CLI test suite: Sent email to {$to}." );
22+
23+
// Assume sending mail always succeeds.
24+
return true;
1725
}
1826
// phpcs:enable

0 commit comments

Comments
 (0)