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: 14 additions & 0 deletions tests/phpunit/tests/formatting/stripslashesDeep.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @group slashes
*
* @covers ::stripslashes_deep
* @covers ::stripslashes_from_strings_only
*/
class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase {
/**
Expand Down Expand Up @@ -55,4 +56,17 @@ public function test_permits_escaped_slash() {
$this->assertSame( $txt, stripslashes_deep( "I can\'t see, isn\\\'t that it?" ) );
$this->assertSame( $txt, stripslashes_deep( "I can\'t see, isn\\\\\'t that it?" ) );
}

/**
* Tests that stripslashes_from_strings_only() does not strip slashes from array elements.
*
* Unlike stripslashes_deep(), stripslashes_from_strings_only() does not recurse into arrays.
*
* @ticket 65819
*/
public function test_stripslashes_from_strings_only_does_not_strip_array() {
$slashed_array = array( "I can\'t see", 'b' );

$this->assertSame( $slashed_array, stripslashes_from_strings_only( $slashed_array ) );
}
}
Loading