Users: Add a unit test for [37276].
See #36009. git-svn-id: https://develop.svn.wordpress.org/trunk@37277 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cbe4f5d9c7
commit
d5e795ca9e
@ -1021,6 +1021,7 @@ class Tests_User extends WP_UnitTestCase {
|
|||||||
*
|
*
|
||||||
* @dataProvider data_wp_new_user_notifications
|
* @dataProvider data_wp_new_user_notifications
|
||||||
* @ticket 33654
|
* @ticket 33654
|
||||||
|
* @ticket 36009
|
||||||
*/
|
*/
|
||||||
function test_wp_new_user_notification( $notify, $admin_email_sent_expected, $user_email_sent_expected ) {
|
function test_wp_new_user_notification( $notify, $admin_email_sent_expected, $user_email_sent_expected ) {
|
||||||
unset( $GLOBALS['phpmailer']->mock_sent );
|
unset( $GLOBALS['phpmailer']->mock_sent );
|
||||||
@ -1036,11 +1037,16 @@ class Tests_User extends WP_UnitTestCase {
|
|||||||
* Check to see if a notification email was sent to the
|
* Check to see if a notification email was sent to the
|
||||||
* post author `blackburn@battlefield3.com` and and site admin `admin@example.org`.
|
* post author `blackburn@battlefield3.com` and and site admin `admin@example.org`.
|
||||||
*/
|
*/
|
||||||
$admin_email = $mailer->get_recipient( 'to' );
|
$first_recipient = $mailer->get_recipient( 'to' );
|
||||||
$was_admin_email_sent = $admin_email && WP_TESTS_EMAIL === $admin_email->address;
|
if ( $first_recipient ) {
|
||||||
|
$was_admin_email_sent = WP_TESTS_EMAIL === $first_recipient->address;
|
||||||
|
$was_user_email_sent = 'blackburn@battlefield3.com' === $first_recipient->address;
|
||||||
|
}
|
||||||
|
|
||||||
$user_email = $mailer->get_recipient( 'to', 1 );
|
$second_recipient = $mailer->get_recipient( 'to', 1 );
|
||||||
$was_user_email_sent = $user_email && 'blackburn@battlefield3.com' == $user_email->address;
|
if ( $second_recipient ) {
|
||||||
|
$was_user_email_sent = 'blackburn@battlefield3.com' === $second_recipient->address;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->assertSame( $admin_email_sent_expected, $was_admin_email_sent, 'Admin email result was not as expected in test_wp_new_user_notification' );
|
$this->assertSame( $admin_email_sent_expected, $was_admin_email_sent, 'Admin email result was not as expected in test_wp_new_user_notification' );
|
||||||
@ -1073,6 +1079,11 @@ class Tests_User extends WP_UnitTestCase {
|
|||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'user',
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'both',
|
'both',
|
||||||
true,
|
true,
|
||||||
|
Loading…
Reference in New Issue
Block a user