Changeset 48937 for trunk/tests/phpunit/tests/mail.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/mail.php
r48645 r48937 81 81 82 82 // We need some better assertions here but these catch the failure for now. 83 $this->assert EqualsIgnoreEOL( $body, $mailer->get_sent()->body );83 $this->assertSameIgnoreEOL( $body, $mailer->get_sent()->body ); 84 84 $this->assertTrue( strpos( iconv_mime_decode_headers( ( $mailer->get_sent()->header ) )['Content-Type'][0], 'boundary="----=_Part_4892_25692638.1192452070893"' ) > 0 ); 85 85 $this->assertTrue( strpos( $mailer->get_sent()->header, 'charset=' ) > 0 ); … … 107 107 // Retrieve the mailer instance. 108 108 $mailer = tests_retrieve_phpmailer_instance(); 109 $this->assert Equals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );110 $this->assert Equals( 'Name', $mailer->get_recipient( 'to' )->name );111 $this->assert Equals( 'cc@cc.com', $mailer->get_recipient( 'cc' )->address );112 $this->assert Equals( 'The Carbon Guy', $mailer->get_recipient( 'cc' )->name );113 $this->assert Equals( 'bcc@bcc.com', $mailer->get_recipient( 'bcc' )->address );114 $this->assert Equals( 'The Blind Carbon Guy', $mailer->get_recipient( 'bcc' )->name );115 $this->assert EqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );109 $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address ); 110 $this->assertSame( 'Name', $mailer->get_recipient( 'to' )->name ); 111 $this->assertSame( 'cc@cc.com', $mailer->get_recipient( 'cc' )->address ); 112 $this->assertSame( 'The Carbon Guy', $mailer->get_recipient( 'cc' )->name ); 113 $this->assertSame( 'bcc@bcc.com', $mailer->get_recipient( 'bcc' )->address ); 114 $this->assertSame( 'The Blind Carbon Guy', $mailer->get_recipient( 'bcc' )->name ); 115 $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body ); 116 116 } 117 117 … … 129 129 // Earlier versions of PHPMailer were not touchy about the formatting of these arguments. 130 130 $mailer = tests_retrieve_phpmailer_instance(); 131 $this->assert Equals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );132 $this->assert Equals( 'Name', $mailer->get_recipient( 'to' )->name );133 $this->assert Equals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );134 $this->assert Equals( 'Another Name', $mailer->get_recipient( 'to', 0, 1 )->name );135 $this->assert EqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );131 $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address ); 132 $this->assertSame( 'Name', $mailer->get_recipient( 'to' )->name ); 133 $this->assertSame( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address ); 134 $this->assertSame( 'Another Name', $mailer->get_recipient( 'to', 0, 1 )->name ); 135 $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body ); 136 136 } 137 137 … … 144 144 145 145 $mailer = tests_retrieve_phpmailer_instance(); 146 $this->assert Equals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );147 $this->assert Equals( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address );148 $this->assert EqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );146 $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address ); 147 $this->assertSame( 'another_address@different-tld.com', $mailer->get_recipient( 'to', 0, 1 )->address ); 148 $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body ); 149 149 } 150 150 … … 160 160 161 161 $mailer = tests_retrieve_phpmailer_instance(); 162 $this->assert Equals( 'address@tld.com', $mailer->get_recipient( 'to' )->address );163 $this->assert EqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );162 $this->assertSame( 'address@tld.com', $mailer->get_recipient( 'to' )->address ); 163 $this->assertSameIgnoreEOL( $message . "\n", $mailer->get_sent()->body ); 164 164 } 165 165 … … 287 287 288 288 $mailer = tests_retrieve_phpmailer_instance(); 289 $this->assert Equals( 1, substr_count( $mailer->get_sent()->header, $expected ) );289 $this->assertSame( 1, substr_count( $mailer->get_sent()->header, $expected ) ); 290 290 } 291 291 … … 355 355 foreach ( $headers as $header => $value ) { 356 356 $target_headers = preg_grep( "/^$header:/", $sent_headers ); 357 $this->assert Equals( $expected[ $header ], array_pop( $target_headers ) );357 $this->assertSame( $expected[ $header ], array_pop( $target_headers ) ); 358 358 } 359 359 } … … 374 374 $mailer = tests_retrieve_phpmailer_instance(); 375 375 376 $this->assert Equals( '', $mailer->Sender );376 $this->assertSame( '', $mailer->Sender ); 377 377 } 378 378 … … 390 390 wp_mail( $to, $subject, $message ); 391 391 392 $this->assert Equals( 1, $ma->get_call_count() );392 $this->assertSame( 1, $ma->get_call_count() ); 393 393 394 394 $expected_error_data = array( … … 405 405 $call_args = array_pop( $all_args ); 406 406 407 $this->assert Equals( 'wp_mail_failed', $call_args[0]->get_error_code() );408 $this->assert Equals( $expected_error_data, $call_args[0]->get_error_data() );407 $this->assertSame( 'wp_mail_failed', $call_args[0]->get_error_code() ); 408 $this->assertSame( $expected_error_data, $call_args[0]->get_error_data() ); 409 409 } 410 410
Note: See TracChangeset
for help on using the changeset viewer.