Skip to content

Commit

Permalink
Change the letter case of passed properties, not methods in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dingo-d committed Sep 21, 2023
1 parent 794f4cf commit d9b23ed
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions WordPress/Tests/DB/DirectDatabaseQueryUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ function method_names_are_caseinsensitive() {
// phpcs:set WordPress.DB.DirectDatabaseQuery customCacheDeleteFunctions[] MY_cachedeL
function cache_customA() {
global $wpdb;
$quux = MY_cacheget( 'quux' );
$quux = my_cacheget( 'quux' );
if ( false !== $quux ) {
$wpdb->get_results( 'SELECT X FROM Y' ); // Warning direct DB call.
my_cacheSet( 'key', 'group' );
my_cacheset( 'key', 'group' );
}
}

Expand All @@ -353,14 +353,14 @@ function cache_customB() {
$quux = my_cacheget( 'quux' );
if ( false !== $quux ) {
$wpdb->get_results( 'SELECT X FROM Y' ); // Warning direct DB call.
my_other_CacheSet( 'key', 'group' );
my_other_cacheset( 'key', 'group' );
}
}

function cache_customC() {
global $wpdb;
$wpdb->query( 'SELECT X FROM Y' ); // Warning direct DB call.
my_cacheDEL( 'key', 'group' );
my_cachedel( 'key', 'group' );
}

// phpcs:set WordPress.DB.DirectDatabaseQuery customCacheSetFunctions[] my_cacheSet
Expand All @@ -371,7 +371,7 @@ function cache_customD() {
$quux = my_cacheget( 'quux' );
if ( false !== $quux ) {
$wpdb->get_results( 'SELECT X FROM Y' ); // Warning direct DB call.
my_cacHeset( 'key', 'group' );
my_cacheset( 'key', 'group' );
}
}

Expand Down
2 changes: 1 addition & 1 deletion WordPress/Tests/PHP/NoSilencedErrorsUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $files1 = @ & scandir($dir); // Bad.
/*
* The custom allowed functions list will be respected even when `usePHPFunctionsList` is set to false.
*/
// phpcs:set WordPress.PHP.NoSilencedErrors customAllowedFunctionsList[] fgetcsv,hex2bin
// phpcs:set WordPress.PHP.NoSilencedErrors customAllowedFunctionsList[] fgetCsv,hEx2bin
while ( ( $csvdata = @fgetcsv( $handle, 2000, $separator ) ) !== false ) {}
echo @some_userland_function( $param ); // Bad.
$decoded = @hex2bin( $data );
Expand Down
4 changes: 2 additions & 2 deletions WordPress/Tests/Security/EscapeOutputUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ echo '<input type="search" value="' . get_search_query( escape: false ) . '">';
echo '<input type="search" value="' . get_search_query( escaped: false ) . '">'; // Bad.

// phpcs:set WordPress.Security.EscapeOutput customPrintingFunctions[] TO_SCREEN,my_print
to_scReen( $var1, esc_attr( $var2 ) ); // Bad x 1.
my_prinT( $var1, $var2 ); // Bad x 2.
to_screen( $var1, esc_attr( $var2 ) ); // Bad x 1.
my_print( $var1, $var2 ); // Bad x 2.

// phpcs:set WordPress.Security.EscapeOutput customEscapingFunctions[]
2 changes: 1 addition & 1 deletion WordPress/Tests/Security/NonceVerificationUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ enum MyEnum {
// phpcs:set WordPress.Security.NonceVerification customNonceVerificationFunctions[] MY_nonce_check
// phpcs:set WordPress.Security.NonceVerification customUnslashingSanitizingFunctions[] do_sometHING
function foo_6() {
my_noncE_cheCk( do_soMeThinG( $_POST['tweet'] ) ); // OK.
my_nonce_check( do_something( $_POST['tweet'] ) ); // OK.
}
// phpcs:set WordPress.Security.NonceVerification customUnslashingSanitizingFunctions[]
// phpcs:set WordPress.Security.NonceVerification customNonceVerificationFunctions[]
12 changes: 6 additions & 6 deletions WordPress/Tests/Security/ValidatedSanitizedInputUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -513,16 +513,16 @@ function test_this() {

// phpcs:set WordPress.Security.ValidatedSanitizedInput customSanitizingFunctions[] sanitize_color,sanitize_TWITTER_handle

$abc = sanitize_cOlor( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_facebook_ID( wp_unslash( $_POST['abc_field'] ) ); // Bad x1 - sanitize.
$abc = sanitize_twitteR_handle( $_POST['abc_field'] ); // Bad x1 - unslash.
$abc = sanitize_color( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_facebook_id( wp_unslash( $_POST['abc_field'] ) ); // Bad x1 - sanitize.
$abc = sanitize_twitter_handle( $_POST['abc_field'] ); // Bad x1 - unslash.

// phpcs:set WordPress.Security.ValidatedSanitizedInput customSanitizingFunctions[] sanitize_color,sanitize_facebook_ID
// phpcs:set WordPress.Security.ValidatedSanitizedInput customUnslashingSanitizingFunctions[] sanITize_twitter_handle

$abc = sanitizE_coLor( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_facebook_ID( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_TWITTER_haNdle( $_POST['abc_field'] ); // OK.
$abc = sanitize_color( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_facebook_id( wp_unslash( $_POST['abc_field'] ) ); // OK.
$abc = sanitize_twitter_handle( $_POST['abc_field'] ); // OK.

// phpcs:set WordPress.Security.ValidatedSanitizedInput customSanitizingFunctions[]
// phpcs:set WordPress.Security.ValidatedSanitizedInput customUnslashingSanitizingFunctions[]
Expand Down

0 comments on commit d9b23ed

Please sign in to comment.