Skip to content

Commit 0040ca7

Browse files
committed
HTML API: Use assertEqualHTML in wp_rel_ugc() tests. (WordPress#9255)
Prep work for WordPress#9252. Part of WordPress#9248.
1 parent 9032503 commit 0040ca7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/phpunit/tests/comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function test_update_comment_from_unprivileged_user_by_privileged_user()
168168
wp_set_current_user( 0 );
169169

170170
$comment = get_comment( $comment_id );
171-
$this->assertSame( '<a href="http://example.localhost/something.html" rel="nofollow ugc">click</a>', $comment->comment_content, 'Comment: ' . $comment->comment_content );
171+
$this->assertEqualHTML( '<a href="http://example.localhost/something.html" rel="nofollow ugc">click</a>', $comment->comment_content, 'Comment: ' . $comment->comment_content );
172172
}
173173

174174
/**

tests/phpunit/tests/formatting/wpRelUgc.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ class Tests_Formatting_wpRelUgc extends WP_UnitTestCase {
1212
*/
1313
public function test_add_ugc() {
1414
$content = '<p>This is some cool <a href="/">Code</a></p>';
15-
$expected = '<p>This is some cool <a href=\"/\" rel=\"nofollow ugc\">Code</a></p>';
16-
$this->assertSame( $expected, wp_rel_ugc( $content ) );
15+
$expected = '<p>This is some cool <a href="/" rel="nofollow ugc">Code</a></p>';
16+
$this->assertEqualHTML( $expected, stripslashes( wp_rel_ugc( $content ) ) );
1717
}
1818

1919
/**
2020
* @ticket 48022
2121
*/
2222
public function test_convert_ugc() {
2323
$content = '<p>This is some cool <a href="/" rel="weird">Code</a></p>';
24-
$expected = '<p>This is some cool <a href=\"/\" rel=\"weird nofollow ugc\">Code</a></p>';
25-
$this->assertSame( $expected, wp_rel_ugc( $content ) );
24+
$expected = '<p>This is some cool <a href="/" rel="weird nofollow ugc">Code</a></p>';
25+
$this->assertEqualHTML( $expected, stripslashes( wp_rel_ugc( $content ) ) );
2626
}
2727

2828
/**
2929
* @ticket 48022
3030
* @dataProvider data_wp_rel_ugc
3131
*/
3232
public function test_wp_rel_ugc( $input, $output, $expect_deprecation = false ) {
33-
$this->assertSame( wp_slash( $output ), wp_rel_ugc( $input ) );
33+
$this->assertEqualHTML( $output , stripslashes( wp_rel_ugc( $input ) ) );
3434
}
3535

3636
public function data_wp_rel_ugc() {
@@ -81,7 +81,7 @@ public function data_wp_rel_ugc() {
8181
public function test_append_ugc_with_valueless_attribute() {
8282

8383
$content = '<p>This is some cool <a href="demo.com" download rel="hola">Code</a></p>';
84-
$expected = '<p>This is some cool <a href=\"demo.com\" download rel=\"hola nofollow ugc\">Code</a></p>';
85-
$this->assertSame( $expected, wp_rel_ugc( $content ) );
84+
$expected = '<p>This is some cool <a href="demo.com" download rel="hola nofollow ugc">Code</a></p>';
85+
$this->assertEqualHTML( $expected, stripslashes( wp_rel_ugc( $content ) ) );
8686
}
8787
}

0 commit comments

Comments
 (0)