Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion tests/phpunit/tests/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function test_update_comment_from_unprivileged_user_by_privileged_user()
wp_set_current_user( 0 );

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

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/phpunit/tests/formatting/wpRelUgc.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ class Tests_Formatting_wpRelUgc extends WP_UnitTestCase {
*/
public function test_add_ugc() {
$content = '<p>This is some cool <a href="/">Code</a></p>';
$expected = '<p>This is some cool <a href=\"/\" rel=\"nofollow ugc\">Code</a></p>';
$this->assertSame( $expected, wp_rel_ugc( $content ) );
$expected = '<p>This is some cool <a href="/" rel="nofollow ugc">Code</a></p>';
$this->assertEqualHTML( $expected, stripslashes( wp_rel_ugc( $content ) ) );
}

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

/**
* @ticket 48022
* @dataProvider data_wp_rel_ugc
*/
public function test_wp_rel_ugc( $input, $output, $expect_deprecation = false ) {
$this->assertSame( wp_slash( $output ), wp_rel_ugc( $input ) );
$this->assertEqualHTML( $output, stripslashes( wp_rel_ugc( $input ) ) );
}

public function data_wp_rel_ugc() {
Expand Down Expand Up @@ -81,7 +81,7 @@ public function data_wp_rel_ugc() {
public function test_append_ugc_with_valueless_attribute() {

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