Skip to content

Commit 0db6cb5

Browse files
committed
HTML API: Use assertEqualHTML() in media tests. (#9264)
Prep work for #9248.
1 parent 9032503 commit 0db6cb5

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/phpunit/tests/media.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,34 @@ public function test_img_caption_shortcode_with_old_format_and_class() {
208208
}
209209

210210
public function test_new_img_caption_shortcode_with_html_caption() {
211+
$mark = "\u{203B}";
212+
213+
$this->assertStringNotContainsString(
214+
self::HTML_CONTENT,
215+
$mark,
216+
'Test caption content should not contain the mark surround it: check test setup.'
217+
);
218+
211219
$result = img_caption_shortcode(
212220
array(
213221
'width' => 20,
214-
'caption' => self::HTML_CONTENT,
222+
'caption' => $mark . self::HTML_CONTENT . $mark,
215223
)
216224
);
217225

218-
$this->assertSame( 1, substr_count( $result, self::HTML_CONTENT ) );
226+
$result_chunks = explode( $mark, $result );
227+
$this->assertSame(
228+
3,
229+
count( $result_chunks ),
230+
'Expected to find embedded caption inside marks, but failed to do so.'
231+
);
232+
233+
$this->assertEqualHTML(
234+
self::HTML_CONTENT,
235+
$result_chunks[1],
236+
'<body>',
237+
'Should have embedded the caption inside the image output.'
238+
);
219239
}
220240

221241
public function test_new_img_caption_shortcode_new_format() {

0 commit comments

Comments
 (0)