Changeset 56746
- Timestamp:
- 09/29/2023 03:22:12 PM (13 months ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/getBlockTemplates.php
r56559 r56746 162 162 163 163 $block_template_ids = wp_list_pluck( $block_templates, 'id' ); 164 $this->assert Same( count( array_unique( $block_template_ids ) ), count( $block_template_ids ), $error_message );164 $this->assertCount( count( array_unique( $block_template_ids ) ), $block_template_ids, $error_message ); 165 165 } 166 166 -
trunk/tests/phpunit/tests/customize/widgets.php
r54872 r56746 237 237 $selective_refreshable_widgets = $this->manager->widgets->get_selective_refreshable_widgets(); 238 238 $this->assertIsArray( $selective_refreshable_widgets ); 239 $this->assert Same( count( $wp_widget_factory->widgets ), count( $selective_refreshable_widgets ));239 $this->assertCount( count( $wp_widget_factory->widgets ), $selective_refreshable_widgets ); 240 240 $this->assertArrayHasKey( 'text', $selective_refreshable_widgets ); 241 241 $this->assertTrue( $selective_refreshable_widgets['text'] ); -
trunk/tests/phpunit/tests/date/query.php
r56548 r56746 1185 1185 $parts = mb_split( '\)\s+AND\s+\(', $sql ); 1186 1186 $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' ); 1187 $this->assert Same( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );1187 $this->assertCount( 2, $parts, 'SQL query does not contain correct number of AND operators.' ); 1188 1188 1189 1189 $this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' ); … … 1232 1232 $parts = mb_split( '\)\s+OR\s+\(', $sql ); 1233 1233 $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator OR.' ); 1234 $this->assert Same( 2, count( $parts ), 'SQL query does not contain correct number of OR operators.' );1234 $this->assertCount( 2, $parts, 'SQL query does not contain correct number of OR operators.' ); 1235 1235 1236 1236 // Checking number of occurrences of AND while skipping the one at the beginning. … … 1278 1278 $parts = mb_split( '\)\s+AND\s+\(', $sql ); 1279 1279 $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' ); 1280 $this->assert Same( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );1280 $this->assertCount( 2, $parts, 'SQL query does not contain correct number of AND operators.' ); 1281 1281 1282 1282 $this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' ); -
trunk/tests/phpunit/tests/feed/rss2.php
r56559 r56746 247 247 $cats = array_filter( $cats ); 248 248 // Should be the same number of categories. 249 $this->assert Same( count( $cats ), count( $categories ));249 $this->assertCount( count( $cats ), $categories ); 250 250 251 251 // ..with the same names. -
trunk/tests/phpunit/tests/meta.php
r56695 r56746 152 152 153 153 // Test EXISTS and NOT EXISTS together, no users should be found. 154 $this->assert Same(154 $this->assertCount( 155 155 0, 156 count( 157 get_users( 158 array( 159 'meta_query' => array( 160 array( 161 'key' => 'meta_key', 162 'compare' => 'NOT EXISTS', 163 ), 164 array( 165 'key' => 'delete_meta_key', 166 'compare' => 'EXISTS', 167 ), 156 get_users( 157 array( 158 'meta_query' => array( 159 array( 160 'key' => 'meta_key', 161 'compare' => 'NOT EXISTS', 168 162 ), 169 ) 163 array( 164 'key' => 'delete_meta_key', 165 'compare' => 'EXISTS', 166 ), 167 ), 170 168 ) 171 169 ) 172 170 ); 173 171 174 $this->assert Same(172 $this->assertCount( 175 173 2, 176 count( 177 get_users( 178 array( 179 'meta_query' => array( 180 array( 181 'key' => 'non_existing_meta', 182 'compare' => 'NOT EXISTS', 183 ), 174 get_users( 175 array( 176 'meta_query' => array( 177 array( 178 'key' => 'non_existing_meta', 179 'compare' => 'NOT EXISTS', 184 180 ), 185 ) 181 ), 186 182 ) 187 183 ) … … 190 186 delete_metadata( 'user', $this->author->ID, 'meta_key' ); 191 187 192 $this->assert Same(188 $this->assertCount( 193 189 2, 194 count( 195 get_users( 196 array( 197 'meta_query' => array( 198 array( 199 'key' => 'meta_key', 200 'compare' => 'NOT EXISTS', 201 ), 190 get_users( 191 array( 192 'meta_query' => array( 193 array( 194 'key' => 'meta_key', 195 'compare' => 'NOT EXISTS', 202 196 ), 203 ) 197 ), 204 198 ) 205 199 ) -
trunk/tests/phpunit/tests/post/getPages.php
r56559 r56746 275 275 add_post_meta( $posts[2], 'some-meta-key', '1' ); 276 276 277 $this->assert Same(277 $this->assertCount( 278 278 1, 279 count( 280 get_pages( 281 array( 282 'meta_key' => 'some-meta-key', 283 'meta_value' => '0', 284 ) 279 get_pages( 280 array( 281 'meta_key' => 'some-meta-key', 282 'meta_value' => '0', 285 283 ) 286 284 ) 287 285 ); 288 $this->assert Same(286 $this->assertCount( 289 287 1, 290 count( 291 get_pages( 292 array( 293 'meta_key' => 'some-meta-key', 294 'meta_value' => '1', 295 ) 288 get_pages( 289 array( 290 'meta_key' => 'some-meta-key', 291 'meta_value' => '1', 296 292 ) 297 293 ) -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r56549 r56746 224 224 ); 225 225 $categories = get_terms( 'category', $args ); 226 $this->assert Same( count( $categories ), count( $data ));226 $this->assertCount( count( $categories ), $data ); 227 227 } 228 228 … … 256 256 ); 257 257 $categories = get_terms( 'category', $args ); 258 $this->assert Same( count( $categories ), count( $data ));258 $this->assertCount( count( $categories ), $data ); 259 259 } 260 260 … … 1190 1190 ); 1191 1191 $categories = get_terms( 'category', $args ); 1192 $this->assert Same( count( $categories ), count( $data ));1192 $this->assertCount( count( $categories ), $data ); 1193 1193 $this->assertSame( $categories[0]->term_id, $data[0]['id'] ); 1194 1194 $this->assertSame( $categories[0]->name, $data[0]['name'] ); -
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r56547 r56746 37 37 $data = $response->get_data(); 38 38 $post_types = get_post_types( array( 'show_in_rest' => true ), 'objects' ); 39 $this->assert Same( count( $post_types ), count( $data ));39 $this->assertCount( count( $post_types ), $data ); 40 40 $this->assertSame( $post_types['post']->name, $data['post']['slug'] ); 41 41 $this->check_post_type_obj( 'view', $post_types['post'], $data['post'], $data['post']['_links'] ); -
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r56549 r56746 1410 1410 ); 1411 1411 $tags = get_terms( 'post_tag', $args ); 1412 $this->assert Same( count( $tags ), count( $data ));1412 $this->assertCount( count( $tags ), $data ); 1413 1413 $this->assertSame( $tags[0]->term_id, $data[0]['id'] ); 1414 1414 $this->assertSame( $tags[0]->name, $data[0]['name'] ); -
trunk/tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
r56547 r56746 51 51 $data = $response->get_data(); 52 52 $taxonomies = $this->get_public_taxonomies( get_taxonomies( '', 'objects' ) ); 53 $this->assert Same( count( $taxonomies ), count( $data ));53 $this->assertCount( count( $taxonomies ), $data ); 54 54 $this->assertSame( 'Categories', $data['category']['name'] ); 55 55 $this->assertSame( 'category', $data['category']['slug'] ); … … 70 70 unset( $taxonomies['nav_menu'] ); // Menus are not editable by contributors. 71 71 $taxonomies = $this->get_public_taxonomies( $taxonomies ); 72 $this->assert Same( count( $taxonomies ), count( $data ));72 $this->assertCount( count( $taxonomies ), $data ); 73 73 $this->assertSame( 'Categories', $data['category']['name'] ); 74 74 $this->assertSame( 'category', $data['category']['slug'] ); … … 287 287 $data = $response->get_data(); 288 288 $taxonomies = $this->get_public_taxonomies( get_object_taxonomies( $type, 'objects' ) ); 289 $this->assert Same( count( $taxonomies ), count( $data ));289 $this->assertCount( count( $taxonomies ), $data ); 290 290 } 291 291 -
trunk/tests/phpunit/tests/rest-api/wpRestMenuItemsController.php
r56549 r56746 744 744 $data = $response->get_data(); 745 745 $properties = $data['schema']['properties']; 746 $this->assert Same( 18, count( $properties ));746 $this->assertCount( 18, $properties ); 747 747 $this->assertArrayHasKey( 'type_label', $properties ); 748 748 $this->assertArrayHasKey( 'attr_title', $properties ); -
trunk/tests/phpunit/tests/rest-api/wpRestMenuLocationsController.php
r55457 r56746 182 182 $data = $response->get_data(); 183 183 $properties = $data['schema']['properties']; 184 $this->assert Same( 3, count( $properties ));184 $this->assertCount( 3, $properties ); 185 185 $this->assertArrayHasKey( 'name', $properties ); 186 186 $this->assertArrayHasKey( 'description', $properties ); -
trunk/tests/phpunit/tests/rest-api/wpRestMenusController.php
r55457 r56746 339 339 $data = $response->get_data(); 340 340 $properties = $data['schema']['properties']; 341 $this->assert Same( 7, count( $properties ));341 $this->assertCount( 7, $properties ); 342 342 $this->assertArrayHasKey( 'id', $properties ); 343 343 $this->assertArrayHasKey( 'description', $properties ); … … 574 574 ); 575 575 $tags = get_terms( self::TAXONOMY, $args ); 576 $this->assert Same( count( $tags ), count( $data ));576 $this->assertCount( count( $tags ), $data ); 577 577 $this->assertSame( $tags[0]->term_id, $data[0]['id'] ); 578 578 $this->assertSame( $tags[0]->name, $data[0]['name'] ); -
trunk/tests/phpunit/tests/term/getTerms.php
r56585 r56746 3173 3173 $query2 = get_terms( $args_2 ); 3174 3174 $this->assertSame( $num_queries_1, get_num_queries() ); 3175 $this->assert Same( count( $query1 ), count( $query2 ));3175 $this->assertCount( count( $query1 ), $query2 ); 3176 3176 } 3177 3177 -
trunk/tests/phpunit/tests/user.php
r56548 r56746 2084 2084 2085 2085 // Check that the item added by the filter was retained. 2086 $this->assert Same(2086 $this->assertCount( 2087 2087 1, 2088 count( 2089 wp_list_filter( 2090 $actual['data'][0]['data'], 2091 array( 2092 'name' => 'Test Additional Data Name', 2093 'value' => 'Test Additional Data Value', 2094 ) 2088 wp_list_filter( 2089 $actual['data'][0]['data'], 2090 array( 2091 'name' => 'Test Additional Data Name', 2092 'value' => 'Test Additional Data Value', 2095 2093 ) 2096 2094 ) … … 2116 2114 2117 2115 // Check that the duplicate 'name' => 'User ID' was stripped. 2118 $this->assert Same(2116 $this->assertCount( 2119 2117 1, 2120 count( 2121 wp_list_filter( 2122 $actual['data'][0]['data'], 2123 array( 2124 'name' => 'User ID', 2125 ) 2118 wp_list_filter( 2119 $actual['data'][0]['data'], 2120 array( 2121 'name' => 'User ID', 2126 2122 ) 2127 2123 ) … … 2129 2125 2130 2126 // Check that the item added by the filter was retained. 2131 $this->assert Same(2127 $this->assertCount( 2132 2128 1, 2133 count( 2134 wp_list_filter( 2135 $actual['data'][0]['data'], 2136 array( 2137 'name' => 'Test Additional Data Name', 2138 'value' => 'Test Additional Data Value', 2139 ) 2129 wp_list_filter( 2130 $actual['data'][0]['data'], 2131 array( 2132 'name' => 'Test Additional Data Name', 2133 'value' => 'Test Additional Data Value', 2140 2134 ) 2141 2135 ) -
trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php
r55120 r56746 77 77 array_keys( $widget->l10n ) 78 78 ); 79 $this->assert Same( count( $widget->l10n ), count( array_filter( $widget->l10n )), 'Expected all translation strings to be defined.' );79 $this->assertCount( count( $widget->l10n ), array_filter( $widget->l10n ), 'Expected all translation strings to be defined.' ); 80 80 $this->assertSame( 10, has_action( 'admin_print_scripts-widgets.php', array( $widget, 'enqueue_admin_scripts' ) ) ); 81 81 $this->assertFalse( has_action( 'wp_enqueue_scripts', array( $widget, 'enqueue_preview_scripts' ) ), 'Did not expect preview scripts to be enqueued when not in customize preview context.' );
Note: See TracChangeset
for help on using the changeset viewer.