Changeset 51404
- Timestamp:
- 07/12/2021 10:35:44 AM (4 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/DeleteComment.php
r49603 r51404 109 109 // Check for either possible total. 110 110 $message = sprintf( 'returned value: %1$d $total: %2$d $recalc_total: %3$d', (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], $total, $recalc_total ); 111 $this->assert True( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array( $total, $recalc_total ), true), $message );111 $this->assertContains( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array( $total, $recalc_total ), $message ); 112 112 } 113 113 -
trunk/tests/phpunit/tests/ajax/DimComment.php
r48997 r51404 104 104 105 105 // Check for either possible total. 106 $this->assert True( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array( $total, $recalc_total ), true) );106 $this->assertContains( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], array( $total, $recalc_total ) ); 107 107 } 108 108 -
trunk/tests/phpunit/tests/ajax/Response.php
r49025 r51404 84 84 ob_end_clean(); 85 85 86 $this->assert True( in_array( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers, true ));86 $this->assertContains( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers ); 87 87 } 88 88 -
trunk/tests/phpunit/tests/feed/atom.php
r49603 r51404 187 187 $categories = xml_find( $entries[ $key ]['child'], 'category' ); 188 188 foreach ( $categories as $category ) { 189 $this->assert True( in_array( $category['attributes']['term'], $terms, true ));189 $this->assertContains( $category['attributes']['term'], $terms ); 190 190 } 191 191 unset( $terms ); -
trunk/tests/phpunit/tests/formatting/EscUrl.php
r48937 r51404 128 128 } 129 129 130 $this->assert True( ! in_array( 'data', wp_allowed_protocols(), true) );130 $this->assertNotContains( 'data', wp_allowed_protocols() ); 131 131 $this->assertSame( '', esc_url( 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D' ) ); 132 132 133 $this->assert True( ! in_array( 'foo', wp_allowed_protocols(), true) );133 $this->assertNotContains( 'foo', wp_allowed_protocols() ); 134 134 $this->assertSame( 135 135 'foo://example.com', -
trunk/tests/phpunit/tests/oembed/headers.php
r49025 r51404 32 32 $headers = xdebug_get_headers(); 33 33 34 $this->assert True( in_array( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers, true ));34 $this->assertContains( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers ); 35 35 } 36 36 } -
trunk/tests/phpunit/tests/pluggable.php
r50916 r51404 63 63 $msg = 'Function: ' . $function . '()'; 64 64 $this->assertTrue( function_exists( $function ), $msg ); 65 $this->assert True( in_array( $function, $defined, true ), $msg );65 $this->assertContains( $function, $defined, $msg ); 66 66 } 67 67 -
trunk/tests/phpunit/tests/post/meta.php
r51331 r51404 96 96 ); 97 97 sort( $expected ); 98 $this->assert True( in_array( get_post_meta( self::$post_id, 'nonunique', true ), $expected, true ));98 $this->assertContains( get_post_meta( self::$post_id, 'nonunique', true ), $expected ); 99 99 $actual = get_post_meta( self::$post_id, 'nonunique', false ); 100 100 sort( $actual ); -
trunk/tests/phpunit/tests/post/objects.php
r51397 r51404 37 37 $this->assertIsArray( $post ); 38 38 $this->assertArrayNotHasKey( 'post_type', $post ); 39 $this->assert True( in_array( 'post', $post, true ));39 $this->assertContains( 'post', $post ); 40 40 41 41 $post = get_post( $id ); -
trunk/tests/phpunit/tests/post/wpPostType.php
r49327 r51404 120 120 $post_type_object->add_rewrite_rules(); 121 121 122 $this->assert False( in_array( 'foobar', $wp->public_query_vars, true ));122 $this->assertNotContains( 'foobar', $wp->public_query_vars ); 123 123 } 124 124 -
trunk/tests/phpunit/tests/rest-api.php
r51397 r51404 266 266 function test_rest_route_query_var() { 267 267 rest_api_init(); 268 $this->assert True( in_array( 'rest_route', $GLOBALS['wp']->public_query_vars, true ));268 $this->assertContains( 'rest_route', $GLOBALS['wp']->public_query_vars ); 269 269 } 270 270 -
trunk/tests/phpunit/tests/rest-api/rest-attachments-controller.php
r51397 r51404 303 303 $this->assertCount( 2, $data ); 304 304 $ids = wp_list_pluck( $data, 'id' ); 305 $this->assert True( in_array( $id1, $ids, true ));306 $this->assert False( in_array( $id2, $ids, true ));307 $this->assert True( in_array( $id3, $ids, true ));305 $this->assertContains( $id1, $ids ); 306 $this->assertNotContains( $id2, $ids ); 307 $this->assertContains( $id3, $ids ); 308 308 309 309 $this->check_get_posts_response( $response ); … … 344 344 $this->assertCount( 3, $data ); 345 345 $ids = wp_list_pluck( $data, 'id' ); 346 $this->assert True( in_array( $id1, $ids, true ));347 $this->assert True( in_array( $id2, $ids, true ));348 $this->assert True( in_array( $id3, $ids, true ));346 $this->assertContains( $id1, $ids ); 347 $this->assertContains( $id2, $ids ); 348 $this->assertContains( $id3, $ids ); 349 349 } 350 350 -
trunk/tests/phpunit/tests/rest-api/rest-categories-controller.php
r51397 r51404 312 312 $data = $response->get_data(); 313 313 $ids = wp_list_pluck( $data, 'id' ); 314 $this->assert True( in_array( $id1, $ids, true ));315 $this->assert True( in_array( $id2, $ids, true ));314 $this->assertContains( $id1, $ids ); 315 $this->assertContains( $id2, $ids ); 316 316 317 317 $request->set_param( 'exclude', array( $id2 ) ); … … 319 319 $data = $response->get_data(); 320 320 $ids = wp_list_pluck( $data, 'id' ); 321 $this->assert True( in_array( $id1, $ids, true ));322 $this->assert False( in_array( $id2, $ids, true ));321 $this->assertContains( $id1, $ids ); 322 $this->assertNotContains( $id2, $ids ); 323 323 } 324 324 -
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r51367 r51404 248 248 249 249 $collection_data = $response->get_data(); 250 $this->assert True( in_array( $password_comment, wp_list_pluck( $collection_data, 'id' ), true) );250 $this->assertContains( $password_comment, wp_list_pluck( $collection_data, 'id' ) ); 251 251 } 252 252 … … 271 271 272 272 $collection_data = $response->get_data(); 273 $this->assert False( in_array( $password_comment, wp_list_pluck( $collection_data, 'id' ), true) );273 $this->assertNotContains( $password_comment, wp_list_pluck( $collection_data, 'id' ) ); 274 274 } 275 275 … … 311 311 312 312 $collection_data = $response->get_data(); 313 $this->assert False( in_array( $password_comment, wp_list_pluck( $collection_data, 'id' ), true) );313 $this->assertNotContains( $password_comment, wp_list_pluck( $collection_data, 'id' ) ); 314 314 } 315 315 … … 330 330 331 331 $collection_data = $response->get_data(); 332 $this->assert True( in_array( $password_comment, wp_list_pluck( $collection_data, 'id' ), true) );332 $this->assertContains( $password_comment, wp_list_pluck( $collection_data, 'id' ) ); 333 333 } 334 334 … … 349 349 350 350 $collection_data = $response->get_data(); 351 $this->assert False( in_array( $private_comment, wp_list_pluck( $collection_data, 'id' ), true) );351 $this->assertNotContains( $private_comment, wp_list_pluck( $collection_data, 'id' ) ); 352 352 } 353 353 … … 368 368 369 369 $collection_data = $response->get_data(); 370 $this->assert True( in_array( $private_comment, wp_list_pluck( $collection_data, 'id' ), true) );370 $this->assertContains( $private_comment, wp_list_pluck( $collection_data, 'id' ) ); 371 371 } 372 372 … … 387 387 388 388 $collection_data = $response->get_data(); 389 $this->assert False( in_array( $comment_id, wp_list_pluck( $collection_data, 'id' ), true) );389 $this->assertNotContains( $comment_id, wp_list_pluck( $collection_data, 'id' ) ); 390 390 391 391 wp_delete_comment( $comment_id ); … … 408 408 409 409 $collection_data = $response->get_data(); 410 $this->assert True( in_array( $comment_id, wp_list_pluck( $collection_data, 'id' ), true) );410 $this->assertContains( $comment_id, wp_list_pluck( $collection_data, 'id' ) ); 411 411 412 412 wp_delete_comment( $comment_id ); … … 526 526 $data = $response->get_data(); 527 527 $ids = wp_list_pluck( $data, 'id' ); 528 $this->assert True( in_array( $id1, $ids, true ));529 $this->assert True( in_array( $id2, $ids, true ));528 $this->assertContains( $id1, $ids ); 529 $this->assertContains( $id2, $ids ); 530 530 531 531 $request->set_param( 'exclude', array( $id2 ) ); … … 533 533 $data = $response->get_data(); 534 534 $ids = wp_list_pluck( $data, 'id' ); 535 $this->assert True( in_array( $id1, $ids, true ));536 $this->assert False( in_array( $id2, $ids, true ));535 $this->assertContains( $id1, $ids ); 536 $this->assertNotContains( $id2, $ids ); 537 537 538 538 // Invalid 'exclude' should error. -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r51397 r51404 476 476 $data = $response->get_data(); 477 477 $ids = wp_list_pluck( $data, 'id' ); 478 $this->assert True( in_array( $id1, $ids, true ));479 $this->assert True( in_array( $id2, $ids, true ));478 $this->assertContains( $id1, $ids ); 479 $this->assertContains( $id2, $ids ); 480 480 481 481 $request->set_param( 'exclude', array( $id2 ) ); … … 483 483 $data = $response->get_data(); 484 484 $ids = wp_list_pluck( $data, 'id' ); 485 $this->assert True( in_array( $id1, $ids, true ));486 $this->assert False( in_array( $id2, $ids, true ));485 $this->assertContains( $id1, $ids ); 486 $this->assertNotContains( $id2, $ids ); 487 487 488 488 $request->set_param( 'exclude', (string) $id2 ); … … 490 490 $data = $response->get_data(); 491 491 $ids = wp_list_pluck( $data, 'id' ); 492 $this->assert True( in_array( $id1, $ids, true ));493 $this->assert False( in_array( $id2, $ids, true ));492 $this->assertContains( $id1, $ids ); 493 $this->assertNotContains( $id2, $ids ); 494 494 495 495 $request->set_param( 'exclude', 'invalid' ); … … 1483 1483 $posts = $response->get_data(); 1484 1484 $ids = wp_list_pluck( $posts, 'id' ); 1485 $this->assert True( in_array( $id1, $ids, true ));1486 $this->assert False( in_array( $id2, $ids, true ));1487 $this->assert False( in_array( $id3, $ids, true ));1485 $this->assertContains( $id1, $ids ); 1486 $this->assertNotContains( $id2, $ids ); 1487 $this->assertNotContains( $id3, $ids); 1488 1488 1489 1489 $this->assertPostsWhere( " AND {posts}.ID NOT IN ($id3,$id2) AND {posts}.post_type = 'post' AND (({posts}.post_status = 'publish'))" ); … … 1509 1509 $posts = $response->get_data(); 1510 1510 $ids = wp_list_pluck( $posts, 'id' ); 1511 $this->assert True( in_array( $id1, $ids, true ));1512 $this->assert True( in_array( $id2, $ids, true ));1513 $this->assert False( in_array( $id3, $ids, true ));1511 $this->assertContains( $id1, $ids ); 1512 $this->assertContains( $id2, $ids ); 1513 $this->assertNotContains( $id3, $ids ); 1514 1514 1515 1515 $this->assertPostsWhere( " AND {posts}.ID NOT IN ($id3) AND {posts}.post_type = 'post' AND (({posts}.post_status = 'publish'))" ); -
trunk/tests/phpunit/tests/rest-api/rest-request.php
r51331 r51404 617 617 $data = $valid->get_error_data( 'rest_missing_callback_param' ); 618 618 619 $this->assert True( in_array( 'someinteger', $data['params'], true ));620 $this->assert True( in_array( 'someotherinteger', $data['params'], true ));619 $this->assertContains( 'someinteger', $data['params'] ); 620 $this->assertContains( 'someotherinteger', $data['params'] ); 621 621 } 622 622 -
trunk/tests/phpunit/tests/rest-api/rest-tags-controller.php
r51397 r51404 246 246 $data = $response->get_data(); 247 247 $ids = wp_list_pluck( $data, 'id' ); 248 $this->assert True( in_array( $id1, $ids, true ));249 $this->assert True( in_array( $id2, $ids, true ));248 $this->assertContains( $id1, $ids ); 249 $this->assertContains( $id2, $ids ); 250 250 251 251 $request->set_param( 'exclude', array( $id2 ) ); … … 253 253 $data = $response->get_data(); 254 254 $ids = wp_list_pluck( $data, 'id' ); 255 $this->assert True( in_array( $id1, $ids, true ));256 $this->assert False( in_array( $id2, $ids, true ));255 $this->assertContains( $id1, $ids ); 256 $this->assertNotContains( $id2, $ids ); 257 257 258 258 // Invalid 'exclude' should error. -
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r51403 r51404 278 278 $user_ids = wp_list_pluck( $users, 'id' ); 279 279 280 $this->assert True( in_array( self::$editor, $user_ids, true ));281 $this->assert True( in_array( self::$authors['r_true_p_true'], $user_ids, true ));282 $this->assert True( in_array( self::$authors['r_true_p_false'], $user_ids, true ));280 $this->assertContains( self::$editor, $user_ids ); 281 $this->assertContains( self::$authors['r_true_p_true'], $user_ids ); 282 $this->assertContains( self::$authors['r_true_p_false'], $user_ids ); 283 283 $this->assertCount( 3, $user_ids ); 284 284 } … … 290 290 $user_ids = wp_list_pluck( $users, 'id' ); 291 291 292 $this->assert False( in_array( self::$authors['r_false_p_true'], $user_ids, true ));293 $this->assert False( in_array( self::$authors['r_false_p_false'], $user_ids, true ));292 $this->assertNotContains( self::$authors['r_false_p_true'], $user_ids ); 293 $this->assertNotContains( self::$authors['r_false_p_false'], $user_ids ); 294 294 } 295 295 … … 300 300 $user_ids = wp_list_pluck( $users, 'id' ); 301 301 302 $this->assert False( in_array( self::$draft_editor, $user_ids, true ));303 $this->assert False( in_array( self::$user, $user_ids, true ));302 $this->assertNotContains( self::$draft_editor, $user_ids ); 303 $this->assertNotContains( self::$user, $user_ids ); 304 304 } 305 305 … … 634 634 $data = $response->get_data(); 635 635 $ids = wp_list_pluck( $data, 'id' ); 636 $this->assert True( in_array( $id1, $ids, true ));637 $this->assert True( in_array( $id2, $ids, true ));636 $this->assertContains( $id1, $ids ); 637 $this->assertContains( $id2, $ids ); 638 638 639 639 $request->set_param( 'exclude', array( $id2 ) ); … … 641 641 $data = $response->get_data(); 642 642 $ids = wp_list_pluck( $data, 'id' ); 643 $this->assert True( in_array( $id1, $ids, true ));644 $this->assert False( in_array( $id2, $ids, true ));643 $this->assertContains( $id1, $ids ); 644 $this->assertNotContains( $id2, $ids ); 645 645 646 646 // Invalid 'exclude' should error. -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r51403 r51404 823 823 $cached_children = get_option( 'wptests_tax_children' ); 824 824 $this->assertNotEmpty( $cached_children[ $t ] ); 825 $this->assert True( in_array( $found['term_id'], $cached_children[ $t ], true ));825 $this->assertContains( $found['term_id'], $cached_children[ $t ] ); 826 826 } 827 827 -
trunk/tests/phpunit/tests/term/wpTaxonomy.php
r46586 r51404 23 23 24 24 $taxonomy_object->add_rewrite_rules(); 25 $this->assert False( in_array( 'foobar', $wp->public_query_vars, true ));25 $this->assertNotContains( 'foobar', $wp->public_query_vars ); 26 26 } 27 27 -
trunk/tests/phpunit/tests/term/wpUpdateTerm.php
r51331 r51404 686 686 $cached_children = get_option( 'wptests_tax_children' ); 687 687 $this->assertNotEmpty( $cached_children[ $t2 ] ); 688 $this->assert True( in_array( $found['term_id'], $cached_children[ $t2 ], true ));688 $this->assertContains( $found['term_id'], $cached_children[ $t2 ] ); 689 689 } 690 690 -
trunk/tests/phpunit/tests/theme/themeDir.php
r51403 r51404 209 209 210 210 $templates = $theme['Template Files']; 211 $this->assert True( in_array( $this->theme_root . '/page-templates/template-top-level.php', $templates, true ));211 $this->assertContains( $this->theme_root . '/page-templates/template-top-level.php', $templates ); 212 212 } 213 213 -
trunk/tests/phpunit/tests/user.php
r51397 r51404 1114 1114 ); 1115 1115 1116 $this->assert True( in_array( (string) self::$contrib_id, $users, true ));1116 $this->assertContains( (string) self::$contrib_id, $users ); 1117 1117 } 1118 1118 … … 1125 1125 ); 1126 1126 1127 $this->assert True( in_array( (string) self::$contrib_id, $users, true ));1127 $this->assertContains( (string) self::$contrib_id, $users ); 1128 1128 } 1129 1129 … … 1136 1136 ); 1137 1137 1138 $this->assert True( in_array( (string) self::$contrib_id, $users, true ));1138 $this->assertContains( (string) self::$contrib_id, $users ); 1139 1139 } 1140 1140 … … 1147 1147 ); 1148 1148 1149 $this->assert True( in_array( (string) self::$contrib_id, $users, true ));1149 $this->assertContains( (string) self::$contrib_id, $users ); 1150 1150 } 1151 1151 … … 1158 1158 ); 1159 1159 1160 $this->assert True( in_array( (string) self::$contrib_id, $users, true ));1160 $this->assertContains( (string) self::$contrib_id, $users ); 1161 1161 } 1162 1162 -
trunk/tests/phpunit/tests/wp.php
r51367 r51404 23 23 24 24 $this->assertCount( $public_qv_count + 2, $this->wp->public_query_vars ); 25 $this->assert True( in_array( 'test', $this->wp->public_query_vars, true ));26 $this->assert True( in_array( 'test2', $this->wp->public_query_vars, true ));25 $this->assertContains( 'test', $this->wp->public_query_vars ); 26 $this->assertContains( 'test2', $this->wp->public_query_vars ); 27 27 } 28 28 … … 31 31 32 32 $this->wp->add_query_var( 'test' ); 33 $this->assert True( in_array( 'test', $this->wp->public_query_vars, true ));33 $this->assertContains( 'test', $this->wp->public_query_vars ); 34 34 $this->wp->remove_query_var( 'test' ); 35 35 -
trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php
r51367 r51404 446 446 447 447 // For good measure, check that the expected value is in the array. 448 $this->assert True( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true) );448 $this->assertContains( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ); 449 449 450 450 // Attempt to add a brand new enclosure via XML-RPC. … … 456 456 // Check that the new enclosure is in the enclosure meta. 457 457 $new_enclosure_string = "{$new_enclosure['url']}\n{$new_enclosure['length']}\n{$new_enclosure['type']}\n"; 458 $this->assert True( in_array( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ), true) );458 $this->assertContains( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ) ); 459 459 460 460 // Check that the old enclosure is in the enclosure meta. 461 $this->assert True( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ), true) );461 $this->assertContains( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ); 462 462 } 463 463
Note: See TracChangeset
for help on using the changeset viewer.