Changeset 60729
- Timestamp:
- 09/11/2025 02:45:56 PM (4 weeks ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/plugin-dependencies/base.php
r57658 r60729 83 83 } 84 84 85 self::$reflected_members[ $property ]->setAccessible( true ); 85 if ( PHP_VERSION_ID < 80100 ) { 86 self::$reflected_members[ $property ]->setAccessible( true ); 87 } 86 88 self::$reflected_members[ $property ]->setValue( self::$instance, $value ); 87 self::$reflected_members[ $property ]->setAccessible( false ); 89 if ( PHP_VERSION_ID < 80100 ) { 90 self::$reflected_members[ $property ]->setAccessible( false ); 91 } 88 92 } 89 93 … … 99 103 } 100 104 101 self::$reflected_members[ $property ]->setAccessible( true ); 105 if ( PHP_VERSION_ID < 80100 ) { 106 self::$reflected_members[ $property ]->setAccessible( true ); 107 } 102 108 $value = self::$reflected_members[ $property ]->getValue( self::$instance ); 103 self::$reflected_members[ $property ]->setAccessible( false ); 109 if ( PHP_VERSION_ID < 80100 ) { 110 self::$reflected_members[ $property ]->setAccessible( false ); 111 } 104 112 105 113 return $value; … … 119 127 } 120 128 121 self::$reflected_members[ $method ]->setAccessible( true ); 129 if ( PHP_VERSION_ID < 80100 ) { 130 self::$reflected_members[ $method ]->setAccessible( true ); 131 } 122 132 $value = self::$reflected_members[ $method ]->invokeArgs( self::$instance, $args ); 123 self::$reflected_members[ $method ]->setAccessible( false ); 133 if ( PHP_VERSION_ID < 80100 ) { 134 self::$reflected_members[ $method ]->setAccessible( false ); 135 } 124 136 125 137 return $value; -
trunk/tests/phpunit/tests/admin/wpAutomaticUpdater.php
r56971 r60729 31 31 32 32 self::$send_plugin_theme_email = new ReflectionMethod( self::$updater, 'send_plugin_theme_email' ); 33 self::$send_plugin_theme_email->setAccessible( true ); 33 if ( PHP_VERSION_ID < 80100 ) { 34 self::$send_plugin_theme_email->setAccessible( true ); 35 } 34 36 } 35 37 -
trunk/tests/phpunit/tests/admin/wpCommunityEvents.php
r55337 r60729 300 300 public function test_trim_expired_events() { 301 301 $trim_events = new ReflectionMethod( $this->instance, 'trim_events' ); 302 $trim_events->setAccessible( true ); 302 if ( PHP_VERSION_ID < 80100 ) { 303 $trim_events->setAccessible( true ); 304 } 303 305 304 306 $events = $this->get_valid_events(); … … 329 331 public function test_trim_events_pin_wordcamp() { 330 332 $trim_events = new ReflectionMethod( $this->instance, 'trim_events' ); 331 $trim_events->setAccessible( true ); 333 if ( PHP_VERSION_ID < 80100 ) { 334 $trim_events->setAccessible( true ); 335 } 332 336 333 337 $actual = $trim_events->invoke( $this->instance, $this->_events_with_unpinned_wordcamp() ); … … 434 438 public function test_trim_events_dont_pin_multiple_wordcamps() { 435 439 $trim_events = new ReflectionMethod( $this->instance, 'trim_events' ); 436 $trim_events->setAccessible( true ); 440 if ( PHP_VERSION_ID < 80100 ) { 441 $trim_events->setAccessible( true ); 442 } 437 443 438 444 $actual = $trim_events->invoke( $this->instance, $this->_events_with_multiple_wordcamps() ); -
trunk/tests/phpunit/tests/admin/wpListTable.php
r58389 r60729 71 71 72 72 $column_headers = new ReflectionProperty( $list_table, '_column_headers' ); 73 $column_headers->setAccessible( true ); 73 if ( PHP_VERSION_ID < 80100 ) { 74 $column_headers->setAccessible( true ); 75 } 74 76 $column_headers->setValue( $list_table, $headers ); 75 77 76 78 $column_info = new ReflectionMethod( $list_table, 'get_column_info' ); 77 $column_info->setAccessible( true ); 79 if ( PHP_VERSION_ID < 80100 ) { 80 $column_info->setAccessible( true ); 81 } 78 82 79 83 $this->assertSame( $expected, $column_info->invoke( $list_table ), 'The actual columns did not match the expected columns' ); … … 161 165 public function test_get_views_links( $link_data, $expected ) { 162 166 $get_views_links = new ReflectionMethod( $this->list_table, 'get_views_links' ); 163 $get_views_links->setAccessible( true ); 167 if ( PHP_VERSION_ID < 80100 ) { 168 $get_views_links->setAccessible( true ); 169 } 164 170 165 171 $actual = $get_views_links->invokeArgs( $this->list_table, array( $link_data ) ); … … 276 282 public function test_get_views_links_doing_it_wrong( $link_data ) { 277 283 $get_views_links = new ReflectionMethod( $this->list_table, 'get_views_links' ); 278 $get_views_links->setAccessible( true ); 284 if ( PHP_VERSION_ID < 80100 ) { 285 $get_views_links->setAccessible( true ); 286 } 279 287 $get_views_links->invokeArgs( $this->list_table, array( $link_data ) ); 280 288 } -
trunk/tests/phpunit/tests/admin/wpMediaListTable.php
r56141 r60729 77 77 self::$detached = new ReflectionProperty( self::$list_table, 'detached' ); 78 78 79 self::$is_trash->setAccessible( true ); 79 if ( PHP_VERSION_ID < 80100 ) { 80 self::$is_trash->setAccessible( true ); 81 } 80 82 self::$is_trash_original = self::$is_trash->getValue( self::$list_table ); 81 self::$is_trash->setAccessible( false ); 82 83 self::$detached->setAccessible( true ); 83 if ( PHP_VERSION_ID < 80100 ) { 84 self::$is_trash->setAccessible( false ); 85 } 86 87 if ( PHP_VERSION_ID < 80100 ) { 88 self::$detached->setAccessible( true ); 89 } 84 90 self::$detached_original = self::$detached->getValue( self::$list_table ); 85 self::$detached->setAccessible( false ); 91 if ( PHP_VERSION_ID < 80100 ) { 92 self::$detached->setAccessible( false ); 93 } 86 94 87 95 // Create users. … … 182 190 183 191 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 184 $_get_row_actions->setAccessible( true ); 192 if ( PHP_VERSION_ID < 80100 ) { 193 $_get_row_actions->setAccessible( true ); 194 } 185 195 $actions = $_get_row_actions->invoke( self::$list_table, self::$post, 'att_title' ); 186 $_get_row_actions->setAccessible( false ); 196 if ( PHP_VERSION_ID < 80100 ) { 197 $_get_row_actions->setAccessible( false ); 198 } 187 199 188 200 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 263 275 264 276 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 265 $_get_row_actions->setAccessible( true ); 277 if ( PHP_VERSION_ID < 80100 ) { 278 $_get_row_actions->setAccessible( true ); 279 } 266 280 $actions = $_get_row_actions->invoke( self::$list_table, self::$post, 'att_title' ); 267 $_get_row_actions->setAccessible( false ); 281 if ( PHP_VERSION_ID < 80100 ) { 282 $_get_row_actions->setAccessible( false ); 283 } 268 284 269 285 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 356 372 357 373 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 358 $_get_row_actions->setAccessible( true ); 374 if ( PHP_VERSION_ID < 80100 ) { 375 $_get_row_actions->setAccessible( true ); 376 } 359 377 $actions = $_get_row_actions->invoke( self::$list_table, self::$post, 'att_title' ); 360 $_get_row_actions->setAccessible( false ); 378 if ( PHP_VERSION_ID < 80100 ) { 379 $_get_row_actions->setAccessible( false ); 380 } 361 381 362 382 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 375 395 376 396 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 377 $_get_row_actions->setAccessible( true ); 397 if ( PHP_VERSION_ID < 80100 ) { 398 $_get_row_actions->setAccessible( true ); 399 } 378 400 $actions = $_get_row_actions->invoke( self::$list_table, self::$attachment, 'att_title' ); 379 $_get_row_actions->setAccessible( false ); 401 if ( PHP_VERSION_ID < 80100 ) { 402 $_get_row_actions->setAccessible( false ); 403 } 380 404 381 405 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 398 422 399 423 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 400 $_get_row_actions->setAccessible( true ); 424 if ( PHP_VERSION_ID < 80100 ) { 425 $_get_row_actions->setAccessible( true ); 426 } 401 427 $actions = $_get_row_actions->invoke( self::$list_table, self::$attachment, 'att_title' ); 402 $_get_row_actions->setAccessible( false ); 428 if ( PHP_VERSION_ID < 80100 ) { 429 $_get_row_actions->setAccessible( false ); 430 } 403 431 404 432 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 415 443 public function test_get_row_actions_should_include_download() { 416 444 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 417 $_get_row_actions->setAccessible( true ); 445 if ( PHP_VERSION_ID < 80100 ) { 446 $_get_row_actions->setAccessible( true ); 447 } 418 448 $actions = $_get_row_actions->invoke( self::$list_table, self::$attachment, 'att_title' ); 419 $_get_row_actions->setAccessible( false ); 449 if ( PHP_VERSION_ID < 80100 ) { 450 $_get_row_actions->setAccessible( false ); 451 } 420 452 421 453 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 436 468 437 469 $_get_row_actions = new ReflectionMethod( self::$list_table, '_get_row_actions' ); 438 $_get_row_actions->setAccessible( true ); 470 if ( PHP_VERSION_ID < 80100 ) { 471 $_get_row_actions->setAccessible( true ); 472 } 439 473 $actions = $_get_row_actions->invoke( self::$list_table, self::$attachment, 'att_title' ); 440 $_get_row_actions->setAccessible( false ); 474 if ( PHP_VERSION_ID < 80100 ) { 475 $_get_row_actions->setAccessible( false ); 476 } 441 477 442 478 $this->assertIsArray( $actions, 'An array was not returned.' ); … … 452 488 */ 453 489 private static function set_is_trash( $is_trash ) { 454 self::$is_trash->setAccessible( true ); 490 if ( PHP_VERSION_ID < 80100 ) { 491 self::$is_trash->setAccessible( true ); 492 } 455 493 self::$is_trash->setValue( self::$list_table, $is_trash ); 456 self::$is_trash->setAccessible( false ); 494 if ( PHP_VERSION_ID < 80100 ) { 495 self::$is_trash->setAccessible( false ); 496 } 457 497 } 458 498 … … 465 505 */ 466 506 private static function set_detached( $detached ) { 467 self::$detached->setAccessible( true ); 507 if ( PHP_VERSION_ID < 80100 ) { 508 self::$detached->setAccessible( true ); 509 } 468 510 self::$detached->setValue( self::$list_table, $detached ); 469 self::$detached->setAccessible( false ); 511 if ( PHP_VERSION_ID < 80100 ) { 512 self::$detached->setAccessible( false ); 513 } 470 514 } 471 515 } -
trunk/tests/phpunit/tests/admin/wpPluginsListTable.php
r60250 r60729 150 150 $show_autoupdates = new ReflectionProperty( $list_table, 'show_autoupdates' ); 151 151 152 $show_autoupdates->setAccessible( true ); 152 if ( PHP_VERSION_ID < 80100 ) { 153 $show_autoupdates->setAccessible( true ); 154 } 153 155 $actual = $show_autoupdates->getValue( $list_table ); 154 $show_autoupdates->setAccessible( false ); 156 if ( PHP_VERSION_ID < 80100 ) { 157 $show_autoupdates->setAccessible( false ); 158 } 155 159 156 160 $_REQUEST['plugin_status'] = $original_status; -
trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php
r58176 r60729 53 53 // Set the request type as 'export_personal_data'. 54 54 $reflection_property = $reflection->getProperty( 'request_type' ); 55 $reflection_property->setAccessible( true ); 55 if ( PHP_VERSION_ID < 80100 ) { 56 $reflection_property->setAccessible( true ); 57 } 56 58 $reflection_property->setValue( $instance, 'export_personal_data' ); 57 59 58 60 // Set the post type as 'user_request'. 59 61 $reflection_property = $reflection->getProperty( 'post_type' ); 60 $reflection_property->setAccessible( true ); 62 if ( PHP_VERSION_ID < 80100 ) { 63 $reflection_property->setAccessible( true ); 64 } 61 65 $reflection_property->setValue( $instance, 'user_request' ); 62 66 -
trunk/tests/phpunit/tests/admin/wpSiteHealth.php
r58432 r60729 41 41 $reflection = new ReflectionClass( $this->instance ); 42 42 $reflection_property = $reflection->getProperty( 'mysql_recommended_version' ); 43 $reflection_property->setAccessible( true ); 44 43 if ( PHP_VERSION_ID < 80100 ) { 44 $reflection_property->setAccessible( true ); 45 } 45 46 $readme = file_get_contents( ABSPATH . 'readme.html' ); 46 47 … … 57 58 $reflection = new ReflectionClass( $this->instance ); 58 59 $reflection_property = $reflection->getProperty( 'mariadb_recommended_version' ); 59 $reflection_property->setAccessible( true ); 60 if ( PHP_VERSION_ID < 80100 ) { 61 $reflection_property->setAccessible( true ); 62 } 60 63 61 64 $readme = file_get_contents( ABSPATH . 'readme.html' ); -
trunk/tests/phpunit/tests/admin/wpTermsListTable.php
r56680 r60729 50 50 private function call_inaccessible_method( $instance, $method_name, $args = array() ) { 51 51 $method = ( new ReflectionClass( $instance ) )->getMethod( $method_name ); 52 $method->setAccessible( true ); 52 if ( PHP_VERSION_ID < 80100 ) { 53 $method->setAccessible( true ); 54 } 53 55 return $method->invokeArgs( $instance, $args ); 54 56 } -
trunk/tests/phpunit/tests/admin/wpUpgrader.php
r59257 r60729 171 171 public function test_flatten_dirlist_should_flatten_the_provided_directory_list( $expected, $nested_files, $path = '' ) { 172 172 $flatten_dirlist = new ReflectionMethod( self::$instance, 'flatten_dirlist' ); 173 $flatten_dirlist->setAccessible( true ); 173 if ( PHP_VERSION_ID < 80100 ) { 174 $flatten_dirlist->setAccessible( true ); 175 } 174 176 $actual = $flatten_dirlist->invoke( self::$instance, $nested_files, $path ); 175 $flatten_dirlist->setAccessible( false ); 177 if ( PHP_VERSION_ID < 80100 ) { 178 $flatten_dirlist->setAccessible( false ); 179 } 176 180 177 181 $this->assertSameSetsWithIndex( $expected, $actual ); -
trunk/tests/phpunit/tests/block-bindings/wp-block-get-block-bindings-processor.php
r60684 r60729 16 16 public static function wpSetupBeforeClass() { 17 17 self::$get_block_bindings_processor_method = new ReflectionMethod( 'WP_Block', 'get_block_bindings_processor' ); 18 self::$get_block_bindings_processor_method->setAccessible( true ); 18 if ( PHP_VERSION_ID < 80100 ) { 19 self::$get_block_bindings_processor_method->setAccessible( true ); 20 } 19 21 } 20 22 -
trunk/tests/phpunit/tests/block-supports/duotone.php
r57652 r60729 79 79 80 80 $reflection = new ReflectionMethod( 'WP_Duotone', 'get_slug_from_attribute' ); 81 $reflection->setAccessible( true ); 81 if ( PHP_VERSION_ID < 80100 ) { 82 $reflection->setAccessible( true ); 83 } 82 84 83 85 $this->assertSame( $expected, $reflection->invoke( null, $data_attr ) ); … … 129 131 $wp_duotone = new WP_Duotone(); 130 132 $block_css_declarations_property = new ReflectionProperty( 'WP_Duotone', 'block_css_declarations' ); 131 $block_css_declarations_property->setAccessible( true ); 133 if ( PHP_VERSION_ID < 80100 ) { 134 $block_css_declarations_property->setAccessible( true ); 135 } 132 136 $previous_value = $block_css_declarations_property->getValue(); 133 137 $block_css_declarations_property->setValue( $wp_duotone, array() ); … … 138 142 // Reset the property. 139 143 $block_css_declarations_property->setValue( $wp_duotone, $previous_value ); 140 $block_css_declarations_property->setAccessible( false ); 144 if ( PHP_VERSION_ID < 80100 ) { 145 $block_css_declarations_property->setAccessible( false ); 146 } 141 147 142 148 $this->assertNotEmpty( $actual ); … … 148 154 public function test_is_preset( $data_attr, $expected ) { 149 155 $reflection = new ReflectionMethod( 'WP_Duotone', 'is_preset' ); 150 $reflection->setAccessible( true ); 156 if ( PHP_VERSION_ID < 80100 ) { 157 $reflection->setAccessible( true ); 158 } 151 159 152 160 $this->assertSame( $expected, $reflection->invoke( null, $data_attr ) ); … … 174 182 public function test_colord_parse_hue( $value, $unit, $expected ) { 175 183 $reflection = new ReflectionMethod( 'WP_Duotone', 'colord_parse_hue' ); 176 $reflection->setAccessible( true ); 184 if ( PHP_VERSION_ID < 80100 ) { 185 $reflection->setAccessible( true ); 186 } 177 187 178 188 $this->assertSame( $expected, $reflection->invoke( null, $value, $unit ) ); -
trunk/tests/phpunit/tests/block-template.php
r59201 r60729 328 328 $this->assertSame( $expected, get_block_theme_folders( $theme ), 'Incorrect block theme folders were retrieved.' ); 329 329 $reflection = new ReflectionMethod( $wp_theme, 'cache_get' ); 330 $reflection->setAccessible( true ); 330 if ( PHP_VERSION_ID < 80100 ) { 331 $reflection->setAccessible( true ); 332 } 331 333 $theme_cache = $reflection->invoke( $wp_theme, 'theme' ); 332 334 $cached_value = $theme_cache['block_template_folders']; 333 $reflection->setAccessible( false ); 335 if ( PHP_VERSION_ID < 80100 ) { 336 $reflection->setAccessible( false ); 337 } 334 338 335 339 $this->assertSame( $expected, $cached_value, 'The cached value is incorrect.' ); -
trunk/tests/phpunit/tests/blocks/wpBlockPatternsRegistry.php
r58176 r60729 663 663 $reflection = new ReflectionClass( $registry ); 664 664 $property = $reflection->getProperty( 'registered_patterns' ); 665 $property->setAccessible( true ); 665 if ( PHP_VERSION_ID < 80100 ) { 666 $property->setAccessible( true ); 667 } 666 668 667 669 // Get the value of the private property. 668 670 $registered_patterns = $property->getValue( $registry ); 669 $property->setAccessible( false ); 671 if ( PHP_VERSION_ID < 80100 ) { 672 $property->setAccessible( false ); 673 } 670 674 671 675 return $registered_patterns; … … 682 686 $reflection = new ReflectionClass( $registry ); 683 687 $property = $reflection->getProperty( 'registered_patterns' ); 684 $property->setAccessible( true ); 688 if ( PHP_VERSION_ID < 80100 ) { 689 $property->setAccessible( true ); 690 } 685 691 686 692 // Set the value of the private property. 687 693 $property->setValue( $registry, $value ); 688 $property->setAccessible( false ); 694 if ( PHP_VERSION_ID < 80100 ) { 695 $property->setAccessible( false ); 696 } 689 697 } 690 698 } -
trunk/tests/phpunit/tests/db.php
r60622 r60729 1988 1988 1989 1989 $property = new ReflectionProperty( $wpdb, 'allow_unsafe_unquoted_parameters' ); 1990 $property->setAccessible( true ); 1990 if ( PHP_VERSION_ID < 80100 ) { 1991 $property->setAccessible( true ); 1992 } 1991 1993 $property->setValue( $wpdb, $allow ); 1992 1994 … … 1996 1998 // Reset. 1997 1999 $property->setValue( $wpdb, $default ); 1998 $property->setAccessible( false ); 2000 if ( PHP_VERSION_ID < 80100 ) { 2001 $property->setAccessible( false ); 2002 } 1999 2003 2000 2004 $this->assertSame( $expected, $actual ); -
trunk/tests/phpunit/tests/dependencies/scripts.php
r60728 r60729 446 446 $wp_scripts_reflection = new ReflectionClass( WP_Scripts::class ); 447 447 $filter_eligible_strategies = $wp_scripts_reflection->getMethod( 'filter_eligible_strategies' ); 448 $filter_eligible_strategies->setAccessible( true ); 448 if ( PHP_VERSION_ID < 80100 ) { 449 $filter_eligible_strategies->setAccessible( true ); 450 } 449 451 $this->assertSame( $expected, $filter_eligible_strategies->invokeArgs( wp_scripts(), array( $handle ) ), 'Expected return value of WP_Scripts::filter_eligible_strategies to match.' ); 450 452 } -
trunk/tests/phpunit/tests/error-protection/wpRecoveryModeCookieService.php
r51650 r60729 36 36 $service = new WP_Recovery_Mode_Cookie_Service(); 37 37 $reflection = new ReflectionMethod( $service, 'recovery_mode_hash' ); 38 $reflection->setAccessible( true ); 38 if ( PHP_VERSION_ID < 80100 ) { 39 $reflection->setAccessible( true ); 40 } 39 41 40 42 $to_sign = sprintf( 'recovery_mode|%s|%s', time() - WEEK_IN_SECONDS - 30, wp_generate_password( 20, false ) ); … … 55 57 $service = new WP_Recovery_Mode_Cookie_Service(); 56 58 $reflection = new ReflectionMethod( $service, 'generate_cookie' ); 57 $reflection->setAccessible( true ); 59 if ( PHP_VERSION_ID < 80100 ) { 60 $reflection->setAccessible( true ); 61 } 58 62 59 63 $cookie = $reflection->invoke( $service ); … … 73 77 $service = new WP_Recovery_Mode_Cookie_Service(); 74 78 $reflection = new ReflectionMethod( $service, 'recovery_mode_hash' ); 75 $reflection->setAccessible( true ); 79 if ( PHP_VERSION_ID < 80100 ) { 80 $reflection->setAccessible( true ); 81 } 76 82 77 83 $to_sign = sprintf( 'recovery_mode|%s|%s', 'month', wp_generate_password( 20, false ) ); … … 93 99 $service = new WP_Recovery_Mode_Cookie_Service(); 94 100 $reflection = new ReflectionMethod( $service, 'generate_cookie' ); 95 $reflection->setAccessible( true ); 101 if ( PHP_VERSION_ID < 80100 ) { 102 $reflection->setAccessible( true ); 103 } 96 104 97 105 $this->assertTrue( $service->validate_cookie( $reflection->invoke( $service ) ) ); -
trunk/tests/phpunit/tests/functions/maybeSerialize.php
r57735 r60729 218 218 $new_value = unserialize( $serialized ); 219 219 $property = ( new ReflectionClass( 'WpOrg\Requests\Utility\FilteredIterator' ) )->getProperty( 'callback' ); 220 $property->setAccessible( true ); 220 if ( PHP_VERSION_ID < 80100 ) { 221 $property->setAccessible( true ); 222 } 221 223 $callback_value = $property->getValue( $new_value ); 222 224 -
trunk/tests/phpunit/tests/hooks/addFilter.php
r56609 r60729 317 317 $reflection = new ReflectionClass( $hook ); 318 318 $reflection_property = $reflection->getProperty( 'priorities' ); 319 $reflection_property->setAccessible( true ); 319 if ( PHP_VERSION_ID < 80100 ) { 320 $reflection_property->setAccessible( true ); 321 } 320 322 321 323 return $reflection_property->getValue( $hook ); -
trunk/tests/phpunit/tests/hooks/removeAllFilters.php
r56609 r60729 58 58 $reflection = new ReflectionClass( $hook ); 59 59 $reflection_property = $reflection->getProperty( 'priorities' ); 60 $reflection_property->setAccessible( true ); 60 if ( PHP_VERSION_ID < 80100 ) { 61 $reflection_property->setAccessible( true ); 62 } 61 63 62 64 return $reflection_property->getValue( $hook ); -
trunk/tests/phpunit/tests/hooks/removeFilter.php
r56609 r60729 102 102 $reflection = new ReflectionClass( $hook ); 103 103 $reflection_property = $reflection->getProperty( 'priorities' ); 104 $reflection_property->setAccessible( true ); 104 if ( PHP_VERSION_ID < 80100 ) { 105 $reflection_property->setAccessible( true ); 106 } 105 107 106 108 return $reflection_property->getValue( $hook ); -
trunk/tests/phpunit/tests/image/editor.php
r58049 r60729 210 210 211 211 $property = new ReflectionProperty( $editor, 'size' ); 212 $property->setAccessible( true ); 212 if ( PHP_VERSION_ID < 80100 ) { 213 $property->setAccessible( true ); 214 } 213 215 $property->setValue( 214 216 $editor, … … 256 258 ); 257 259 $property = new ReflectionProperty( $editor, 'size' ); 258 $property->setAccessible( true ); 260 if ( PHP_VERSION_ID < 80100 ) { 261 $property->setAccessible( true ); 262 } 259 263 $property->setValue( $editor, $size ); 260 264 … … 279 283 ); 280 284 $property = new ReflectionProperty( $editor, 'size' ); 281 $property->setAccessible( true ); 285 if ( PHP_VERSION_ID < 80100 ) { 286 $property->setAccessible( true ); 287 } 282 288 $property->setValue( $editor, $size ); 283 289 -
trunk/tests/phpunit/tests/image/editorGd.php
r54401 r60729 555 555 556 556 $property = new ReflectionProperty( $gd_image_editor, 'image' ); 557 $property->setAccessible( true ); 557 if ( PHP_VERSION_ID < 80100 ) { 558 $property->setAccessible( true ); 559 } 558 560 559 561 $color_top_left = imagecolorat( $property->getValue( $gd_image_editor ), 0, 0 ); … … 574 576 575 577 $property = new ReflectionProperty( $gd_image_editor, 'image' ); 576 $property->setAccessible( true ); 578 if ( PHP_VERSION_ID < 80100 ) { 579 $property->setAccessible( true ); 580 } 577 581 578 582 $color_top_left = imagecolorat( $property->getValue( $gd_image_editor ), 0, 0 ); -
trunk/tests/phpunit/tests/image/editorImagick.php
r60667 r60729 441 441 442 442 $property = new ReflectionProperty( $imagick_image_editor, 'image' ); 443 $property->setAccessible( true ); 443 if ( PHP_VERSION_ID < 80100 ) { 444 $property->setAccessible( true ); 445 } 444 446 445 447 $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor(); … … 460 462 461 463 $property = new ReflectionProperty( $imagick_image_editor, 'image' ); 462 $property->setAccessible( true ); 464 if ( PHP_VERSION_ID < 80100 ) { 465 $property->setAccessible( true ); 466 } 463 467 464 468 $color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 0 )->getColor(); -
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-style.php
r58594 r60729 48 48 private function merge_style_property( $style_attribute_value, $style_property_name, $style_property_value ) { 49 49 $evaluate = new ReflectionMethod( $this->interactivity, 'merge_style_property' ); 50 $evaluate->setAccessible( true ); 50 if ( PHP_VERSION_ID < 80100 ) { 51 $evaluate->setAccessible( true ); 52 } 51 53 return $evaluate->invokeArgs( $this->interactivity, array( $style_attribute_value, $style_property_name, $style_property_value ) ); 52 54 } -
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI.php
r60070 r60729 42 42 $interactivity = new ReflectionClass( $this->interactivity ); 43 43 $namespace_stack = $interactivity->getProperty( 'namespace_stack' ); 44 $namespace_stack->setAccessible( true ); 44 if ( PHP_VERSION_ID < 80100 ) { 45 $namespace_stack->setAccessible( true ); 46 } 45 47 $namespace_stack->setValue( $this->interactivity, $stack ); 46 48 } … … 56 58 $interactivity = new ReflectionClass( $this->interactivity ); 57 59 $context_stack = $interactivity->getProperty( 'context_stack' ); 58 $context_stack->setAccessible( true ); 60 if ( PHP_VERSION_ID < 80100 ) { 61 $context_stack->setAccessible( true ); 62 } 59 63 $context_stack->setValue( $this->interactivity, $stack ); 60 64 } … … 587 591 public function test_extract_directive_value() { 588 592 $extract_directive_value = new ReflectionMethod( $this->interactivity, 'extract_directive_value' ); 589 $extract_directive_value->setAccessible( true ); 593 if ( PHP_VERSION_ID < 80100 ) { 594 $extract_directive_value->setAccessible( true ); 595 } 590 596 591 597 $result = $extract_directive_value->invoke( $this->interactivity, 'state.foo', 'myPlugin' ); … … 650 656 public function test_extract_directive_value_empty_values() { 651 657 $extract_directive_value = new ReflectionMethod( $this->interactivity, 'extract_directive_value' ); 652 $extract_directive_value->setAccessible( true ); 658 if ( PHP_VERSION_ID < 80100 ) { 659 $extract_directive_value->setAccessible( true ); 660 } 653 661 654 662 $result = $extract_directive_value->invoke( $this->interactivity, '', 'myPlugin' ); … … 684 692 public function test_extract_directive_value_invalid_json() { 685 693 $extract_directive_value = new ReflectionMethod( $this->interactivity, 'extract_directive_value' ); 686 $extract_directive_value->setAccessible( true ); 694 if ( PHP_VERSION_ID < 80100 ) { 695 $extract_directive_value->setAccessible( true ); 696 } 687 697 688 698 // Invalid JSON due to missing quotes. Returns the original value. … … 705 715 public function test_extract_prefix_and_suffix() { 706 716 $extract_prefix_and_suffix = new ReflectionMethod( $this->interactivity, 'extract_prefix_and_suffix' ); 707 $extract_prefix_and_suffix->setAccessible( true ); 717 if ( PHP_VERSION_ID < 80100 ) { 718 $extract_prefix_and_suffix->setAccessible( true ); 719 } 708 720 709 721 $result = $extract_prefix_and_suffix->invoke( $this->interactivity, 'data-wp-interactive' ); … … 979 991 980 992 $evaluate = new ReflectionMethod( $this->interactivity, 'evaluate' ); 981 $evaluate->setAccessible( true ); 993 if ( PHP_VERSION_ID < 80100 ) { 994 $evaluate->setAccessible( true ); 995 } 982 996 983 997 $result = $evaluate->invokeArgs( $this->interactivity, array( $directive_value ) ); … … 1394 1408 public function test_kebab_to_camel_case() { 1395 1409 $method = new ReflectionMethod( $this->interactivity, 'kebab_to_camel_case' ); 1396 $method->setAccessible( true ); 1410 if ( PHP_VERSION_ID < 80100 ) { 1411 $method->setAccessible( true ); 1412 } 1397 1413 1398 1414 $this->assertSame( '', $method->invoke( $this->interactivity, '' ) ); -
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPIFunctions.php
r58739 r60729 283 283 $class = new ReflectionClass( 'WP_Interactivity_API' ); 284 284 $directive_processors = $class->getProperty( 'directive_processors' ); 285 $directive_processors->setAccessible( true ); 285 if ( PHP_VERSION_ID < 80100 ) { 286 $directive_processors->setAccessible( true ); 287 } 286 288 $old_directive_processors = $directive_processors->getValue(); 287 289 $directive_processors->setValue( null, array( 'data-wp-test' => array( $this, 'data_wp_test_processor' ) ) ); -
trunk/tests/phpunit/tests/menu/walker-nav-menu.php
r59674 r60729 396 396 $build_atts_reflection = new ReflectionMethod( $this->walker, 'build_atts' ); 397 397 398 $build_atts_reflection->setAccessible( true ); 398 if ( PHP_VERSION_ID < 80100 ) { 399 $build_atts_reflection->setAccessible( true ); 400 } 399 401 $actual = $build_atts_reflection->invoke( $this->walker, $atts ); 400 $build_atts_reflection->setAccessible( false ); 402 if ( PHP_VERSION_ID < 80100 ) { 403 $build_atts_reflection->setAccessible( false ); 404 } 401 405 402 406 $this->assertSame( $expected, $actual ); -
trunk/tests/phpunit/tests/multisite/network.php
r60666 r60729 158 158 $reflection = new ReflectionObject( $network ); 159 159 $property = $reflection->getProperty( 'id' ); 160 $property->setAccessible( true ); 160 if ( PHP_VERSION_ID < 80100 ) { 161 $property->setAccessible( true ); 162 } 161 163 162 164 $this->assertSame( (int) $id, $property->getValue( $network ) ); … … 195 197 $reflection = new ReflectionObject( $network ); 196 198 $property = $reflection->getProperty( 'blog_id' ); 197 $property->setAccessible( true ); 199 if ( PHP_VERSION_ID < 80100 ) { 200 $property->setAccessible( true ); 201 } 198 202 199 203 $this->assertIsString( $property->getValue( $network ) ); -
trunk/tests/phpunit/tests/post/query.php
r57987 r60729 727 727 728 728 $method = new ReflectionMethod( 'WP_Query', 'set_found_posts' ); 729 $method->setAccessible( true ); 729 if ( PHP_VERSION_ID < 80100 ) { 730 $method->setAccessible( true ); 731 } 730 732 $method->invoke( $q, array( 'no_found_rows' => false ), array() ); 731 733 -
trunk/tests/phpunit/tests/query/cacheResults.php
r59979 r60729 103 103 104 104 $reflection = new ReflectionMethod( $query1, 'generate_cache_key' ); 105 $reflection->setAccessible( true ); 105 if ( PHP_VERSION_ID < 80100 ) { 106 $reflection->setAccessible( true ); 107 } 106 108 107 109 $cache_key_1 = $reflection->invoke( $query1, $query_vars, $request ); … … 159 161 160 162 $reflection = new ReflectionMethod( $query1, 'generate_cache_key' ); 161 $reflection->setAccessible( true ); 163 if ( PHP_VERSION_ID < 80100 ) { 164 $reflection->setAccessible( true ); 165 } 162 166 163 167 $cache_key_1 = $reflection->invoke( $query1, $query_vars, $request ); … … 192 196 193 197 $reflection = new ReflectionMethod( $query1, 'generate_cache_key' ); 194 $reflection->setAccessible( true ); 198 if ( PHP_VERSION_ID < 80100 ) { 199 $reflection->setAccessible( true ); 200 } 195 201 196 202 $cache_key_1 = $reflection->invoke( $query1, $query_vars, $request1 ); … … 228 234 229 235 $reflection_q1 = new ReflectionProperty( $query1, 'query_cache_key' ); 230 $reflection_q1->setAccessible( true ); 236 if ( PHP_VERSION_ID < 80100 ) { 237 $reflection_q1->setAccessible( true ); 238 } 231 239 232 240 $reflection_q2 = new ReflectionProperty( $query2, 'query_cache_key' ); 233 $reflection_q2->setAccessible( true ); 241 if ( PHP_VERSION_ID < 80100 ) { 242 $reflection_q2->setAccessible( true ); 243 } 234 244 235 245 $this->assertNotSame( $request1, $request2, 'Queries should not match' ); … … 289 299 290 300 $reflection_q1 = new ReflectionProperty( $query1, 'query_cache_key' ); 291 $reflection_q1->setAccessible( true ); 301 if ( PHP_VERSION_ID < 80100 ) { 302 $reflection_q1->setAccessible( true ); 303 } 292 304 293 305 $reflection_q2 = new ReflectionProperty( $query2, 'query_cache_key' ); 294 $reflection_q2->setAccessible( true ); 306 if ( PHP_VERSION_ID < 80100 ) { 307 $reflection_q2->setAccessible( true ); 308 } 295 309 296 310 $this->assertNotSame( $request1, $request2, 'Queries should not match' ); … … 346 360 347 361 $reflection_q1 = new ReflectionProperty( $query1, 'query_cache_key' ); 348 $reflection_q1->setAccessible( true ); 362 if ( PHP_VERSION_ID < 80100 ) { 363 $reflection_q1->setAccessible( true ); 364 } 349 365 350 366 $reflection_q2 = new ReflectionProperty( $query2, 'query_cache_key' ); 351 $reflection_q2->setAccessible( true ); 367 if ( PHP_VERSION_ID < 80100 ) { 368 $reflection_q2->setAccessible( true ); 369 } 352 370 353 371 $this->assertNotSame( $request1, $request2, 'Queries should not match' ); … … 386 404 387 405 $reflection_q1 = new ReflectionProperty( $query1, 'query_cache_key' ); 388 $reflection_q1->setAccessible( true ); 406 if ( PHP_VERSION_ID < 80100 ) { 407 $reflection_q1->setAccessible( true ); 408 } 389 409 390 410 $reflection_q2 = new ReflectionProperty( $query2, 'query_cache_key' ); 391 $reflection_q2->setAccessible( true ); 411 if ( PHP_VERSION_ID < 80100 ) { 412 $reflection_q2->setAccessible( true ); 413 } 392 414 393 415 $this->assertSame( $request1, $request2, 'Queries should match' ); -
trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php
r59970 r60729 708 708 public function test_transient_keys_get_generated_correctly( $parameters_1, $parameters_2, $message, $assert_same = true ) { 709 709 $reflection_method = new ReflectionMethod( static::$controller, 'get_transient_key' ); 710 $reflection_method->setAccessible( true ); 710 if ( PHP_VERSION_ID < 80100 ) { 711 $reflection_method->setAccessible( true ); 712 } 711 713 712 714 $result_1 = $reflection_method->invoke( self::$controller, $parameters_1 ); -
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php
r59970 r60729 64 64 self::$orig_registry = WP_Block_Pattern_Categories_Registry::get_instance(); 65 65 self::$registry_instance_property = new ReflectionProperty( 'WP_Block_Pattern_Categories_Registry', 'instance' ); 66 self::$registry_instance_property->setAccessible( true ); 66 if ( PHP_VERSION_ID < 80100 ) { 67 self::$registry_instance_property->setAccessible( true ); 68 } 67 69 $test_registry = new WP_Block_Pattern_Categories_Registry(); 68 70 self::$registry_instance_property->setValue( null, $test_registry ); … … 90 92 // Restore the original registry instance. 91 93 self::$registry_instance_property->setValue( null, self::$orig_registry ); 92 self::$registry_instance_property->setAccessible( false ); 94 95 if ( PHP_VERSION_ID < 80100 ) { 96 self::$registry_instance_property->setAccessible( false ); 97 } 93 98 self::$registry_instance_property = null; 94 99 self::$orig_registry = null; -
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php
r59964 r60729 64 64 self::$orig_registry = WP_Block_Patterns_Registry::get_instance(); 65 65 self::$registry_instance_property = new ReflectionProperty( 'WP_Block_Patterns_Registry', 'instance' ); 66 self::$registry_instance_property->setAccessible( true ); 66 if ( PHP_VERSION_ID < 80100 ) { 67 self::$registry_instance_property->setAccessible( true ); 68 } 67 69 $test_registry = new WP_Block_Pattern_Categories_Registry(); 68 70 self::$registry_instance_property->setValue( null, $test_registry ); … … 108 110 // Restore the original registry instance. 109 111 self::$registry_instance_property->setValue( null, self::$orig_registry ); 110 self::$registry_instance_property->setAccessible( false ); 112 if ( PHP_VERSION_ID < 80100 ) { 113 self::$registry_instance_property->setAccessible( false ); 114 } 111 115 self::$registry_instance_property = null; 112 116 self::$orig_registry = null; -
trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php
r59970 r60729 1142 1142 1143 1143 $prepare_item_for_database = new ReflectionMethod( $endpoint, 'prepare_item_for_database' ); 1144 $prepare_item_for_database->setAccessible( true ); 1144 if ( PHP_VERSION_ID < 80100 ) { 1145 $prepare_item_for_database->setAccessible( true ); 1146 } 1145 1147 1146 1148 $body_params = array( … … 1194 1196 1195 1197 $prepare_item_for_database = new ReflectionMethod( $endpoint, 'prepare_item_for_database' ); 1196 $prepare_item_for_database->setAccessible( true ); 1198 if ( PHP_VERSION_ID < 80100 ) { 1199 $prepare_item_for_database->setAccessible( true ); 1200 } 1197 1201 1198 1202 $id = get_stylesheet() . '//' . 'my_template_part'; -
trunk/tests/phpunit/tests/rest-api/wpRestUrlDetailsController.php
r56559 r60729 1197 1197 $class = new ReflectionClass( WP_REST_URL_Details_Controller::class ); 1198 1198 $method = $class->getMethod( $method_name ); 1199 $method->setAccessible( true ); 1199 if ( PHP_VERSION_ID < 80100 ) { 1200 $method->setAccessible( true ); 1201 } 1200 1202 return $method; 1201 1203 } -
trunk/tests/phpunit/tests/script-modules/wpScriptModules.php
r60704 r60729 876 876 public function test_get_src() { 877 877 $get_src = new ReflectionMethod( $this->script_modules, 'get_src' ); 878 $get_src->setAccessible( true ); 878 if ( PHP_VERSION_ID < 80100 ) { 879 $get_src->setAccessible( true ); 880 } 879 881 880 882 $this->script_modules->register( … … 1351 1353 $reflection_class = new ReflectionClass( $script_modules ); 1352 1354 $registered_property = $reflection_class->getProperty( 'registered' ); 1353 $registered_property->setAccessible( true ); 1355 if ( PHP_VERSION_ID < 80100 ) { 1356 $registered_property->setAccessible( true ); 1357 } 1354 1358 return $registered_property->getValue( $script_modules ); 1355 1359 } -
trunk/tests/phpunit/tests/term/query.php
r60661 r60729 1069 1069 1070 1070 $reflection = new ReflectionMethod( $query1, 'generate_cache_key' ); 1071 $reflection->setAccessible( true ); 1071 if ( PHP_VERSION_ID < 80100 ) { 1072 $reflection->setAccessible( true ); 1073 } 1072 1074 1073 1075 $cache_key_1 = $reflection->invoke( $query1, $query_vars, $request ); -
trunk/tests/phpunit/tests/theme.php
r60251 r60729 233 233 $reflection = new ReflectionClass( 'WP_Theme' ); 234 234 $property = $reflection->getProperty( 'default_themes' ); 235 $property->setAccessible( true ); 235 if ( PHP_VERSION_ID < 80100 ) { 236 $property->setAccessible( true ); 237 } 236 238 237 239 /* -
trunk/tests/phpunit/tests/theme/customHeader.php
r56559 r60729 505 505 $class = new ReflectionClass( 'WP_Customize_Manager' ); 506 506 $property = $class->getProperty( 'previewing' ); 507 $property->setAccessible( true ); 507 if ( PHP_VERSION_ID < 80100 ) { 508 $property->setAccessible( true ); 509 } 508 510 $property->setValue( $this->customize_manager, $value ); 509 511 } -
trunk/tests/phpunit/tests/theme/wpTheme.php
r60500 r60729 302 302 $reflection = new ReflectionClass( $theme ); 303 303 $reflection_property = $reflection->getProperty( 'block_theme' ); 304 $reflection_property->setAccessible( true ); 304 if ( PHP_VERSION_ID < 80100 ) { 305 $reflection_property->setAccessible( true ); 306 } 305 307 306 308 $this->assertSame( $expected, $reflection_property->getValue( $theme ) ); … … 612 614 $theme = new WP_Theme( 'twentytwentytwo', $this->theme_root ); 613 615 $sanitize_header = new ReflectionMethod( $theme, 'sanitize_header' ); 614 $sanitize_header->setAccessible( true ); 616 if ( PHP_VERSION_ID < 80100 ) { 617 $sanitize_header->setAccessible( true ); 618 } 615 619 616 620 $actual = $sanitize_header->invoke( $theme, 'UpdateURI', '<?php?><a href="http://example.org">http://example.org</a>' ); -
trunk/tests/phpunit/tests/theme/wpThemeGetBlockPatterns.php
r58025 r60729 49 49 private function get_pattern_cache( $wp_theme ) { 50 50 $reflection = new ReflectionMethod( $wp_theme, 'get_pattern_cache' ); 51 $reflection->setAccessible( true ); 51 if ( PHP_VERSION_ID < 80100 ) { 52 $reflection->setAccessible( true ); 53 } 52 54 53 55 $pattern_cache = $reflection->invoke( $wp_theme, 'get_pattern_cache' ); 54 $reflection->setAccessible( false ); 56 if ( PHP_VERSION_ID < 80100 ) { 57 $reflection->setAccessible( false ); 58 } 55 59 56 60 return $pattern_cache; … … 65 69 private function get_cache_hash( $wp_theme ) { 66 70 $reflection = new ReflectionProperty( get_class( $wp_theme ), 'cache_hash' ); 67 $reflection->setAccessible( true ); 71 if ( PHP_VERSION_ID < 80100 ) { 72 $reflection->setAccessible( true ); 73 } 68 74 $cache_hash = $reflection->getValue( $wp_theme ); 69 $reflection->setAccessible( false ); 75 if ( PHP_VERSION_ID < 80100 ) { 76 $reflection->setAccessible( false ); 77 } 70 78 return $cache_hash; 71 79 } -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r59814 r60729 2459 2459 2460 2460 $func = $theme_json->getMethod( 'get_block_nodes' ); 2461 $func->setAccessible( true ); 2461 if ( PHP_VERSION_ID < 81000 ) { 2462 $func->setAccessible( true ); 2463 } 2462 2464 2463 2465 $theme_json = array( … … 2513 2515 2514 2516 $func = $theme_json->getMethod( 'get_block_nodes' ); 2515 $func->setAccessible( true ); 2517 if ( PHP_VERSION_ID < 81000 ) { 2518 $func->setAccessible( true ); 2519 } 2516 2520 2517 2521 $theme_json = array( … … 3852 3856 3853 3857 $get_property_value_method = $reflection_class->getMethod( 'get_property_value' ); 3854 $get_property_value_method->setAccessible( true ); 3858 if ( PHP_VERSION_ID < 80100 ) { 3859 $get_property_value_method->setAccessible( true ); 3860 } 3855 3861 $result = $get_property_value_method->invoke( null, $styles, $path ); 3856 3862 … … 5843 5849 ); 5844 5850 $reflection = new ReflectionMethod( $theme_json, 'process_blocks_custom_css' ); 5845 $reflection->setAccessible( true ); 5851 if ( PHP_VERSION_ID < 80100 ) { 5852 $reflection->setAccessible( true ); 5853 } 5846 5854 5847 5855 $this->assertSame( $expected, $reflection->invoke( $theme_json, $input['css'], $input['selector'] ) ); … … 6178 6186 6179 6187 $func = $theme_json->getMethod( 'get_block_style_variation_selector' ); 6180 $func->setAccessible( true ); 6188 if ( PHP_VERSION_ID < 80100 ) { 6189 $func->setAccessible( true ); 6190 } 6181 6191 6182 6192 $actual = $func->invoke( null, 'custom', $selector ); … … 6260 6270 6261 6271 $func = $theme_json->getMethod( 'scope_style_node_selectors' ); 6262 $func->setAccessible( true ); 6272 if ( PHP_VERSION_ID < 80100 ) { 6273 $func->setAccessible( true ); 6274 } 6263 6275 6264 6276 $node = array( … … 6309 6321 6310 6322 $func = $theme_json->getMethod( 'get_block_nodes' ); 6311 $func->setAccessible( true ); 6323 if ( PHP_VERSION_ID < 80100 ) { 6324 $func->setAccessible( true ); 6325 } 6312 6326 6313 6327 $theme_json = array( … … 6345 6359 6346 6360 $func = $theme_json->getMethod( 'get_block_nodes' ); 6347 $func->setAccessible( true ); 6361 if ( PHP_VERSION_ID < 80100 ) { 6362 $func->setAccessible( true ); 6363 } 6348 6364 6349 6365 $theme_json = array( -
trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php
r60234 r60729 78 78 79 79 static::$property_blocks_cache = new ReflectionProperty( WP_Theme_JSON_Resolver::class, 'blocks_cache' ); 80 static::$property_blocks_cache->setAccessible( true ); 80 if ( PHP_VERSION_ID < 80100 ) { 81 static::$property_blocks_cache->setAccessible( true ); 82 } 81 83 static::$property_blocks_cache_orig_value = static::$property_blocks_cache->getValue(); 82 84 83 85 static::$property_core = new ReflectionProperty( WP_Theme_JSON_Resolver::class, 'core' ); 84 static::$property_core->setAccessible( true ); 86 if ( PHP_VERSION_ID < 80100 ) { 87 static::$property_core->setAccessible( true ); 88 } 85 89 static::$property_core_orig_value = static::$property_core->getValue(); 86 90 } … … 307 311 public function test_has_same_registered_blocks_when_all_blocks_not_cached( $origin, array $cache = array() ) { 308 312 $has_same_registered_blocks = new ReflectionMethod( WP_Theme_JSON_Resolver::class, 'has_same_registered_blocks' ); 309 $has_same_registered_blocks->setAccessible( true ); 313 if ( PHP_VERSION_ID < 80100 ) { 314 $has_same_registered_blocks->setAccessible( true ); 315 } 310 316 $expected_cache = $this->get_registered_block_names(); 311 317 … … 381 387 public function test_has_same_registered_blocks_when_all_blocks_are_cached( $origin ) { 382 388 $has_same_registered_blocks = new ReflectionMethod( WP_Theme_JSON_Resolver::class, 'has_same_registered_blocks' ); 383 $has_same_registered_blocks->setAccessible( true ); 389 if ( PHP_VERSION_ID < 80100 ) { 390 $has_same_registered_blocks->setAccessible( true ); 391 } 384 392 $expected_cache = $this->get_registered_block_names(); 385 393 … … 837 845 // Force-unset $i18n_schema property to "unload" translation schema. 838 846 $property = new ReflectionProperty( $theme_json_resolver, 'i18n_schema' ); 839 $property->setAccessible( true ); 847 if ( PHP_VERSION_ID < 80100 ) { 848 $property->setAccessible( true ); 849 } 840 850 $property->setValue( null, null ); 841 851 -
trunk/tests/phpunit/tests/user/queryCache.php
r58876 r60729 772 772 773 773 $reflection = new ReflectionMethod( $query1, 'generate_cache_key' ); 774 $reflection->setAccessible( true ); 774 if ( PHP_VERSION_ID < 80100 ) { 775 $reflection->setAccessible( true ); 776 } 775 777 776 778 $cache_key_1 = $reflection->invoke( $query1, $query_vars, $request_with_placeholder ); -
trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php
r56746 r60729 495 495 $wp_widget_media = new ReflectionClass( 'WP_Widget_Media' ); 496 496 $has_content = $wp_widget_media->getMethod( 'has_content' ); 497 $has_content->setAccessible( true ); 497 if ( PHP_VERSION_ID < 80100 ) { 498 $has_content->setAccessible( true ); 499 } 498 500 499 501 $result = $has_content->invokeArgs(
Note: See TracChangeset for help on using the changeset viewer.