| 213 | |
| 214 | /** |
| 215 | * @ticket 23291 |
| 216 | */ |
| 217 | function test_wp_mail_return_true_with_non_fatal_errors_by_default() { |
| 218 | $result = wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existant-file.html' ); |
| 219 | $this->assertTrue( $result ); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * @ticket 23291 |
| 224 | */ |
| 225 | function test_wp_mail_return_wp_error_for_fatal_errors_when_requested() { |
| 226 | $result = wp_mail( 'invalid.address', 'subject', 'body', '', array(), 'wp_error' ); |
| 227 | $this->assertWPError( $result ); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * @ticket 23291 |
| 232 | */ |
| 233 | function test_wp_mail_return_wp_error_for_non_fatal_errors_when_requested() |
| 234 | { |
| 235 | $result = wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid_address\nBcc: another_invalid_address", array( '/this/file/does/not/exist' ), 'wp_error' ); |
| 236 | $this->assertWPError( $result ); |
| 237 | $this->assertCount( 3, $result->get_error_codes() ); |
| 238 | $this->assertNotContains( 'mailer_send', $result->get_error_messages() ); |
| 239 | } |