mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Adds a `public` visibility to test fixtures, tests, data providers, and callbacks methods. Adds a `private` visibility to helper methods within test classes. Renames callbacks and helpers that previously started with a `_` prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit. Props costdev, jrf, hellofromTonya. Fixes #54177. git-svn-id: https://develop.svn.wordpress.org/trunk@52010 602fd350-edb4-49c9-b593-d223f7449a82
66 lines
1.1 KiB
PHP
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.
|
|
*/
|
|
public 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',
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
}
|