diff --git a/tests/phpunit/tests/formatting/stripslashesDeep.php b/tests/phpunit/tests/formatting/stripslashesDeep.php index b88966cc3427f..e090b41a3dc98 100644 --- a/tests/phpunit/tests/formatting/stripslashesDeep.php +++ b/tests/phpunit/tests/formatting/stripslashesDeep.php @@ -5,6 +5,7 @@ * @group slashes * * @covers ::stripslashes_deep + * @covers ::stripslashes_from_strings_only */ class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase { /** @@ -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 ) ); + } }