Skip to content

Commit c8a7b08

Browse files
committed
Tests: Make style, script module and load data providers static.
Declare ten data providers in the style-engine, script-module, and load tests as `public static` for compatibility with newer PHPUnit versions. Add explicit `array` return types to the five load providers. Preserve all datasets and assertions. Developed in: #15098, #15102, #15153 Props rejaulalomkhan, therssoftware, mukesh27. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@65027 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4b350d6 commit c8a7b08

8 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎tests/phpunit/tests/load/wpConvertHrToBytes.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function test_wp_convert_hr_to_bytes( $value, $expected ) {
3232
* }
3333
* }
3434
*/
35-
public function data_wp_convert_hr_to_bytes() {
35+
public static function data_wp_convert_hr_to_bytes(): array {
3636
$array = array(
3737
// Integer input.
3838
array( -1, -1 ), // = no memory limit.

‎tests/phpunit/tests/load/wpGetDevelopmentMode.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function test_wp_is_development_mode( $current, $given, $expected ) {
7474
*
7575
* @return array[]
7676
*/
77-
public function data_wp_is_development_mode() {
77+
public static function data_wp_is_development_mode(): array {
7878
return array(
7979
'core mode, testing for core' => array(
8080
'core',

‎tests/phpunit/tests/load/wpGetEnvironmentType.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function test_returns_valid_environment_type_from_constant( $environment
4747
*
4848
* @return array[]
4949
*/
50-
public function data_valid_environment_types() {
50+
public static function data_valid_environment_types(): array {
5151
return array(
5252
'local' => array( 'local' ),
5353
'development' => array( 'development' ),

‎tests/phpunit/tests/load/wpIsFileModAllowed.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function test_passes_context_to_filter( $context ) {
6767
*
6868
* @return array[]
6969
*/
70-
public function data_contexts() {
70+
public static function data_contexts(): array {
7171
return array(
7272
'install_plugins' => array( 'install_plugins' ),
7373
'automatic_updater' => array( 'automatic_updater' ),

‎tests/phpunit/tests/load/wpIsIniValueChangeable.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function test_wp_is_ini_value_changeable( $setting, $expected ) {
3333
* }
3434
* }
3535
*/
36-
public function data_wp_is_ini_value_changeable() {
36+
public static function data_wp_is_ini_value_changeable(): array {
3737
$array = array(
3838
array( 'memory_limit', true ), // PHP_INI_ALL.
3939
array( 'log_errors', true ), // PHP_INI_ALL.

‎tests/phpunit/tests/script-modules/wpScriptModules.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public function test_comprehensive_methods( bool $use_global_function, bool $onl
476476
*
477477
* @return array<string, array{ use_global_function: bool, only_enqueue: bool }>
478478
*/
479-
public function data_test_register_and_enqueue_script_module(): array {
479+
public static function data_test_register_and_enqueue_script_module(): array {
480480
$data = array();
481481

482482
foreach ( array( true, false ) as $use_global_function ) {
@@ -1409,7 +1409,7 @@ function ( $_ ) use ( $data ) {
14091409
*
14101410
* @return array<string, array{fetchpriority: string}>
14111411
*/
1412-
public function data_provider_fetchpriority_values(): array {
1412+
public static function data_provider_fetchpriority_values(): array {
14131413
return array(
14141414
'auto' => array( 'fetchpriority' => 'auto' ),
14151415
'low' => array( 'fetchpriority' => 'low' ),
@@ -1555,7 +1555,7 @@ public function test_set_fetchpriority_with_invalid_value() {
15551555
*
15561556
* @return array<string, array{enqueues: string[], expected: array}>
15571557
*/
1558-
public function data_provider_to_test_fetchpriority_bumping(): array {
1558+
public static function data_provider_to_test_fetchpriority_bumping(): array {
15591559
return array(
15601560
'enqueue_bajo' => array(
15611561
'enqueues' => array( 'bajo' ),

‎tests/phpunit/tests/style-engine/styleEngine.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function test_wp_style_engine_get_styles( $block_styles, $options, $expec
5454
*
5555
* @return array
5656
*/
57-
public function data_wp_style_engine_get_styles() {
57+
public static function data_wp_style_engine_get_styles() {
5858
return array(
5959
'default_return_value' => array(
6060
'block_styles' => array(),

‎tests/phpunit/tests/style-engine/wpStyleEngineCssDeclarations.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function test_should_compile_css_declarations_to_css_declarations_string(
270270
*
271271
* @return array
272272
*/
273-
public function data_should_compile_css_declarations_to_css_declarations_string() {
273+
public static function data_should_compile_css_declarations_to_css_declarations_string() {
274274
return array(
275275
'unprettified, no indent' => array(
276276
'expected' => 'color:red;border-top-left-radius:99px;text-decoration:underline;',

0 commit comments

Comments
 (0)