diff --git a/tests/phpunit/tests/functions.php b/tests/phpunit/tests/functions.php index dd908dfcf7..84d032dd95 100644 --- a/tests/phpunit/tests/functions.php +++ b/tests/phpunit/tests/functions.php @@ -236,44 +236,6 @@ class Tests_Functions extends WP_UnitTestCase { $this->assertFalse( is_serialized( 'C:16:"Serialized_Class":6:{a:0:{}}' ) ); } - /** - * @dataProvider data_is_serialized_string - */ - public function test_is_serialized_string( $value, $result ) { - $this->assertSame( is_serialized_string( $value ), $result ); - } - - public function data_is_serialized_string() { - return array( - // Not a string. - array( 0, false ), - - // Too short when trimmed. - array( 's:3 ', false ), - - // Too short. - array( 's:3', false ), - - // No colon in second position. - array( 's!3:"foo";', false ), - - // No trailing semicolon. - array( 's:3:"foo"', false ), - - // Wrong type. - array( 'a:3:"foo";', false ), - - // No closing quote. - array( 'a:3:"foo;', false ), - - // Wrong number of characters is close enough for is_serialized_string(). - array( 's:12:"foo";', true ), - - // Okay. - array( 's:3:"foo";', true ), - - ); - } /** * @group add_query_arg diff --git a/tests/phpunit/tests/functions/isSerializedString.php b/tests/phpunit/tests/functions/isSerializedString.php new file mode 100644 index 0000000000..292765aab4 --- /dev/null +++ b/tests/phpunit/tests/functions/isSerializedString.php @@ -0,0 +1,68 @@ +assertSame( $expected, is_serialized_string( $data ) ); + } +}