| | 394 | |
| | 395 | /** |
| | 396 | * @ticket 28407 |
| | 397 | */ |
| | 398 | public function test_wp_mail_sends_attachments_with_original_name() { |
| | 399 | wp_mail( 'user@example.org', 'Subject', 'Hello World', '', array( |
| | 400 | DIR_TESTDATA . '/images/canola.jpg', |
| | 401 | DIR_TESTDATA . '/images/waffles.jpg' |
| | 402 | ) ); |
| | 403 | |
| | 404 | /** @var PHPMailer $mailer */ |
| | 405 | $mailer = tests_retrieve_phpmailer_instance(); |
| | 406 | |
| | 407 | $attachments = $mailer->getAttachments(); |
| | 408 | |
| | 409 | $this->assertTrue( $mailer->attachmentExists() ); |
| | 410 | $this->assertSame( $attachments[0][1], $attachments[0][2] ); |
| | 411 | $this->assertSame( $attachments[1][1], $attachments[1][2] ); |
| | 412 | } |
| | 413 | |
| | 414 | /** |
| | 415 | * @ticket 28407 |
| | 416 | */ |
| | 417 | public function test_wp_mail_sends_attachments_with_custom_name() { |
| | 418 | wp_mail( 'user@example.org', 'Subject', 'Hello World', '', array( |
| | 419 | 'myawesomeimage.jpg' => DIR_TESTDATA . '/images/canola.jpg', |
| | 420 | 'foobar.jpg' => DIR_TESTDATA . '/images/waffles.jpg' |
| | 421 | ) ); |
| | 422 | |
| | 423 | /** @var PHPMailer $mailer */ |
| | 424 | $mailer = tests_retrieve_phpmailer_instance(); |
| | 425 | |
| | 426 | $attachments = $mailer->getAttachments(); |
| | 427 | |
| | 428 | $this->assertTrue( $mailer->attachmentExists() ); |
| | 429 | $this->assertSame( ' myawesomeimage.jpg', $attachments[0][2] ); |
| | 430 | $this->assertSame( 'foobar.jpg', $attachments[1][2] ); |
| | 431 | } |