Changeset 61424
- Timestamp:
- 01/03/2026 06:15:57 AM (2 months ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 23 edited
-
data/WPHTTP-testcase-redirection-script.php (modified) (2 diffs)
-
includes/abstract-testcase.php (modified) (1 diff)
-
includes/factory/class-wp-unittest-factory-for-term.php (modified) (1 diff)
-
includes/mock-fs.php (modified) (2 diffs)
-
tests/abilities-api/wpRegisterAbility.php (modified) (5 diffs)
-
tests/abilities-api/wpRegisterAbilityCategory.php (modified) (5 diffs)
-
tests/admin/wpPluginsListTable.php (modified) (1 diff)
-
tests/block-bindings/postMetaSource.php (modified) (1 diff)
-
tests/cron.php (modified) (1 diff)
-
tests/dependencies/scripts.php (modified) (1 diff)
-
tests/filesystem/wpFilesystemDirect/base.php (modified) (1 diff)
-
tests/fonts/font-library/wpRestFontFamiliesController.php (modified) (1 diff)
-
tests/general/wpResourceHints.php (modified) (1 diff)
-
tests/interactivity-api/wpInteractivityAPI-wp-router-region.php (modified) (1 diff)
-
tests/l10n/loadScriptTextdomain.php (modified) (1 diff)
-
tests/link/getAdjacentPost.php (modified) (2 diffs)
-
tests/oembed/controller.php (modified) (1 diff)
-
tests/post/thumbnails.php (modified) (2 diffs)
-
tests/rest-api/application-passwords.php (modified) (1 diff)
-
tests/rest-api/rest-pattern-directory-controller.php (modified) (1 diff)
-
tests/rest-api/rest-post-meta-fields.php (modified) (1 diff)
-
tests/rest-api/rest-term-meta-fields.php (modified) (1 diff)
-
tests/shortcode.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/data/WPHTTP-testcase-redirection-script.php
r55210 r61424 55 55 if ( isset( $_GET['post-redirect-to-method'] ) ) { 56 56 $method = $_SERVER['REQUEST_METHOD']; 57 $response_code = isset( $_GET['response_code'] ) ? $_GET['response_code'] :301;57 $response_code = $_GET['response_code'] ?? 301; 58 58 59 59 if ( 'POST' == $method && ! isset( $_GET['redirection-performed'] ) ) { … … 124 124 125 125 126 $rt = isset($_GET['rt']) ? $_GET['rt'] :5;127 $r = isset($_GET['r']) ? $_GET['r'] :0;126 $rt = $_GET['rt'] ?? 5; 127 $r = $_GET['r'] ?? 0; 128 128 129 129 if ( $r < $rt ) { -
trunk/tests/phpunit/includes/abstract-testcase.php
r61038 r61424 1314 1314 $parts = parse_url( $url ); 1315 1315 if ( isset( $parts['scheme'] ) ) { 1316 $req = isset( $parts['path'] ) ? $parts['path'] :'';1316 $req = $parts['path'] ?? ''; 1317 1317 if ( isset( $parts['query'] ) ) { 1318 1318 $req .= '?' . $parts['query']; -
trunk/tests/phpunit/includes/factory/class-wp-unittest-factory-for-term.php
r55019 r61424 110 110 } 111 111 112 $taxonomy = isset( $args['taxonomy'] ) ? $args['taxonomy'] :$this->taxonomy;112 $taxonomy = $args['taxonomy'] ?? $this->taxonomy; 113 113 114 114 return get_term( $term_id, $taxonomy ); -
trunk/tests/phpunit/includes/mock-fs.php
r56548 r61424 47 47 ); 48 48 $this->cache = array(); // Used by find_folder() and friends. 49 $this->cwd = isset( $this->fs_map[ $home_dir ] ) ? $this->fs_map[ $home_dir ] :'/';49 $this->cwd = $this->fs_map[ $home_dir ] ?? '/'; 50 50 $this->setfs( $paths ); 51 51 } … … 80 80 */ 81 81 private function locate_node( $path ) { 82 return isset( $this->fs_map[ $path ] ) ? $this->fs_map[ $path ] :false;82 return $this->fs_map[ $path ] ?? false; 83 83 } 84 84 -
trunk/tests/phpunit/tests/abilities-api/wpRegisterAbility.php
r61364 r61424 155 155 156 156 // Store the original action count. 157 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;157 $original_count = $wp_actions['init'] ?? 0; 158 158 159 159 // Reset the action count to simulate it not being fired. … … 451 451 452 452 // Store the original action count. 453 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;453 $original_count = $wp_actions['init'] ?? 0; 454 454 455 455 // Reset the action count to simulate it not being fired. … … 497 497 498 498 // Store the original action count. 499 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;499 $original_count = $wp_actions['init'] ?? 0; 500 500 501 501 // Reset the action count to simulate it not being fired. … … 560 560 561 561 // Store the original action count. 562 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;562 $original_count = $wp_actions['init'] ?? 0; 563 563 564 564 // Reset the action count to simulate it not being fired. … … 616 616 617 617 // Store the original action count. 618 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;618 $original_count = $wp_actions['init'] ?? 0; 619 619 620 620 // Reset the action count to simulate it not being fired. -
trunk/tests/phpunit/tests/abilities-api/wpRegisterAbilityCategory.php
r61130 r61424 83 83 84 84 // Store the original action count. 85 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;85 $original_count = $wp_actions['init'] ?? 0; 86 86 87 87 // Reset the action count to simulate it not being fired. … … 133 133 134 134 // Store the original action count. 135 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;135 $original_count = $wp_actions['init'] ?? 0; 136 136 137 137 // Reset the action count to simulate it not being fired. … … 195 195 196 196 // Store the original action count. 197 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;197 $original_count = $wp_actions['init'] ?? 0; 198 198 199 199 // Reset the action count to simulate it not being fired. … … 256 256 257 257 // Store the original action count. 258 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;258 $original_count = $wp_actions['init'] ?? 0; 259 259 260 260 // Reset the action count to simulate it not being fired. … … 329 329 330 330 // Store the original action count. 331 $original_count = isset( $wp_actions['init'] ) ? $wp_actions['init'] :0;331 $original_count = $wp_actions['init'] ?? 0; 332 332 333 333 // Reset the action count to simulate it not being fired. -
trunk/tests/phpunit/tests/admin/wpPluginsListTable.php
r60729 r61424 138 138 */ 139 139 public function test_construct_should_not_set_show_autoupdates_to_false_for_mustuse_and_dropins( $status ) { 140 $original_status = isset( $_REQUEST['plugin_status'] ) ? $_REQUEST['plugin_status'] :null;140 $original_status = $_REQUEST['plugin_status'] ?? null; 141 141 $_REQUEST['plugin_status'] = $status; 142 142 -
trunk/tests/phpunit/tests/block-bindings/postMetaSource.php
r58972 r61424 29 29 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 30 30 self::$post = $factory->post->create_and_get(); 31 self::$wp_meta_keys_saved = isset( $GLOBALS['wp_meta_keys'] ) ? $GLOBALS['wp_meta_keys'] :array();31 self::$wp_meta_keys_saved = $GLOBALS['wp_meta_keys'] ?? array(); 32 32 } 33 33 -
trunk/tests/phpunit/tests/cron.php
r60925 r61424 461 461 $this->preflight_cron_array[ $event->timestamp ][ $event->hook ][ $key ] = array( 462 462 'schedule' => $event->schedule, 463 'interval' => isset( $event->interval ) ? $event->interval :0,463 'interval' => $event->interval ?? 0, 464 464 'args' => $event->args, 465 465 ); -
trunk/tests/phpunit/tests/dependencies/scripts.php
r61415 r61424 38 38 public function set_up() { 39 39 parent::set_up(); 40 $this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] :null;41 $this->old_wp_styles = isset( $GLOBALS['wp_styles'] ) ? $GLOBALS['wp_styles'] :null;42 $this->old_concatenate_scripts = isset( $GLOBALS['concatenate_scripts'] ) ? $GLOBALS['concatenate_scripts'] :null;40 $this->old_wp_scripts = $GLOBALS['wp_scripts'] ?? null; 41 $this->old_wp_styles = $GLOBALS['wp_styles'] ?? null; 42 $this->old_concatenate_scripts = $GLOBALS['concatenate_scripts'] ?? null; 43 43 remove_action( 'wp_default_scripts', 'wp_default_scripts' ); 44 44 remove_action( 'wp_default_scripts', 'wp_default_packages' ); -
trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/base.php
r58684 r61424 91 91 $this->create_file_if_needed( 92 92 $entry['path'], 93 isset( $entry['contents'] ) ? $entry['contents'] :''93 $entry['contents'] ?? '' 94 94 ); 95 95 } -
trunk/tests/phpunit/tests/fonts/font-library/wpRestFontFamiliesController.php
r60918 r61424 1049 1049 $this->assertSame( $expected, $link['href'], 'The links for a font faces URL from the response data should match the REST endpoint.' ); 1050 1050 1051 $embeddable = isset( $link['attributes']['embeddable'] ) 1052 ? $link['attributes']['embeddable'] 1053 : $link['embeddable']; 1051 $embeddable = $link['attributes']['embeddable'] ?? $link['embeddable']; 1054 1052 $this->assertTrue( $embeddable, 'The embeddable should be true.' ); 1055 1053 } -
trunk/tests/phpunit/tests/general/wpResourceHints.php
r56548 r61424 13 13 public function set_up() { 14 14 parent::set_up(); 15 $this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] :null;16 $this->old_wp_styles = isset( $GLOBALS['wp_styles'] ) ? $GLOBALS['wp_styles'] :null;15 $this->old_wp_scripts = $GLOBALS['wp_scripts'] ?? null; 16 $this->old_wp_styles = $GLOBALS['wp_styles'] ?? null; 17 17 18 18 remove_action( 'wp_default_scripts', 'wp_default_scripts' ); -
trunk/tests/phpunit/tests/interactivity-api/wpInteractivityAPI-wp-router-region.php
r59130 r61424 46 46 47 47 // Removes all registered styles. 48 $this->original_wp_styles = isset( $GLOBALS['wp_styles'] ) ? $GLOBALS['wp_styles'] :null;48 $this->original_wp_styles = $GLOBALS['wp_styles'] ?? null; 49 49 $GLOBALS['wp_styles'] = new WP_Styles(); 50 50 remove_action( 'wp_default_styles', 'wp_default_styles' ); -
trunk/tests/phpunit/tests/l10n/loadScriptTextdomain.php
r59264 r61424 21 21 public function test_resolve_relative_path( $translation_path, $handle, $src, $textdomain, $filter = array() ) { 22 22 if ( ! empty( $filter ) ) { 23 add_filter( $filter[0], $filter[1], 10, isset( $filter[2] ) ? $filter[2] :1 );23 add_filter( $filter[0], $filter[1], 10, $filter[2] ?? 1 ); 24 24 } 25 25 wp_enqueue_script( $handle, $src, array(), null ); -
trunk/tests/phpunit/tests/link/getAdjacentPost.php
r61066 r61424 193 193 194 194 // Fake current page. 195 $_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] :null;195 $_post = $GLOBALS['post'] ?? null; 196 196 $GLOBALS['post'] = get_post( $p1 ); 197 197 … … 230 230 231 231 // Fake current page. 232 $_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] :null;232 $_post = $GLOBALS['post'] ?? null; 233 233 $GLOBALS['post'] = get_post( $p1 ); 234 234 -
trunk/tests/phpunit/tests/oembed/controller.php
r60253 r61424 94 94 95 95 $parsed_url = wp_parse_url( $url ); 96 $query = isset( $parsed_url['query'] ) ? $parsed_url['query'] :'';96 $query = $parsed_url['query'] ?? ''; 97 97 parse_str( $query, $query_params ); 98 98 $this->request_count += 1; -
trunk/tests/phpunit/tests/post/thumbnails.php
r59235 r61424 288 288 */ 289 289 public function test__wp_preview_post_thumbnail_filter() { 290 $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] :null;290 $old_post = $GLOBALS['post'] ?? null; 291 291 292 292 $GLOBALS['post'] = self::$post; … … 308 308 */ 309 309 public function test__wp_preview_post_thumbnail_filter_secondary_post() { 310 $old_post = isset( $GLOBALS['post'] ) ? $GLOBALS['post'] :null;310 $old_post = $GLOBALS['post'] ?? null; 311 311 312 312 $secondary_post = self::factory()->post->create( -
trunk/tests/phpunit/tests/rest-api/application-passwords.php
r59084 r61424 155 155 $updated_item = WP_Application_Passwords::get_user_application_password( self::$user_id, $uuid ); 156 156 foreach ( $updated_item as $key => $update_value ) { 157 $expected_value = isset( $update[ $key ] ) ? $update[ $key ] :$original_item[ $key ];157 $expected_value = $update[ $key ] ?? $original_item[ $key ]; 158 158 $this->assertSame( $expected_value, $update_value ); 159 159 } -
trunk/tests/phpunit/tests/rest-api/rest-pattern-directory-controller.php
r60729 r61424 83 83 public function assertPatternMatchesSchema( $pattern ) { 84 84 $schema = static::$controller->get_item_schema(); 85 $pattern_id = isset( $pattern->id ) ? $pattern->id :'{pattern ID is missing}';85 $pattern_id = $pattern->id ?? '{pattern ID is missing}'; 86 86 87 87 $this->assertTrue( -
trunk/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
r59023 r61424 22 22 ); 23 23 24 self::$wp_meta_keys_saved = isset( $GLOBALS['wp_meta_keys'] ) ? $GLOBALS['wp_meta_keys'] :array();24 self::$wp_meta_keys_saved = $GLOBALS['wp_meta_keys'] ?? array(); 25 25 self::$post_id = $factory->post->create(); 26 26 self::$cpt_post_id = $factory->post->create( array( 'post_type' => 'cpt' ) ); -
trunk/tests/phpunit/tests/rest-api/rest-term-meta-fields.php
r55457 r61424 22 22 ); 23 23 24 self::$wp_meta_keys_saved = isset( $GLOBALS['wp_meta_keys'] ) ? $GLOBALS['wp_meta_keys'] :array();24 self::$wp_meta_keys_saved = $GLOBALS['wp_meta_keys'] ?? array(); 25 25 self::$category_id = $factory->category->create(); 26 26 self::$customtax_term_id = $factory->term->create( array( 'taxonomy' => 'customtax' ) ); -
trunk/tests/phpunit/tests/shortcode.php
r60251 r61424 49 49 // [footag foo="bar"] 50 50 public function shortcode_footag( $atts ) { 51 $foo = isset( $atts['foo'] ) ? $atts['foo'] :'';51 $foo = $atts['foo'] ?? ''; 52 52 return "foo = $foo"; 53 53 }
Note: See TracChangeset
for help on using the changeset viewer.