Files
wordpress-develop/tests/phpunit/tests/functions/addMagicQuotes.php
T
2020-09-19 15:52:03 +00:00

66 lines
1.1 KiB
PHP

<?php
/**
* @group formatting
* @group functions.php
* @covers ::add_magic_quotes
*/
class Tests_Functions_AddMagicQuotes extends WP_UnitTestCase {
/**
* @ticket 48605
*
* @dataProvider data_add_magic_quotes
*
* @param array $test_array Test value.
* @param array $expected Expected return value.
*/
function test_add_magic_quotes( $test_array, $expected ) {
$this->assertSame( $expected, add_magic_quotes( $test_array ) );
}
/**
* Data provider for test_add_magic_quotes.
*
* @return array[] Test parameters {
* @type array $test_array Test value.
* @type array $expected Expected return value.
* }
*/
public function data_add_magic_quotes() {
return array(
array(
array(
'sample string',
52,
true,
false,
null,
"This is a 'string'",
array(
1,
false,
true,
'This is "another" string',
),
),
array(
'sample string',
52,
true,
false,
null,
"This is a \'string\'",
array(
1,
false,
true,
'This is \"another\" string',
),
),
),
);
}
}