Skip to content

Commit c4fec3d

Browse files
committed
WP/DeprecatedParameterValues: add tests for namespaced names
1 parent f1cce10 commit c4fec3d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

WordPress/Tests/WP/DeprecatedParameterValuesUnitTest.1.inc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// All will give an ERROR.
44

55
get_bloginfo( 'home' );
6-
get_bloginfo( 'siteurl' );
7-
get_bloginfo( "text_direction" );
6+
\GeT_bLoGiNfO( 'siteurl' );
7+
Get_Bloginfo( "text_direction" );
88
echo bloginfo( 'home' );
99
echo bloginfo( "siteurl" );
1010
echo bloginfo( 'text_direction' );
@@ -54,3 +54,12 @@ update_option(autoload: true, value: $value, option: 'blacklist_keys');
5454
wp_get_typography_font_size_value( $preset, array() ); // OK.
5555
wp_get_typography_font_size_value( $preset, true ); // Error.
5656
wp_get_typography_font_size_value( $preset, false ); // Error.
57+
58+
/*
59+
* Safeguard correct handling of all types of namespaced function calls.
60+
*/
61+
\get_bloginfo( 'home' ); // Bad.
62+
MyNamespace\register_setting( 'privacy' ); // Ok.
63+
\MyNamespace\unregister_setting( 'misc' ); // Ok.
64+
namespace\get_option('blacklist_keys'); // The sniff should start flagging this once it can resolve relative namespaces.
65+
namespace\Sub\add_option('comment_whitelist', $value); // Ok.

WordPress/Tests/WP/DeprecatedParameterValuesUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function getErrorList( $testFile = '' ) {
5656
49 => 1,
5757
50 => 1,
5858
51 => 1,
59+
61 => 1,
5960
);
6061

6162
default:

0 commit comments

Comments
 (0)