Changeset 56421
- Timestamp:
- 08/21/2023 03:53:04 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/composer.json
r56141 r56421 18 18 "wp-coding-standards/wpcs": "~2.3.0", 19 19 "phpcompatibility/phpcompatibility-wp": "~2.1.3", 20 "yoast/phpunit-polyfills": "^1. 0.1"20 "yoast/phpunit-polyfills": "^1.1.0" 21 21 }, 22 22 "config": { -
trunk/tests/phpunit/includes/abstract-testcase.php
r56212 r56421 870 870 871 871 foreach ( $fields as $field_name => $field_value ) { 872 $this->assertObjectHas Attribute( $field_name, $actual, $message . " Property $field_name does not exist on the object." );872 $this->assertObjectHasProperty( $field_name, $actual, $message . " Property $field_name does not exist on the object." ); 873 873 $this->assertSame( $field_value, $actual->$field_name, $message . " Value of property $field_name is not $field_value." ); 874 874 } -
trunk/tests/phpunit/includes/bootstrap.php
r55891 r56421 140 140 * Only needs updating when new polyfill features start being used in the test suite. 141 141 */ 142 $phpunit_polyfills_minimum_version = '1. 0.1';142 $phpunit_polyfills_minimum_version = '1.1.0'; 143 143 if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' ) 144 144 && ( defined( '\Yoast\PHPUnitPolyfills\Autoload::VERSION' ) === false -
trunk/tests/phpunit/includes/phpunit-adapter-testcase.php
r51567 r56421 7 7 * 8 8 * This class enhances the PHPUnit native `TestCase` with polyfills 9 * for assertions and expectation methods added between PHPUnit 4.8 - 9. 5.9 * for assertions and expectation methods added between PHPUnit 4.8 - 9.6. 10 10 * 11 11 * Additionally, the Polyfill TestCase offers a workaround for the addition -
trunk/tests/phpunit/tests/ajax/wpAjaxImageEditor.php
r55935 r56421 52 52 $ret = wp_save_image( $id ); 53 53 54 $this->assertObjectHas Attribute( 'error', $ret );54 $this->assertObjectHasProperty( 'error', $ret ); 55 55 $this->assertEquals( 'Images cannot be scaled to a size larger than the original.', $ret->error ); 56 56 } -
trunk/tests/phpunit/tests/blocks/register.php
r56044 r56421 721 721 $registry = WP_Block_Type_Registry::get_instance(); 722 722 $block_type = $registry->get_registered( 'core/test-static' ); 723 $this->assertObjectHas Attribute( 'editor_script_handles', $block_type );723 $this->assertObjectHasProperty( 'editor_script_handles', $block_type ); 724 724 $actual_script = $block_type->editor_script; 725 725 $actual_script_handles = $block_type->editor_script_handles; … … 787 787 $registry = WP_Block_Type_Registry::get_instance(); 788 788 $block_type = $registry->get_registered( 'core/test-static' ); 789 $this->assertObjectHas Attribute( 'editor_script_handles', $block_type );789 $this->assertObjectHasProperty( 'editor_script_handles', $block_type ); 790 790 $actual_script = $block_type->editor_script; 791 791 $actual_script_handles = $block_type->editor_script_handles; -
trunk/tests/phpunit/tests/comment.php
r56222 r56421 482 482 ); 483 483 484 $this->assertObjectHas Attribute(484 $this->assertObjectHasProperty( 485 485 'comment_author', 486 486 $comment, -
trunk/tests/phpunit/tests/customize/manager.php
r55942 r56421 3340 3340 $setting = $manager->add_setting( $setting_id ); 3341 3341 $this->assertSame( 'WP_Customize_Setting', get_class( $setting ) ); 3342 $this->assertObjectNotHas Attribute( 'custom', $setting );3342 $this->assertObjectNotHasProperty( 'custom', $setting ); 3343 3343 $manager->remove_setting( $setting_id ); 3344 3344 … … 3347 3347 $setting = $manager->add_setting( $setting_id ); 3348 3348 $this->assertSame( 'Test_Dynamic_Customize_Setting', get_class( $setting ) ); 3349 $this->assertObjectHas Attribute( 'custom', $setting );3349 $this->assertObjectHasProperty( 'custom', $setting ); 3350 3350 $this->assertSame( 'foo', $setting->custom ); 3351 3351 } -
trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php
r54865 r56421 927 927 $this->assertSame( 'Custom Label', $nav_menu_item->type_label ); 928 928 929 $this->assertObjectNotHas Attribute( 'nav_menu_term_id', $nav_menu_item );930 $this->assertObjectNotHas Attribute( 'status', $nav_menu_item );929 $this->assertObjectNotHasProperty( 'nav_menu_term_id', $nav_menu_item ); 930 $this->assertObjectNotHasProperty( 'status', $nav_menu_item ); 931 931 $this->assertSame( 'publish', $nav_menu_item->post_status ); 932 932 $this->assertSame( 'nav_menu_item', $nav_menu_item->post_type ); 933 $this->assertObjectNotHas Attribute( 'position', $nav_menu_item );933 $this->assertObjectNotHasProperty( 'position', $nav_menu_item ); 934 934 $this->assertSame( $post_value['position'], $nav_menu_item->menu_order ); 935 935 $this->assertSame( $post_value['title'], $nav_menu_item->post_title ); … … 937 937 $this->assertSame( 123, $nav_menu_item->db_id ); 938 938 $this->assertSame( wp_get_current_user()->ID, $nav_menu_item->post_author ); 939 $this->assertObjectHas Attribute( 'type_label', $nav_menu_item );939 $this->assertObjectHasProperty( 'type_label', $nav_menu_item ); 940 940 $expected = apply_filters( 'nav_menu_attr_title', wp_unslash( apply_filters( 'excerpt_save_pre', wp_slash( $post_value['attr_title'] ) ) ) ); 941 941 $this->assertSame( $expected, $nav_menu_item->attr_title ); … … 1071 1071 $this->assertSame( '', $item_value['title'] ); 1072 1072 $item = $setting->value_as_wp_post_nav_menu_item(); 1073 $this->assertObjectHas Attribute( 'type_label', $item );1073 $this->assertObjectHasProperty( 'type_label', $item ); 1074 1074 $this->assertSame( $original_post_title, $item->original_title ); 1075 1075 $this->assertSame( $original_post_title, $item->title ); … … 1098 1098 $this->assertSame( '', $item_value['title'] ); 1099 1099 $item = $setting->value_as_wp_post_nav_menu_item(); 1100 $this->assertObjectHas Attribute( 'type_label', $item );1100 $this->assertObjectHasProperty( 'type_label', $item ); 1101 1101 $this->assertSame( $original_post_title, $item->original_title ); 1102 1102 $this->assertSame( $original_post_title, $item->title ); … … 1125 1125 $this->assertSame( '', $item_value['title'] ); 1126 1126 $item = $setting->value_as_wp_post_nav_menu_item(); 1127 $this->assertObjectHas Attribute( 'type_label', $item );1127 $this->assertObjectHasProperty( 'type_label', $item ); 1128 1128 $this->assertSame( $original_term_title, $item->original_title ); 1129 1129 $this->assertSame( $original_term_title, $item->title ); … … 1152 1152 $this->assertSame( '', $item_value['title'] ); 1153 1153 $item = $setting->value_as_wp_post_nav_menu_item(); 1154 $this->assertObjectHas Attribute( 'type_label', $item );1154 $this->assertObjectHasProperty( 'type_label', $item ); 1155 1155 $this->assertSame( $original_term_title, $item->original_title ); 1156 1156 $this->assertSame( $original_term_title, $item->title ); … … 1178 1178 $this->assertSame( '', $item_value['title'] ); 1179 1179 $item = $setting->value_as_wp_post_nav_menu_item(); 1180 $this->assertObjectHas Attribute( 'type_label', $item );1180 $this->assertObjectHasProperty( 'type_label', $item ); 1181 1181 $this->assertSame( get_post_type_object( 'press_release' )->labels->archives, $item->original_title ); 1182 1182 $this->assertSame( get_post_type_object( 'press_release' )->labels->archives, $item->title ); … … 1204 1204 $this->assertSame( '', $item_value['title'] ); 1205 1205 $item = $setting->value_as_wp_post_nav_menu_item(); 1206 $this->assertObjectHas Attribute( 'type_label', $item );1206 $this->assertObjectHasProperty( 'type_label', $item ); 1207 1207 $this->assertSame( get_post_type_object( 'press_release' )->labels->archives, $item->original_title ); 1208 1208 $this->assertSame( get_post_type_object( 'press_release' )->labels->archives, $item->title ); -
trunk/tests/phpunit/tests/post.php
r55365 r56421 237 237 238 238 $counts = wp_count_posts(); 239 $this->assertObjectHas Attribute( 'test', $counts );239 $this->assertObjectHasProperty( 'test', $counts ); 240 240 $this->assertSame( 0, $counts->test ); 241 241 } -
trunk/tests/phpunit/tests/post/getPostTypeLabels.php
r51331 r56421 96 96 unregister_post_type( 'foo' ); 97 97 98 $this->assertObjectHas Attribute( 'labels', $post_type_object );99 $this->assertObjectHas Attribute( 'label', $post_type_object );100 $this->assertObjectHas Attribute( 'not_found_in_trash', $post_type_object->labels );98 $this->assertObjectHasProperty( 'labels', $post_type_object ); 99 $this->assertObjectHasProperty( 'label', $post_type_object ); 100 $this->assertObjectHasProperty( 'not_found_in_trash', $post_type_object->labels ); 101 101 } 102 102 … … 123 123 register_post_type( 'foo' ); 124 124 125 $this->assertObjectHas Attribute( 'featured_image', get_post_type_object( 'foo' )->labels );126 $this->assertObjectHas Attribute( 'set_featured_image', get_post_type_object( 'foo' )->labels );125 $this->assertObjectHasProperty( 'featured_image', get_post_type_object( 'foo' )->labels ); 126 $this->assertObjectHasProperty( 'set_featured_image', get_post_type_object( 'foo' )->labels ); 127 127 128 128 unregister_post_type( 'foo' ); -
trunk/tests/phpunit/tests/post/updatePostCache.php
r53483 r56421 58 58 ); 59 59 60 $this->assertObjectHas Attribute(60 $this->assertObjectHasProperty( 61 61 'filter', 62 62 $cached_post, … … 99 99 ); 100 100 101 $this->assertObjectHas Attribute(101 $this->assertObjectHasProperty( 102 102 'filter', 103 103 $cached_post, … … 127 127 ); 128 128 129 $this->assertObjectHas Attribute(129 $this->assertObjectHasProperty( 130 130 'filter', 131 131 $cached_post, -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r56096 r56421 1262 1262 $result = json_decode( rest_get_server()->sent_body ); 1263 1263 1264 $this->assertObjectNotHas Attribute( 'code', $result );1264 $this->assertObjectNotHasProperty( 'code', $result ); 1265 1265 } 1266 1266 -
trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php
r56248 r56421 871 871 $this->assertInstanceOf( 'stdClass', $prepared, 'The item could not be prepared for the database.' ); 872 872 873 $this->assertObjectHas Attribute( 'post_type', $prepared, 'The "post_type" was not included in the prepared template part.' );874 $this->assertObjectHas Attribute( 'post_status', $prepared, 'The "post_status" was not included in the prepared template part.' );875 $this->assertObjectHas Attribute( 'tax_input', $prepared, 'The "tax_input" was not included in the prepared template part.' );873 $this->assertObjectHasProperty( 'post_type', $prepared, 'The "post_type" was not included in the prepared template part.' ); 874 $this->assertObjectHasProperty( 'post_status', $prepared, 'The "post_status" was not included in the prepared template part.' ); 875 $this->assertObjectHasProperty( 'tax_input', $prepared, 'The "tax_input" was not included in the prepared template part.' ); 876 876 $this->assertArrayHasKey( 'wp_theme', $prepared->tax_input, 'The "wp_theme" tax was not included in the prepared template part.' ); 877 877 $this->assertArrayHasKey( 'wp_template_part_area', $prepared->tax_input, 'The "wp_template_part_area" tax was not included in the prepared template part.' ); 878 $this->assertObjectHas Attribute( 'post_content', $prepared, 'The "post_content" was not included in the prepared template part.' );879 $this->assertObjectHas Attribute( 'post_title', $prepared, 'The "post_title" was not included in the prepared template part.' );878 $this->assertObjectHasProperty( 'post_content', $prepared, 'The "post_content" was not included in the prepared template part.' ); 879 $this->assertObjectHasProperty( 'post_title', $prepared, 'The "post_title" was not included in the prepared template part.' ); 880 880 881 881 $this->assertSame( 'wp_template_part', $prepared->post_type, 'The "post_type" in the prepared template part should be "wp_template_part".' ); -
trunk/tests/phpunit/tests/taxonomy.php
r54090 r56421 285 285 $post_type = 'test_cpt'; 286 286 $this->assertFalse( get_post_type( $post_type ) ); 287 $this->assertObjectHas Attribute( 'name', register_post_type( $post_type ) );287 $this->assertObjectHasProperty( 'name', register_post_type( $post_type ) ); 288 288 289 289 // Core taxonomy, core post type. -
trunk/tests/phpunit/tests/term/query.php
r55745 r56421 403 403 foreach ( $terms as $term ) { 404 404 $this->assertInstanceOf( 'WP_Term', $term ); 405 $this->assertObjectHas Attribute( 'object_id', $term );405 $this->assertObjectHasProperty( 'object_id', $term ); 406 406 } 407 407 … … 411 411 foreach ( $terms as $term ) { 412 412 $this->assertInstanceOf( 'WP_Term', $term ); 413 $this->assertObjectHas Attribute( 'object_id', $term );413 $this->assertObjectHasProperty( 'object_id', $term ); 414 414 } 415 415 } -
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r55759 r56421 851 851 852 852 $term = get_term( $t ); 853 $this->assertObjectNotHas Attribute( 'object_id', $term );853 $this->assertObjectNotHasProperty( 'object_id', $term ); 854 854 } 855 855 -
trunk/tests/phpunit/tests/user/multisite.php
r53489 r56421 60 60 foreach ( $blogs_of_user as $blog_id => $blog ) { 61 61 $this->assertSame( $blog_id, $blog->userblog_id ); 62 $this->assertObjectHas Attribute( 'userblog_id', $blog );63 $this->assertObjectHas Attribute( 'blogname', $blog );64 $this->assertObjectHas Attribute( 'domain', $blog );65 $this->assertObjectHas Attribute( 'path', $blog );66 $this->assertObjectHas Attribute( 'site_id', $blog );67 $this->assertObjectHas Attribute( 'siteurl', $blog );68 $this->assertObjectHas Attribute( 'archived', $blog );69 $this->assertObjectHas Attribute( 'spam', $blog );70 $this->assertObjectHas Attribute( 'deleted', $blog );62 $this->assertObjectHasProperty( 'userblog_id', $blog ); 63 $this->assertObjectHasProperty( 'blogname', $blog ); 64 $this->assertObjectHasProperty( 'domain', $blog ); 65 $this->assertObjectHasProperty( 'path', $blog ); 66 $this->assertObjectHasProperty( 'site_id', $blog ); 67 $this->assertObjectHasProperty( 'siteurl', $blog ); 68 $this->assertObjectHasProperty( 'archived', $blog ); 69 $this->assertObjectHasProperty( 'spam', $blog ); 70 $this->assertObjectHasProperty( 'deleted', $blog ); 71 71 } 72 72
Note: See TracChangeset
for help on using the changeset viewer.