Skip to content

Commit 9b38984

Browse files
committed
Improving Unit Tests for 28059
1 parent e81ed11 commit 9b38984

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

tests/phpunit/tests/pluggable/wpMail.php

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,12 @@ public function test_wp_mail_resets_properties() {
559559
* Tests that wp_mail() can send embedded images.
560560
*
561561
* @ticket 28059
562+
*
563+
* @dataProvider data_wp_mail_can_send_embedded_images
564+
*
565+
* @param string[] $embeds The embeds to send.
562566
*/
563-
public function test_wp_mail_can_send_embedded_images() {
564-
$embeds = array(
565-
'canola' => DIR_TESTDATA . '/images/canola.jpg',
566-
DIR_TESTDATA . '/images/test-image-2.gif',
567-
DIR_TESTDATA . '/images/avif-lossy.avif',
568-
);
569-
567+
public function test_wp_mail_can_send_embedded_images( $embeds ) {
570568
$message = '';
571569
foreach ( $embeds as $key => $path ) {
572570
$message .= '<p><img src="cid:' . $key . '" alt="" /></p>';
@@ -593,6 +591,37 @@ public function test_wp_mail_can_send_embedded_images() {
593591
}
594592
}
595593

594+
/**
595+
* Data provider for test_wp_mail_can_send_embedded_images().
596+
*
597+
* @return array
598+
*/
599+
public static function data_wp_mail_can_send_embedded_images() {
600+
return array(
601+
'Mixed Array Embeds' => array(
602+
'embeds' => array(
603+
'canola' => DIR_TESTDATA . '/images/canola.jpg',
604+
DIR_TESTDATA . '/images/test-image-2.gif',
605+
DIR_TESTDATA . '/images/avif-lossy.avif',
606+
),
607+
),
608+
'Associative Array Embeds' => array(
609+
'embeds' => array(
610+
'canola' => DIR_TESTDATA . '/images/canola.jpg',
611+
'test-image-2' => DIR_TESTDATA . '/images/test-image-2.gif',
612+
'avif-lossy' => DIR_TESTDATA . '/images/avif-lossy.avif',
613+
),
614+
),
615+
'Indexed Array Embeds' => array(
616+
'embeds' => array(
617+
DIR_TESTDATA . '/images/canola.jpg',
618+
DIR_TESTDATA . '/images/test-image-2.gif',
619+
DIR_TESTDATA . '/images/avif-lossy.avif',
620+
),
621+
),
622+
);
623+
}
624+
596625
/**
597626
* Tests that wp_mail() can send embedded images as a multiple line string.
598627
*

0 commit comments

Comments
 (0)