Tests: Ignore EOL differences in email tests using multiline string assertions.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result. Follow-up to [46612], [48033]. Props davidbaumwald. See #31432, #41750. git-svn-id: https://develop.svn.wordpress.org/trunk@48443 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
accf884aac
commit
43c193f58b
@ -80,7 +80,7 @@ class Tests_Mail extends WP_UnitTestCase {
|
||||
$mailer = tests_retrieve_phpmailer_instance();
|
||||
|
||||
// We need some better assertions here but these catch the failure for now.
|
||||
$this->assertEquals( $body, $mailer->get_sent()->body );
|
||||
$this->assertEqualsIgnoreEOL( $body, $mailer->get_sent()->body );
|
||||
$this->assertTrue( strpos( iconv_mime_decode_headers( ( $mailer->get_sent()->header ) )['Content-Type'][0], 'boundary="----=_Part_4892_25692638.1192452070893"' ) > 0 );
|
||||
$this->assertTrue( strpos( $mailer->get_sent()->header, 'charset=' ) > 0 );
|
||||
}
|
||||
@ -112,7 +112,7 @@ class Tests_Mail extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'The Carbon Guy', $mailer->get_recipient( 'cc' )->name );
|
||||
$this->assertEquals( 'bcc@bcc.com', $mailer->get_recipient( 'bcc' )->address );
|
||||
$this->assertEquals( 'The Blind Carbon Guy', $mailer->get_recipient( 'bcc' )->name );
|
||||
$this->assertEquals( $message . "\n", $mailer->get_sent()->body );
|
||||
$this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,7 +132,7 @@ class Tests_Mail extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'Name', $mailer->get_recipient( 'to' )->name );
|
||||
$this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
|
||||
$this->assertEquals( 'Another Name', $mailer->get_recipient( 'to', 0, 1 )->name );
|
||||
$this->assertEquals( $message . "\n", $mailer->get_sent()->body );
|
||||
$this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
|
||||
}
|
||||
|
||||
function test_wp_mail_multiple_to_addresses() {
|
||||
@ -145,7 +145,7 @@ class Tests_Mail extends WP_UnitTestCase {
|
||||
$mailer = tests_retrieve_phpmailer_instance();
|
||||
$this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
|
||||
$this->assertEquals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );
|
||||
$this->assertEquals( $message . "\n", $mailer->get_sent()->body );
|
||||
$this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,7 +160,7 @@ class Tests_Mail extends WP_UnitTestCase {
|
||||
|
||||
$mailer = tests_retrieve_phpmailer_instance();
|
||||
$this->assertEquals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );
|
||||
$this->assertEquals( $message . "\n", $mailer->get_sent()->body );
|
||||
$this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user