Skip to content
Closed
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
14 changes: 7 additions & 7 deletions tests/phpunit/tests/formatting/wpRelNofollow.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ class Tests_Formatting_wpRelNofollow extends WP_UnitTestCase {
*/
public function test_add_no_follow() {
$content = '<p>This is some cool <a href="/">Code</a></p>';
$expected = '<p>This is some cool <a href=\"/\" rel=\"nofollow\">Code</a></p>';
$this->assertSame( $expected, wp_rel_nofollow( $content ) );
$expected = '<p>This is some cool <a href="/" rel="nofollow">Code</a></p>';
$this->assertEqualHTML( $expected, stripslashes( wp_rel_nofollow( $content ) ) );
}

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

/**
* @ticket 11360
* @dataProvider data_wp_rel_nofollow
*/
public function test_wp_rel_nofollow( $input, $output, $expect_deprecation = false ) {
$this->assertSame( wp_slash( $output ), wp_rel_nofollow( $input ) );
$this->assertEqualHTML( $output, stripslashes( wp_rel_nofollow( $input ) ) );
}

public function data_wp_rel_nofollow() {
Expand Down Expand Up @@ -80,7 +80,7 @@ public function data_wp_rel_nofollow() {

public function test_append_no_follow_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\">Code</a></p>';
$this->assertSame( $expected, wp_rel_nofollow( $content ) );
$expected = '<p>This is some cool <a href="demo.com" download rel="hola nofollow">Code</a></p>';
$this->assertEqualHTML( $expected, stripslashes( wp_rel_nofollow( $content ) ) );
}
}
Loading