-
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start checking callbacks for restricted functions
- Loading branch information
Showing
4 changed files
with
197 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
WordPress/Tests/Functions/FunctionRestrictionsUnitTest.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
// Warnings. | ||
add_filter( '', 'foobar' ); | ||
add_action( '', 'foobar' ); | ||
call_user_func( 'foobar' ); | ||
call_user_func_array( 'foobar' ); | ||
forward_static_call( 'foobar' ); | ||
forward_static_call_array( 'foobar' ); | ||
array_diff_uassoc( '', '', 'foobar' ); | ||
array_diff_ukey( '', '', 'foobar' ); | ||
array_filter( '', 'foobar' ); | ||
array_intersect_uassoc( '', 'foobar' ); | ||
array_intersect_ukey( '', 'foobar' ); | ||
array_map( 'foobar' ); | ||
array_reduce( '', 'foobar' ); | ||
array_udiff_assoc( '', 'foobar' ); | ||
array_udiff_uassoc( '', 'foobar1', 'foobar2' ); | ||
array_udiff( '', 'foobar' ); | ||
array_uintersect_assoc( '', 'foobar' ); | ||
array_uintersect_uassoc( '', 'foobar1', 'foobar2' ); | ||
array_uintersect( '', 'foobar' ); | ||
array_walk( '', 'foobar' ); | ||
array_walk_recursive( '', 'foobar' ); | ||
iterator_apply( '', 'foobar' ); | ||
usort( '', 'foobar' ); | ||
uasort( '', 'foobar' ); | ||
uksort( '', 'foobar' ); | ||
preg_replace_callback( '', 'foobar' ); | ||
mb_ereg_replace_callback( '', 'foobar' ); | ||
header_register_callback( 'foobar' ); | ||
ob_start( 'foobar' ); | ||
set_error_handler( 'foobar' ); | ||
set_exception_handler( 'foobar' ); | ||
register_shutdown_function( 'foobar' ); | ||
register_tick_function( 'foobar' ); |
41 changes: 41 additions & 0 deletions
41
WordPress/Tests/Functions/FunctionRestrictionsUnitTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Unit test class for WordPress Coding Standard. | ||
* | ||
* @package WPCS\WordPressCodingStandards | ||
* @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards | ||
* @license https://opensource.org/licenses/MIT MIT | ||
*/ | ||
|
||
/** | ||
* Unit test class for the DontExtract sniff. | ||
* | ||
* @package WPCS\WordPressCodingStandards | ||
* @since 0.10.0 | ||
*/ | ||
class WordPress_Tests_Functions_FunctionRestrictionsUnitTest extends AbstractSniffUnitTest { | ||
|
||
/** | ||
* Returns the lines where errors should occur. | ||
* | ||
* @return array <int line number> => <int number of errors> | ||
*/ | ||
public function getErrorList() { | ||
return array(); | ||
|
||
} | ||
|
||
/** | ||
* Returns the lines where warnings should occur. | ||
* | ||
* @return array <int line number> => <int number of warnings> | ||
*/ | ||
public function getWarningList() { | ||
$array = array_fill( 4, 33, 1 ); | ||
$array[18] = 2; | ||
$array[21] = 2; | ||
return $array; | ||
|
||
} | ||
|
||
} // End class. |