Skip to content

HTML API: Use assertEqualHTML() in media tests. #9264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions tests/phpunit/tests/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,34 @@ public function test_img_caption_shortcode_with_old_format_and_class() {
}

public function test_new_img_caption_shortcode_with_html_caption() {
$mark = "\u{203B}";

$this->assertStringNotContainsString(
self::HTML_CONTENT,
$mark,
'Test caption content should not contain the mark surround it: check test setup.'
);

$result = img_caption_shortcode(
array(
'width' => 20,
'caption' => self::HTML_CONTENT,
'caption' => $mark . self::HTML_CONTENT . $mark,
)
);

$this->assertSame( 1, substr_count( $result, self::HTML_CONTENT ) );
$result_chunks = explode( $mark, $result );
$this->assertSame(
3,
count( $result_chunks ),
'Expected to find embedded caption inside marks, but failed to do so.'
);

$this->assertEqualHTML(
self::HTML_CONTENT,
$result_chunks[1],
'<body>',
'Should have embedded the caption inside the image output.'
);
}

public function test_new_img_caption_shortcode_new_format() {
Expand Down
Loading