Changeset 51397
- Timestamp:
- 07/10/2021 11:15:44 AM (3 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase-rest-post-type-controller.php
r50283 r51397 47 47 } 48 48 } else { 49 $this->assert False( isset( $data['parent'] ));49 $this->assertArrayNotHasKey( 'parent', $data ); 50 50 } 51 51 … … 54 54 $this->assertSame( $post->menu_order, $data['menu_order'] ); 55 55 } else { 56 $this->assert False( isset( $data['menu_order'] ));56 $this->assertArrayNotHasKey( 'menu_order', $data ); 57 57 } 58 58 … … 62 62 $this->assertSame( $post->ping_status, $data['ping_status'] ); 63 63 } else { 64 $this->assert False( isset( $data['comment_status'] ));65 $this->assert False( isset( $data['ping_status'] ));64 $this->assertArrayNotHasKey( 'comment_status', $data ); 65 $this->assertArrayNotHasKey( 'ping_status', $data ); 66 66 } 67 67 … … 81 81 $this->assertSame( (int) get_post_thumbnail_id( $post->ID ), $data['featured_media'] ); 82 82 } else { 83 $this->assert False( isset( $data['featured_media'] ));83 $this->assertArrayNotHasKey( 'featured_media', $data ); 84 84 } 85 85 … … 93 93 } 94 94 } else { 95 $this->assert False( isset( $data['format'] ));95 $this->assertArrayNotHasKey( 'format', $data ); 96 96 } 97 97 … … 104 104 $this->assertSame( $post->post_title, $data['title']['raw'] ); 105 105 } else { 106 $this->assert False( isset( $data['title']['raw'] ));107 } 108 } else { 109 $this->assert False( isset( $data['title'] ));106 $this->assertArrayNotHasKey( 'raw', $data['title'] ); 107 } 108 } else { 109 $this->assertArrayNotHasKey( 'title', $data ); 110 110 } 111 111 … … 119 119 $this->assertSame( $post->post_content, $data['content']['raw'] ); 120 120 } else { 121 $this->assert False( isset( $data['content']['raw'] ));122 } 123 } else { 124 $this->assert False( isset( $data['content'] ));121 $this->assertArrayNotHasKey( 'raw', $data['content'] ); 122 } 123 } else { 124 $this->assertArrayNotHasKey( 'content', $data ); 125 125 } 126 126 … … 135 135 $this->assertSame( $post->post_excerpt, $data['excerpt']['raw'] ); 136 136 } else { 137 $this->assert False( isset( $data['excerpt']['raw'] ));138 } 139 } else { 140 $this->assert False( isset( $data['excerpt'] ));137 $this->assertArrayNotHasKey( 'raw', $data['excerpt'] ); 138 } 139 } else { 140 $this->assertArrayNotHasKey( 'excerpt', $data ); 141 141 } 142 142 … … 150 150 $taxonomies = wp_list_filter( get_object_taxonomies( $post->post_type, 'objects' ), array( 'show_in_rest' => true ) ); 151 151 foreach ( $taxonomies as $taxonomy ) { 152 $this->assert True( isset( $data[ $taxonomy->rest_base ] ));152 $this->assertArrayHasKey( $taxonomy->rest_base, $data ); 153 153 $terms = wp_get_object_terms( $post->ID, $taxonomy->name, array( 'fields' => 'ids' ) ); 154 154 sort( $terms ); -
trunk/tests/phpunit/tests/actions.php
r48937 r51397 424 424 add_action( $tag, '__return_null', 11, 1 ); 425 425 426 $this->assert True( isset( $wp_filter[ $tag ][11] ));426 $this->assertArrayHasKey( 11, $wp_filter[ $tag ] ); 427 427 $this->assertArrayHasKey( '__return_null', $wp_filter[ $tag ][11] ); 428 428 -
trunk/tests/phpunit/tests/admin/includesPlugin.php
r51335 r51397 31 31 32 32 foreach ( $default_headers as $name => $value ) { 33 $this->assert True( isset( $data[ $name ] ));33 $this->assertArrayHasKey( $name, $data ); 34 34 $this->assertSame( $value, $data[ $name ] ); 35 35 } … … 553 553 554 554 $result = validate_active_plugins(); 555 $this->assert True( isset( $result[ $plugin[0] ] ));555 $this->assertArrayHasKey( $plugin[0], $result ); 556 556 } 557 557 -
trunk/tests/phpunit/tests/adminbar.php
r51331 r51397 703 703 $nodes = $wp_admin_bar->get_nodes(); 704 704 foreach ( $this->get_my_sites_network_menu_items() as $id => $cap ) { 705 $this->assert False( isset( $nodes[ $id ] ), sprintf( 'Menu item %s must not display for a regular user.', $id ) );705 $this->assertArrayNotHasKey( $id, $nodes, sprintf( 'Menu item %s must not display for a regular user.', $id ) ); 706 706 } 707 707 } … … 720 720 $nodes = $wp_admin_bar->get_nodes(); 721 721 foreach ( $this->get_my_sites_network_menu_items() as $id => $cap ) { 722 $this->assert True( isset( $nodes[ $id ] ), sprintf( 'Menu item %s must display for a super admin.', $id ) );722 $this->assertArrayHasKey( $id, $nodes, sprintf( 'Menu item %s must display for a super admin.', $id ) ); 723 723 } 724 724 } … … 746 746 foreach ( $this->get_my_sites_network_menu_items() as $id => $cap ) { 747 747 if ( in_array( $cap, $network_user_caps, true ) ) { 748 $this->assert True( isset( $nodes[ $id ] ), sprintf( 'Menu item %1$s must display for a user with the %2$s cap.', $id, $cap ) );748 $this->assertArrayHasKey( $id, $nodes, sprintf( 'Menu item %1$s must display for a user with the %2$s cap.', $id, $cap ) ); 749 749 } else { 750 $this->assert False( isset( $nodes[ $id ] ), sprintf( 'Menu item %1$s must not display for a user without the %2$s cap.', $id, $cap ) );750 $this->assertArrayNotHasKey( $id, $nodes, sprintf( 'Menu item %1$s must not display for a user without the %2$s cap.', $id, $cap ) ); 751 751 } 752 752 } -
trunk/tests/phpunit/tests/blocks/block-list.php
r51367 r51397 52 52 53 53 // Test "offsetExists". 54 $this->assert True( isset( $blocks[0] ));54 $this->assertArrayHasKey( 0, $blocks ); 55 55 56 56 // Test "offsetGet". … … 64 64 // Test "offsetUnset". 65 65 unset( $blocks[0] ); 66 $this->assert False( isset( $blocks[0] ));66 $this->assertArrayNotHasKey( 0, $blocks ); 67 67 } 68 68 -
trunk/tests/phpunit/tests/dependencies.php
r48937 r51397 101 101 $this->assertFalse( $dep->query( 'one', 'queue' ) ); 102 102 $this->assertTrue( $dep->query( 'two', 'queue' ) ); 103 $this->assert False( isset( $dep->args['one'] ));103 $this->assertArrayNotHasKey( 'one', $dep->args ); 104 104 105 105 $dep->dequeue( 'two' ); 106 106 $this->assertFalse( $dep->query( 'one', 'queue' ) ); 107 107 $this->assertFalse( $dep->query( 'two', 'queue' ) ); 108 $this->assert False( isset( $dep->args['two'] ));108 $this->assertArrayNotHasKey( 'two', $dep->args ); 109 109 } 110 110 -
trunk/tests/phpunit/tests/dependencies/jquery.php
r50441 r51397 35 35 $o = $scripts->query( $dep, 'registered' ); 36 36 $this->assertInstanceOf( '_WP_Dependency', $object ); 37 $this->assert True( isset( $jquery_scripts[ $dep ] ));37 $this->assertArrayHasKey( $dep, $jquery_scripts ); 38 38 $this->assertSame( $jquery_scripts[ $dep ], $o->src ); 39 39 } -
trunk/tests/phpunit/tests/feed/rss2.php
r51367 r51397 132 132 133 133 // The channel should be free of attributes. 134 $this->assert True( empty( $channel[0]['attributes'] ));134 $this->assertArrayNotHasKey( 'attributes', $channel[0] ); 135 135 136 136 // Verify the channel is present and contains a title child element. -
trunk/tests/phpunit/tests/hooks/removeFilter.php
r50342 r51397 19 19 $hook->remove_filter( $tag, $callback, $priority ); 20 20 21 $this->assert False( isset( $hook->callbacks[ $priority ] ));21 $this->assertArrayNotHasKey( $priority, $hook->callbacks ); 22 22 } 23 23 … … 33 33 $hook->remove_filter( $tag, $callback, $priority ); 34 34 35 $this->assert False( isset( $hook->callbacks[ $priority ] ));35 $this->assertArrayNotHasKey( $priority, $hook->callbacks ); 36 36 } 37 37 … … 46 46 $hook->remove_filter( $tag, $callback, $priority ); 47 47 48 $this->assert False( isset( $hook->callbacks[ $priority ] ));48 $this->assertArrayNotHasKey( $priority, $hook->callbacks ); 49 49 } 50 50 … … 77 77 78 78 $hook->remove_filter( $tag, $callback_one, $priority ); 79 $this->assert False( isset( $hook->callbacks[ $priority ] ));79 $this->assertArrayNotHasKey( $priority, $hook->callbacks ); 80 80 $this->assertCount( 1, $hook->callbacks[ $priority + 1 ] ); 81 81 } -
trunk/tests/phpunit/tests/http/base.php
r51331 r51397 256 256 } 257 257 258 $this->assertTrue( isset( $headers['test1'] ) && 'test' === $headers['test1'] ); 259 $this->assertTrue( isset( $headers['test2'] ) && '0' === $headers['test2'] ); 258 $this->assertArrayHasKey( 'test1', $headers ); 259 $this->assertSame( 'test', $headers['test1'] ); 260 $this->assertArrayHasKey( 'test2', $headers ); 261 $this->assertSame( '0', $headers['test2'] ); 260 262 // cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value. 261 263 // Should it be that empty headers with empty values are NOT sent? 262 // $this->assertTrue( isset( $headers['test3'] ) && '' === $headers['test3'] ); 264 // $this->assertArrayHasKey( 'test3', $headers ); 265 // $this->assertSame( '', $headers['test3'] ); 263 266 } 264 267 -
trunk/tests/phpunit/tests/http/http.php
r50537 r51397 314 314 foreach ( array_keys( $cookies ) as $cookie ) { 315 315 if ( 'foo' === $cookie ) { 316 $this->assert False( isset( $cookie_jar[ $cookie ] ));316 $this->assertArrayNotHasKey( $cookie, $cookie_jar ); 317 317 } else { 318 318 $this->assertInstanceOf( 'Requests_Cookie', $cookie_jar[ $cookie ] ); -
trunk/tests/phpunit/tests/image/functions.php
r51331 r51397 648 648 649 649 $metadata = wp_generate_attachment_metadata( $attachment_id, $test_file ); 650 $this->assert True( isset( $metadata['sizes']['test-size'] ), 'The `test-size` was not added to the metadata.' );650 $this->assertArrayHasKey( 'test-size', $metadata['sizes'], 'The `test-size` was not added to the metadata.' ); 651 651 $this->assertSame( $metadata['sizes']['test-size'], $expected ); 652 652 -
trunk/tests/phpunit/tests/image/intermediateSize.php
r51331 r51397 60 60 $this->assertSame( 'image/jpeg', $image['mime-type'] ); 61 61 62 $this->assert False( isset( $image['path'] ));62 $this->assertArrayNotHasKey( 'path', $image ); 63 63 } 64 64 -
trunk/tests/phpunit/tests/includes/helpers.php
r48996 r51397 228 228 $stati = get_post_stati(); 229 229 230 $this->assert False( isset( $stati['foo'] ));230 $this->assertArrayNotHasKey( 'foo', $stati ); 231 231 } 232 232 -
trunk/tests/phpunit/tests/kses.php
r50987 r51397 508 508 509 509 $tags = wp_kses_allowed_html(); 510 $this->assert False( isset( $tags['a']['rel'] ));510 $this->assertArrayNotHasKey( 'rel', $tags['a'] ); 511 511 512 512 $this->assertSame( array(), wp_kses_allowed_html( 'strip' ) ); -
trunk/tests/phpunit/tests/media.php
r51331 r51397 447 447 $prepped = wp_prepare_attachment_for_js( get_post( $id ) ); 448 448 449 $this->assert True( isset( $prepped['sizes'] ));449 $this->assertArrayHasKey( 'sizes', $prepped ); 450 450 } 451 451 -
trunk/tests/phpunit/tests/meta/query.php
r49554 r51397 147 147 $query->parse_query_vars( $qv ); 148 148 149 $this->assert True( ! isset( $query->queries[0]['value'] ));149 $this->assertArrayNotHasKey( 'value', $query->queries[0] ); 150 150 } 151 151 … … 164 164 $query->parse_query_vars( $qv ); 165 165 166 $this->assert True( ! isset( $query->queries[0]['value'] ));166 $this->assertArrayNotHasKey( 'value', $query->queries[0] ); 167 167 } 168 168 -
trunk/tests/phpunit/tests/oembed/filterResult.php
r49117 r51397 20 20 preg_match( '|src=".*#\?secret=([\w\d]+)" data-secret="([\w\d]+)"|', $actual, $matches ); 21 21 22 $this->assert True( isset( $matches[1] ));23 $this->assert True( isset( $matches[2] ));22 $this->assertArrayHasKey( 1, $matches ); 23 $this->assertArrayHasKey( 2, $matches ); 24 24 $this->assertSame( $matches[1], $matches[2] ); 25 25 } … … 64 64 preg_match( '|src="https://wordpress.org#\?secret=([\w\d]+)" data-secret="([\w\d]+)"|', $actual, $matches ); 65 65 66 $this->assert True( isset( $matches[1] ));67 $this->assert True( isset( $matches[2] ));66 $this->assertArrayHasKey( 1, $matches ); 67 $this->assertArrayHasKey( 2, $matches ); 68 68 $this->assertSame( $matches[1], $matches[2] ); 69 69 } -
trunk/tests/phpunit/tests/option/networkOption.php
r48937 r51397 62 62 $options = wp_load_alloptions(); 63 63 64 $this->assert False( isset( $options[ $key ] ));64 $this->assertArrayNotHasKey( $key, $options ); 65 65 } 66 66 … … 76 76 $options = wp_load_alloptions(); 77 77 78 $this->assert False( isset( $options[ $key ] ));78 $this->assertArrayNotHasKey( $key, $options ); 79 79 } 80 80 -
trunk/tests/phpunit/tests/option/siteTransient.php
r48937 r51397 57 57 $options = wp_load_alloptions(); 58 58 59 $this->assert False( isset( $options[ '_site_transient_' . $key ] ));59 $this->assertArrayNotHasKey( '_site_transient_' . $key, $options ); 60 60 } 61 61 } -
trunk/tests/phpunit/tests/post.php
r51367 r51397 892 892 893 893 $counts = wp_count_posts(); 894 $this->assert True( isset( $counts->test ));894 $this->assertObjectHasAttribute( 'test', $counts ); 895 895 $this->assertSame( 0, $counts->test ); 896 896 } -
trunk/tests/phpunit/tests/post/objects.php
r51367 r51397 36 36 $post = get_post( $id, ARRAY_N ); 37 37 $this->assertIsArray( $post ); 38 $this->assert False( isset( $post['post_type'] ));38 $this->assertArrayNotHasKey( 'post_type', $post ); 39 39 $this->assertTrue( in_array( 'post', $post, true ) ); 40 40 -
trunk/tests/phpunit/tests/post/types.php
r51367 r51397 395 395 $this->assertTrue( unregister_post_type( 'foo' ) ); 396 396 397 $this->assert False( isset( $post_type_meta_caps['read_bar'] ));398 $this->assert False( isset( $post_type_meta_caps['delete_bar'] ));399 $this->assert False( isset( $post_type_meta_caps['edit_bar'] ));397 $this->assertArrayNotHasKey( 'read_bar', $post_type_meta_caps ); 398 $this->assertArrayNotHasKey( 'delete_bar', $post_type_meta_caps ); 399 $this->assertArrayNotHasKey( 'edit_bar', $post_type_meta_caps ); 400 400 } 401 401 … … 423 423 ); 424 424 $this->assertTrue( unregister_post_type( 'foo' ) ); 425 $this->assert False( isset( $_wp_post_type_features['foo'] ));425 $this->assertArrayNotHasKey( 'foo', $_wp_post_type_features ); 426 426 } 427 427 … … 505 505 $this->assertTrue( unregister_post_type( 'foo' ) ); 506 506 507 $this->assert False( isset( $wp_post_types['foo'] ));507 $this->assertArrayNotHasKey( 'foo', $wp_post_types ); 508 508 $this->assertNull( get_post_type_object( 'foo' ) ); 509 509 } -
trunk/tests/phpunit/tests/rest-api.php
r50156 r51397 238 238 ); 239 239 $endpoints = $GLOBALS['wp_rest_server']->get_routes(); 240 $this->assert False( isset( $endpoints['/test-empty-namespace'] ));240 $this->assertArrayNotHasKey( '/test-empty-namespace', $endpoints ); 241 241 } 242 242 … … 258 258 ); 259 259 $endpoints = $GLOBALS['wp_rest_server']->get_routes(); 260 $this->assert False( isset( $endpoints['/test-empty-route'] ));260 $this->assertArrayNotHasKey( '/test-empty-route', $endpoints ); 261 261 } 262 262 … … 952 952 953 953 $this->assertSame( array_keys( $preload_data ), array( '/wp/v2/types', 'OPTIONS' ) ); 954 $this->assert True( isset( $preload_data['OPTIONS']['/wp/v2/media'] ));954 $this->assertArrayHasKey( '/wp/v2/media', $preload_data['OPTIONS'] ); 955 955 956 956 $GLOBALS['wp_rest_server'] = $rest_server; -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r51367 r51397 692 692 693 693 $this->assertIsArray( $data['media_details']['sizes'], 'Could not retrieve the sizes data.' ); 694 $this->assert False( isset( $data['media_details']['sizes']['rest-api-test']['source_url'] ));694 $this->assertArrayNotHasKey( 'source_url', $data['media_details']['sizes']['rest-api-test'] ); 695 695 } 696 696 … … 1687 1687 $this->assertSame( $attachment->post_content, $data['description']['raw'] ); 1688 1688 } else { 1689 $this->assert False( isset( $data['caption']['raw'] ));1690 $this->assert False( isset( $data['description']['raw'] ));1689 $this->assertArrayNotHasKey( 'raw', $data['caption'] ); 1690 $this->assertArrayNotHasKey( 'raw', $data['description'] ); 1691 1691 } 1692 $this->assert True( isset( $data['media_details'] ));1692 $this->assertArrayHasKey( 'media_details', $data ); 1693 1693 1694 1694 if ( $attachment->post_parent ) { -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r51367 r51397 748 748 749 749 $meta = (array) $data['meta']; 750 $this->assert False( isset( $meta['test_tag_meta'] ));750 $this->assertArrayNotHasKey( 'test_tag_meta', $meta ); 751 751 } 752 752 … … 943 943 $this->assertSame( 'just meta', $data['meta']['test_single'] ); 944 944 $this->assertSame( 'category-specific meta', $data['meta']['test_cat_single'] ); 945 $this->assert False( isset( $data['meta']['test_tag_meta'] ));945 $this->assertArrayNotHasKey( 'test_tag_meta', $data['meta'] ); 946 946 } 947 947 … … 1210 1210 $this->assertSame( $term->parent, $data['parent'] ); 1211 1211 } else { 1212 $this->assert False( isset( $term->parent ));1212 $this->assertObjectNotHasProperty( 'parent', $term ); 1213 1213 } 1214 1214 -
trunk/tests/phpunit/tests/rest-api/rest-controller.php
r50450 r51397 250 250 251 251 $this->assertSame( 'A pretty string.', $args['somestring']['description'] ); 252 $this->assert False( isset( $args['someinteger']['description'] ));252 $this->assertArrayNotHasKey( 'description', $args['someinteger'] ); 253 253 } 254 254 -
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r51367 r51397 44 44 $this->assertSame( $post_types['page']->name, $data['page']['slug'] ); 45 45 $this->check_post_type_obj( 'view', $post_types['page'], $data['page'], $data['page']['_links'] ); 46 $this->assert False( isset( $data['revision'] ));46 $this->assertArrayNotHasKey( 'revision', $data ); 47 47 } 48 48 … … 219 219 $this->assertSame( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] ); 220 220 } else { 221 $this->assert False( isset( $data['capabilities'] ));222 $this->assert False( isset( $data['viewable'] ));223 $this->assert False( isset( $data['labels'] ));224 $this->assert False( isset( $data['supports'] ));221 $this->assertArrayNotHasKey( 'capabilities', $data ); 222 $this->assertArrayNotHasKey( 'viewable', $data ); 223 $this->assertArrayNotHasKey( 'labels', $data ); 224 $this->assertArrayNotHasKey( 'supports', $data ); 225 225 } 226 226 } -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r51368 r51397 1778 1778 $this->assertSame( rest_url( '/wp/v2/posts/' . self::$post_id . '/revisions' ), $links['version-history'][0]['href'] ); 1779 1779 $this->assertSame( 0, $links['version-history'][0]['attributes']['count'] ); 1780 $this->assert False( isset( $links['predecessor-version'] ));1780 $this->assertArrayNotHasKey( 'predecessor-version', $links ); 1781 1781 1782 1782 $attachments_url = rest_url( '/wp/v2/media' ); … … 1834 1834 $response = rest_get_server()->dispatch( $request ); 1835 1835 $links = $response->get_links(); 1836 $this->assert False( isset( $links['author'] ));1836 $this->assertArrayNotHasKey( 'author', $links ); 1837 1837 wp_update_post( 1838 1838 array( … … 2031 2031 $response = rest_get_server()->dispatch( $request ); 2032 2032 $data = $response->get_data(); 2033 $this->assert False( isset( $data['content']['block_version'] ));2033 $this->assertArrayNotHasKey( 'block_version', $data['content'] ); 2034 2034 } 2035 2035 … … 4158 4158 create_initial_rest_routes(); 4159 4159 $routes = rest_get_server()->get_routes(); 4160 $this->assert False( isset( $routes['/wp/v2/invalid-controller'] ));4160 $this->assertArrayNotHasKey( '/wp/v2/invalid-controller', $routes ); 4161 4161 _unregister_post_type( 'invalid-controller' ); 4162 4162 -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r51331 r51397 1119 1119 } 1120 1120 1121 $this->assert True( isset( $headers[ $header ] ), sprintf( 'Header %s is not present in the response.', $header ) );1121 $this->assertArrayHasKey( $header, $headers, sprintf( 'Header %s is not present in the response.', $header ) ); 1122 1122 $this->assertSame( $value, $headers[ $header ] ); 1123 1123 } 1124 1124 1125 1125 // Last-Modified should be unset as per #WP23021. 1126 $this->assert False( isset( $headers['Last-Modified'] ), 'Last-Modified should not be sent.' );1126 $this->assertArrayNotHasKey( 'Last-Modified', $headers, 'Last-Modified should not be sent.' ); 1127 1127 } 1128 1128 -
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r51367 r51397 701 701 702 702 $meta = (array) $data['meta']; 703 $this->assert False( isset( $meta['test_cat_meta'] ));703 $this->assertArrayNotHasKey( 'test_cat_meta', $meta ); 704 704 } 705 705 … … 875 875 $this->assertSame( 'just meta', $data['meta']['test_single'] ); 876 876 $this->assertSame( 'tag-specific meta', $data['meta']['test_tag_single'] ); 877 $this->assert False( isset( $data['meta']['test_cat_meta'] ));877 $this->assertArrayNotHasKey( 'test_cat_meta', $data['meta'] ); 878 878 } 879 879 … … 1243 1243 $properties = $data['schema']['properties']; 1244 1244 $this->assertArrayHasKey( 'id', $properties ); 1245 $this->assert False( isset( $properties['parent'] ));1245 $this->assertArrayNotHasKey( 'parent', $properties ); 1246 1246 } 1247 1247 … … 1428 1428 $this->assertSame( $term->parent, $data['parent'] ); 1429 1429 } else { 1430 $this->assert False( isset( $data['parent'] ));1430 $this->assertArrayNotHasKey( 'parent', $data ); 1431 1431 } 1432 1432 $expected_links = array( -
trunk/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
r51367 r51397 267 267 $this->assertSame( $tax_obj->show_ui, $data['visibility']['show_ui'] ); 268 268 } else { 269 $this->assert False( isset( $data['capabilities'] ));270 $this->assert False( isset( $data['labels'] ));271 $this->assert False( isset( $data['show_cloud'] ));272 $this->assert False( isset( $data['visibility'] ));269 $this->assertArrayNotHasKey( 'capabilities', $data ); 270 $this->assertArrayNotHasKey( 'labels', $data ); 271 $this->assertArrayNotHasKey( 'show_cloud', $data ); 272 $this->assertArrayNotHasKey( 'visibility', $data ); 273 273 } 274 274 } -
trunk/tests/phpunit/tests/rest-api/rest-themes-controller.php
r51367 r51397 1030 1030 $response = self::perform_active_theme_request(); 1031 1031 $result = $response->get_data(); 1032 $this->assert True( isset( $result[0]['theme_supports'] ));1033 $this->assert True( isset( $result[0]['theme_supports']['formats'] ));1032 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1033 $this->assertArrayHasKey( 'formats', $result[0]['theme_supports'] ); 1034 1034 $this->assertSame( array( 'standard' ), $result[0]['theme_supports']['formats'] ); 1035 1035 } … … 1044 1044 $response = self::perform_active_theme_request(); 1045 1045 $result = $response->get_data(); 1046 $this->assert True( isset( $result[0]['theme_supports'] ));1047 $this->assert True( isset( $result[0]['theme_supports']['formats'] ));1046 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1047 $this->assertArrayHasKey( 'formats', $result[0]['theme_supports'] ); 1048 1048 $this->assertSame( array( 'standard', 'aside', 'video' ), $result[0]['theme_supports']['formats'] ); 1049 1049 } … … 1059 1059 1060 1060 $result = $response->get_data(); 1061 $this->assert True( isset( $result[0]['theme_supports'] ));1062 $this->assert True( isset( $result[0]['theme_supports']['responsive-embeds'] ));1061 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1062 $this->assertArrayHasKey( 'responsive-embeds', $result[0]['theme_supports'] ); 1063 1063 $this->assertFalse( $result[0]['theme_supports']['responsive-embeds'] ); 1064 1064 } … … 1074 1074 $response = self::perform_active_theme_request(); 1075 1075 $result = $response->get_data(); 1076 $this->assert True( isset( $result[0]['theme_supports'] ));1076 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1077 1077 $this->assertTrue( $result[0]['theme_supports']['responsive-embeds'] ); 1078 1078 } … … 1088 1088 1089 1089 $result = $response->get_data(); 1090 $this->assert True( isset( $result[0]['theme_supports'] ));1091 $this->assert True( isset( $result[0]['theme_supports']['post-thumbnails'] ));1090 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1091 $this->assertArrayHasKey( 'post-thumbnails', $result[0]['theme_supports'] ); 1092 1092 $this->assertFalse( $result[0]['theme_supports']['post-thumbnails'] ); 1093 1093 } … … 1103 1103 $response = self::perform_active_theme_request(); 1104 1104 $result = $response->get_data(); 1105 $this->assert True( isset( $result[0]['theme_supports'] ));1105 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1106 1106 $this->assertTrue( $result[0]['theme_supports']['post-thumbnails'] ); 1107 1107 } … … 1117 1117 $response = self::perform_active_theme_request(); 1118 1118 $result = $response->get_data(); 1119 $this->assert True( isset( $result[0]['theme_supports'] ));1119 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1120 1120 $this->assertSame( array( 'post' ), $result[0]['theme_supports']['post-thumbnails'] ); 1121 1121 } … … 1143 1143 $response = self::perform_active_theme_request(); 1144 1144 $result = $response->get_data(); 1145 $this->assert True( isset( $result[0]['theme_supports'] ));1145 $this->assertArrayHasKey( 'theme_supports', $result[0] ); 1146 1146 $this->assertSame( array( 'a', 'b', 'c' ), $result[0]['theme_supports']['test-feature'] ); 1147 1147 } -
trunk/tests/phpunit/tests/rewrite/permastructs.php
r51331 r51397 39 39 40 40 remove_permastruct( 'foo' ); 41 $this->assert False( isset( $wp_rewrite->extra_permastructs['foo'] ));41 $this->assertArrayNotHasKey( 'foo', $wp_rewrite->extra_permastructs ); 42 42 } 43 43 } -
trunk/tests/phpunit/tests/sitemaps/sitemaps-posts.php
r48937 r51397 59 59 $sitemap_entry = array_shift( $url_list ); 60 60 61 $this->assert True( isset( $sitemap_entry['lastmod'] ));61 $this->assertArrayHasKey( 'lastmod', $sitemap_entry ); 62 62 } 63 63 -
trunk/tests/phpunit/tests/taxonomy.php
r51367 r51397 843 843 $this->assertIsArray( $wp_rewrite->extra_permastructs['foo'] ); 844 844 $this->assertTrue( unregister_taxonomy( 'foo' ) ); 845 $this->assert False( isset( $wp_rewrite->extra_permastructs['foo'] ));845 $this->assertArrayNotHasKey( 'foo', $wp_rewrite->extra_permastructs ); 846 846 } 847 847 … … 879 879 $this->assertTrue( unregister_taxonomy( 'foo' ) ); 880 880 881 $this->assert False( isset( $wp_taxonomies['foo'] ));881 $this->assertArrayNotHasKey( 'foo', $wp_taxonomies ); 882 882 $this->assertFalse( get_taxonomy( 'foo' ) ); 883 883 } -
trunk/tests/phpunit/tests/term/getTerm.php
r51331 r51397 105 105 $term = get_term( $t, 'wptests_tax', ARRAY_A ); 106 106 $this->assertIsArray( $term ); 107 $this->assert True( isset( $term['term_id'] ));107 $this->assertArrayHasKey( 'term_id', $term ); 108 108 } 109 109 … … 112 112 $term = get_term( $t, 'wptests_tax', ARRAY_N ); 113 113 $this->assertIsArray( $term ); 114 $this->assert False( isset( $term['term_id'] ));114 $this->assertArrayNotHasKey( 'term_id', $term ); 115 115 foreach ( $term as $k => $v ) { 116 116 $this->assertIsInt( $k ); -
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r51367 r51397 839 839 840 840 $term = get_term( $t ); 841 $this->assert False( isset( $term->object_id ));841 $this->assertObjectNotHasAttribute( 'object_id', $term ); 842 842 } 843 843 -
trunk/tests/phpunit/tests/theme.php
r51335 r51397 132 132 ); 133 133 foreach ( $default_headers as $name => $value ) { 134 $this->assert True( isset( $theme[ $name ] ));134 $this->assertArrayHasKey( $name, $theme ); 135 135 } 136 136 -
trunk/tests/phpunit/tests/user.php
r51367 r51397 167 167 // So we'll just check to make sure our values are included somewhere. 168 168 foreach ( $vals as $k => $v ) { 169 $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] === $v ); 169 $this->assertArrayHasKey( $k, $out ); 170 $this->assertSame( $v, $out[ $k ][0] ); 170 171 } 171 172 // Delete one key and check again. … … 177 178 foreach ( $vals as $k => $v ) { 178 179 if ( $k === $key_to_delete ) { 179 $this->assert False( isset( $out[ $k ] ));180 $this->assertArrayNotHasKey( $k, $out ); 180 181 } else { 181 $this->assertTrue( isset( $out[ $k ] ) && $out[ $k ][0] === $v ); 182 $this->assertArrayHasKey( $k, $out ); 183 $this->assertSame( $v, $out[ $k ][0] ); 182 184 } 183 185 } -
trunk/tests/phpunit/tests/user/capabilities.php
r50491 r51397 1609 1609 1610 1610 $author->add_cap( 'foo', false ); 1611 $this->assert True( isset( $author->caps['foo'] ));1611 $this->assertArrayHasKey( 'foo', $author->caps ); 1612 1612 $this->assertFalse( user_can( $author->ID, 'foo' ) ); 1613 1613 1614 1614 $author->remove_cap( 'foo' ); 1615 $this->assert False( isset( $author->caps['foo'] ));1615 $this->assertArrayNotHasKey( 'foo', $author->caps ); 1616 1616 $this->assertFalse( user_can( $author->ID, 'foo' ) ); 1617 1617 } … … 2238 2238 $wp_roles->for_site( $site_id ); 2239 2239 2240 $this->assert True( isset( $wp_roles->role_objects[ $role_name ] ));2240 $this->assertArrayHasKey( $role_name, $wp_roles->role_objects ); 2241 2241 } 2242 2242 -
trunk/tests/phpunit/tests/user/multisite.php
r51331 r51397 73 73 foreach ( $blogs_of_user as $blog_id => $blog ) { 74 74 $this->assertSame( $blog_id, $blog->userblog_id ); 75 $this->assert True( isset( $blog->userblog_id ));76 $this->assert True( isset( $blog->blogname ));77 $this->assert True( isset( $blog->domain ));78 $this->assert True( isset( $blog->path ));79 $this->assert True( isset( $blog->site_id ));80 $this->assert True( isset( $blog->siteurl ));81 $this->assert True( isset( $blog->archived ));82 $this->assert True( isset( $blog->spam ));83 $this->assert True( isset( $blog->deleted ));75 $this->assertObjectHasAttribute( 'userblog_id', $blog ); 76 $this->assertObjectHasAttribute( 'blogname', $blog ); 77 $this->assertObjectHasAttribute( 'domain', $blog ); 78 $this->assertObjectHasAttribute( 'path', $blog ); 79 $this->assertObjectHasAttribute( 'site_id', $blog ); 80 $this->assertObjectHasAttribute( 'siteurl', $blog ); 81 $this->assertObjectHasAttribute( 'archived', $blog ); 82 $this->assertObjectHasAttribute( 'spam', $blog ); 83 $this->assertObjectHasAttribute( 'deleted', $blog ); 84 84 } 85 85 -
trunk/tests/phpunit/tests/widgets.php
r51367 r51397 135 135 register_sidebars( 1, array( 'id' => 'wp-unit-test' ) ); 136 136 137 $this->assert True( isset( $wp_registered_sidebars['wp-unit-test'] ));137 $this->assertArrayHasKey( 'wp-unit-test', $wp_registered_sidebars ); 138 138 139 139 }
Note: See TracChangeset
for help on using the changeset viewer.