Changeset 38938
- Timestamp:
- 10/26/2016 01:23:24 AM (8 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/adminbar.php
r38810 r38938 350 350 'post_author' => self::$editor_id, 351 351 'post_status' => 'publish', 352 'post_content' => rand_str(),353 'post_title' => rand_str(),352 'post_content' => 'Post Content', 353 'post_title' => 'Post Title', 354 354 ); 355 355 $id = wp_insert_post( $post ); -
trunk/tests/phpunit/tests/post/thumbnails.php
r38433 r38938 282 282 'ID' => self::$post->ID, 283 283 'post_status' => 'publish', 284 'post_content' => rand_str(),285 'post_title' => rand_str(),284 'post_content' => 'Post content', 285 'post_title' => 'Post Title', 286 286 '_thumbnail_id' => self::$attachment_id, 287 287 ) ); … … 293 293 'ID' => $post_id, 294 294 'post_status' => 'publish', 295 'post_content' => rand_str(),296 'post_title' => rand_str(),295 'post_content' => 'Post content', 296 'post_title' => 'Post Title', 297 297 '_thumbnail_id' => - 1, // -1 removes post thumbnail. 298 298 ) ); … … 310 310 'post_type' => 'attachment', 311 311 'post_status' => 'inherit', 312 'post_content' => rand_str(),313 'post_title' => rand_str(),312 'post_content' => 'Post content', 313 'post_title' => 'Post Title', 314 314 'post_mime_type' => 'audio/mpeg', 315 315 'post_parent' => 0, … … 325 325 'post_type' => 'attachment', 326 326 'post_status' => 'inherit', 327 'post_content' => rand_str(),328 'post_title' => rand_str(),327 'post_content' => 'Post content', 328 'post_title' => 'Post Title', 329 329 'post_mime_type' => 'image/jpeg', 330 330 'post_parent' => 0, -
trunk/tests/phpunit/tests/post/wpPostType.php
r37890 r38938 14 14 15 15 public function test_add_supports_defaults() { 16 $post_type = rand_str();16 $post_type = 'cpt'; 17 17 $post_type_object = new WP_Post_Type( $post_type ); 18 18 … … 28 28 29 29 public function test_add_supports_custom() { 30 $post_type = rand_str();30 $post_type = 'cpt'; 31 31 $post_type_object = new WP_Post_Type( $post_type, array( 32 32 'supports' => array( … … 57 57 global $wp; 58 58 59 $post_type = rand_str();59 $post_type = 'cpt'; 60 60 $post_type_object = new WP_Post_Type( $post_type, array( 'rewrite' => false, 'query_var' => 'foobar' ) ); 61 61 $post_type_object->add_rewrite_rules(); … … 70 70 global $wp; 71 71 72 $post_type = rand_str();72 $post_type = 'cpt'; 73 73 $post_type_object = new WP_Post_Type( $post_type, array( 74 74 'public' => true, … … 93 93 global $wp_rewrite; 94 94 95 $post_type = rand_str();95 $post_type = 'cpt'; 96 96 $post_type_object = new WP_Post_Type( $post_type, array( 'public' => true, 'rewrite' => true ) ); 97 97 … … 107 107 108 108 public function test_register_meta_boxes() { 109 $post_type = rand_str();109 $post_type = 'cpt'; 110 110 $post_type_object = new WP_Post_Type( $post_type, array( 'register_meta_box_cb' => '__return_false' ) ); 111 111 … … 120 120 121 121 public function test_adds_future_post_hook() { 122 $post_type = rand_str();122 $post_type = 'cpt'; 123 123 $post_type_object = new WP_Post_Type( $post_type ); 124 124 $post_type_object->add_hooks(); … … 134 134 global $wp_post_types; 135 135 136 $post_type = rand_str();136 $post_type = 'cpt'; 137 137 $post_type_object = new WP_Post_Type( $post_type, array( 'taxonomies' => array( 'post_tag' ) ) ); 138 138 -
trunk/tests/phpunit/tests/post/wpUniquePostSlug.php
r37443 r38938 28 28 'post_author' => $author_id, 29 29 'post_status' => 'publish', 30 'post_content' => rand_str(),30 'post_content' => 'Post content', 31 31 'post_title' => $post_title, 32 32 ); -
trunk/tests/phpunit/tests/query/conditionals.php
r38413 r38938 56 56 57 57 function test_404() { 58 $this->go_to( '/'.rand_str());58 $this->go_to( '/notapage' ); 59 59 $this->assertQueryTrue('is_404'); 60 60 } -
trunk/tests/phpunit/tests/query/metaQuery.php
r35242 r38938 391 391 public function test_meta_query_relation_or() { 392 392 $post_id = self::factory()->post->create(); 393 add_post_meta( $post_id, 'foo', rand_str() ); 394 add_post_meta( $post_id, 'foo', rand_str() ); 393 add_post_meta( $post_id, 'foo', 'foo_val_1' ); 394 add_post_meta( $post_id, 'foo', 'foo_val_2' ); 395 395 396 $post_id2 = self::factory()->post->create(); 396 add_post_meta( $post_id2, 'bar', 'val2' ); 397 add_post_meta( $post_id2, 'bar', 'bar_val_1' ); 398 397 399 $post_id3 = self::factory()->post->create(); 398 add_post_meta( $post_id3, 'baz', rand_str() ); 400 add_post_meta( $post_id3, 'baz', 'baz_val_1' ); 401 399 402 $post_id4 = self::factory()->post->create(); 400 add_post_meta( $post_id4, 'froo', rand_str() ); 403 add_post_meta( $post_id4, 'froo', 'froo_val_1' ); 404 401 405 $post_id5 = self::factory()->post->create(); 402 add_post_meta( $post_id5, 'tango', 'val2' ); 406 add_post_meta( $post_id5, 'tango', 'tango_val_1' ); 407 408 $post_id6 = self::factory()->post->create(); 409 add_post_meta( $post_id6, 'bar', 'bar_val_2' ); 410 411 $query = new WP_Query( array( 412 'update_post_meta_cache' => false, 413 'update_post_term_cache' => false, 414 'fields' => 'ids', 415 'meta_query' => array( 416 array( 417 'key' => 'foo' 418 ), 419 array( 420 'key' => 'bar', 421 'value' => 'bar_val_1' 422 ), 423 array( 424 'key' => 'baz' 425 ), 426 array( 427 'key' => 'froo' 428 ), 429 'relation' => 'OR', 430 ), 431 ) ); 432 433 $expected = array( $post_id, $post_id2, $post_id3, $post_id4 ); 434 $this->assertEqualSets( $expected, $query->posts ); 435 } 436 437 public function test_meta_query_relation_and() { 438 $post_id = self::factory()->post->create(); 439 add_post_meta( $post_id, 'foo', 'foo_val_1' ); 440 add_post_meta( $post_id, 'foo', 'foo_val_2' ); 441 442 $post_id2 = self::factory()->post->create(); 443 add_post_meta( $post_id2, 'bar', 'val_2' ); 444 add_post_meta( $post_id2, 'foo', 'foo_val_3' ); 445 446 $post_id3 = self::factory()->post->create(); 447 add_post_meta( $post_id3, 'baz', 'baz_val_1' ); 448 449 $post_id4 = self::factory()->post->create(); 450 add_post_meta( $post_id4, 'froo', 'froo_val_1' ); 451 452 $post_id5 = self::factory()->post->create(); 453 add_post_meta( $post_id5, 'tango', 'val_2' ); 454 403 455 $post_id6 = self::factory()->post->create(); 404 456 add_post_meta( $post_id6, 'bar', 'val1' ); 405 406 $query = new WP_Query( array( 407 'update_post_meta_cache' => false, 408 'update_post_term_cache' => false, 409 'fields' => 'ids', 457 add_post_meta( $post_id6, 'foo', 'foo_val_4' ); 458 459 $post_id7 = self::factory()->post->create(); 460 add_post_meta( $post_id7, 'foo', 'foo_val_5' ); 461 add_post_meta( $post_id7, 'froo', 'froo_val_2' ); 462 add_post_meta( $post_id7, 'baz', 'baz_val_2' ); 463 add_post_meta( $post_id7, 'bar', 'val_2' ); 464 465 $query = new WP_Query( array( 410 466 'meta_query' => array( 411 467 array( … … 414 470 array( 415 471 'key' => 'bar', 416 'value' => 'val2' 417 ), 418 array( 419 'key' => 'baz' 420 ), 421 array( 422 'key' => 'froo' 423 ), 424 'relation' => 'OR', 425 ), 426 ) ); 427 428 $expected = array( $post_id, $post_id2, $post_id3, $post_id4 ); 429 $this->assertEqualSets( $expected, $query->posts ); 430 } 431 432 public function test_meta_query_relation_and() { 433 $post_id = self::factory()->post->create(); 434 add_post_meta( $post_id, 'foo', rand_str() ); 435 add_post_meta( $post_id, 'foo', rand_str() ); 436 $post_id2 = self::factory()->post->create(); 437 add_post_meta( $post_id2, 'bar', 'val2' ); 438 add_post_meta( $post_id2, 'foo', rand_str() ); 439 $post_id3 = self::factory()->post->create(); 440 add_post_meta( $post_id3, 'baz', rand_str() ); 441 $post_id4 = self::factory()->post->create(); 442 add_post_meta( $post_id4, 'froo', rand_str() ); 443 $post_id5 = self::factory()->post->create(); 444 add_post_meta( $post_id5, 'tango', 'val2' ); 445 $post_id6 = self::factory()->post->create(); 446 add_post_meta( $post_id6, 'bar', 'val1' ); 447 add_post_meta( $post_id6, 'foo', rand_str() ); 448 $post_id7 = self::factory()->post->create(); 449 add_post_meta( $post_id7, 'foo', rand_str() ); 450 add_post_meta( $post_id7, 'froo', rand_str() ); 451 add_post_meta( $post_id7, 'baz', rand_str() ); 452 add_post_meta( $post_id7, 'bar', 'val2' ); 453 454 $query = new WP_Query( array( 455 'meta_query' => array( 456 array( 457 'key' => 'foo' 458 ), 459 array( 460 'key' => 'bar', 461 'value' => 'val2' 472 'value' => 'val_2' 462 473 ), 463 474 array( … … 566 577 public function test_meta_query_compare_not_exists() { 567 578 $post_id = self::factory()->post->create(); 568 add_post_meta( $post_id, 'foo', rand_str() ); 579 add_post_meta( $post_id, 'foo', 'foo_val_1' ); 580 569 581 $post_id2 = self::factory()->post->create(); 570 add_post_meta( $post_id2, 'bar', rand_str() ); 582 add_post_meta( $post_id2, 'bar', 'bar_val_1' ); 583 571 584 $post_id3 = self::factory()->post->create(); 572 add_post_meta( $post_id3, 'bar', rand_str() ); 585 add_post_meta( $post_id3, 'bar', 'bar_val_2' ); 586 573 587 $post_id4 = self::factory()->post->create(); 574 add_post_meta( $post_id4, 'baz', rand_str() ); 588 add_post_meta( $post_id4, 'baz', 'baz_val_1' ); 589 575 590 $post_id5 = self::factory()->post->create(); 576 add_post_meta( $post_id5, 'foo', rand_str());591 add_post_meta( $post_id5, 'foo', 'foo_val_2' ); 577 592 578 593 $query = new WP_Query( array( … … 1453 1468 add_post_meta( $post_id4, 'baz', 'bar' ); 1454 1469 $post_id5 = self::factory()->post->create(); 1455 add_post_meta( $post_id5, 'foo', rand_str());1470 add_post_meta( $post_id5, 'foo', 'tango' ); 1456 1471 1457 1472 $posts = get_posts( array( -
trunk/tests/phpunit/tests/user/capabilities.php
r38861 r38938 675 675 676 676 global $wp_roles; 677 $role_name = rand_str();677 $role_name = 'janitor'; 678 678 add_role( $role_name, 'Janitor', array('level_1'=>true) ); 679 679 $this->_flush_roles(); … … 715 715 716 716 global $wp_roles; 717 $role_name = rand_str();717 $role_name = 'janitor'; 718 718 add_role( $role_name, 'Janitor', array('level_1'=>true, 'sweep_floor'=>true, 'polish_doorknobs'=>true) ); 719 719 $this->_flush_roles(); -
trunk/tests/phpunit/tests/user/wpDeleteUser.php
r37954 r38938 61 61 'post_author' => $user_id, 62 62 'post_status' => 'publish', 63 'post_content' => rand_str(),64 'post_title' => rand_str(),63 'post_content' => 'Post content', 64 'post_title' => 'Post Title', 65 65 'post_type' => 'post', 66 66 ); … … 77 77 'post_author' => $user_id, 78 78 'post_status' => 'publish', 79 'post_content' => rand_str(),80 'post_title' => rand_str(),79 'post_content' => 'Post content', 80 'post_title' => 'Post Title', 81 81 'post_type' => 'nav_menu_item', 82 82 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r37914 r38938 57 57 'comment_author_url' => 'http://example.com/', 58 58 'comment_author_email' => 'example@example.com', 59 'comment_content' => rand_str( 100 ),59 'comment_content' => 'Comment content', 60 60 'comment_approved' => '1' 61 61 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php
r25002 r38938 42 42 function test_ignore_password_change() { 43 43 $this->make_user_by_role( 'author' ); 44 $new_pass = rand_str();44 $new_pass = 'newpassword'; 45 45 $new_data = array( 'password' => $new_pass ); 46 46 … … 57 57 function test_ignore_email_change() { 58 58 $editor_id = $this->make_user_by_role( 'editor' ); 59 $new_email = rand_str() . '@example.com';59 $new_email = 'notaneditor@example.com'; 60 60 $new_data = array( 'email' => $new_email ); 61 61 -
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
r38382 r38938 43 43 44 44 // make sure there's at least one category 45 $cat = wp_insert_term( 'term ' . rand_str(), 'category' );45 $cat = wp_insert_term( 'term_' . __FUNCTION__ , 'category' ); 46 46 47 47 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) ); … … 104 104 $this->make_user_by_role( 'editor' ); 105 105 106 $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ));107 $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ));106 $cat1 = wp_create_category( 'wp.getTerms_' . __FUNCTION__ . '_1' ); 107 $cat2 = wp_create_category( 'wp.getTerms_' . __FUNCTION__ . '_2' ); 108 108 109 109 self::factory()->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) ); … … 128 128 $this->make_user_by_role( 'editor' ); 129 129 130 $name = rand_str( 30 );130 $name = __FUNCTION__; 131 131 $name_id = wp_create_category( $name ); 132 132 -
trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php
r35244 r38938 57 57 $user_data = array( 58 58 'user_login' => 'getusertestuser', 59 'user_pass' => rand_str(),60 'first_name' => rand_str(),61 'last_name' => rand_str(),62 'description' => rand_str( 100 ),59 'user_pass' => 'password', 60 'first_name' => 'First', 61 'last_name' => 'Last', 62 'description' => 'I love WordPress', 63 63 'user_email' => 'getUserTestUser@example.com', 64 'nickname' => rand_str(),65 'user_nicename' => rand_str(),66 'display_name' => rand_str(),64 'nickname' => 'nickname', 65 'user_nicename' => 'nicename', 66 'display_name' => 'First Last', 67 67 'user_url' => 'http://www.example.com/testuser', 68 68 'role' => 'author', 69 'aim' => rand_str(),69 'aim' => 'wordpress', 70 70 'user_registered' => strftime( "%Y-%m-%d %H:%M:%S", $registered_date ) 71 71 ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php
r35242 r38938 48 48 grant_super_admin( $administrator_id ); 49 49 50 $filter = array( 'role' => rand_str());50 $filter = array( 'role' => 'invalidrole' ); 51 51 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) ); 52 52 $this->assertInstanceOf( 'IXR_Error', $results );
Note: See TracChangeset
for help on using the changeset viewer.