- Timestamp:
- 09/06/2022 10:09:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php
r53909 r54090 238 238 ); 239 239 240 $password_comment = $this->factory->comment->create( $args );240 $password_comment = self::factory()->comment->create( $args ); 241 241 242 242 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 262 262 ); 263 263 264 $password_comment = $this->factory->comment->create( $args );264 $password_comment = self::factory()->comment->create( $args ); 265 265 266 266 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 285 285 ); 286 286 287 $password_comment = $this->factory->comment->create( $args );287 $password_comment = self::factory()->comment->create( $args ); 288 288 289 289 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 303 303 ); 304 304 305 $password_comment = $this->factory->comment->create( $args );305 $password_comment = self::factory()->comment->create( $args ); 306 306 307 307 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 322 322 ); 323 323 324 $password_comment = $this->factory->comment->create( $args );324 $password_comment = self::factory()->comment->create( $args ); 325 325 326 326 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 341 341 ); 342 342 343 $private_comment = $this->factory->comment->create( $args );343 $private_comment = self::factory()->comment->create( $args ); 344 344 345 345 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 360 360 ); 361 361 362 $private_comment = $this->factory->comment->create( $args );362 $private_comment = self::factory()->comment->create( $args ); 363 363 364 364 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 374 374 wp_set_current_user( 0 ); 375 375 376 $comment_id = $this->factory->comment->create(376 $comment_id = self::factory()->comment->create( 377 377 array( 378 378 'comment_approved' => 1, … … 395 395 wp_set_current_user( self::$admin_id ); 396 396 397 $comment_id = $this->factory->comment->create(397 $comment_id = self::factory()->comment->create( 398 398 array( 399 399 'comment_approved' => 1, … … 425 425 wp_set_current_user( self::$admin_id ); 426 426 427 $this->factory->comment->create_post_comments( 0, 2 );427 self::factory()->comment->create_post_comments( 0, 2 ); 428 428 429 429 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 454 454 455 455 public function test_get_items_for_post() { 456 $second_post_id = $this->factory->post->create();457 $this->factory->comment->create_post_comments( $second_post_id, 2 );456 $second_post_id = self::factory()->post->create(); 457 self::factory()->comment->create_post_comments( $second_post_id, 2 ); 458 458 459 459 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 479 479 ); 480 480 481 $id1 = $this->factory->comment->create( $args );482 $id2 = $this->factory->comment->create( $args );481 $id1 = self::factory()->comment->create( $args ); 482 $id2 = self::factory()->comment->create( $args ); 483 483 484 484 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 519 519 ); 520 520 521 $id1 = $this->factory->comment->create( $args );522 $id2 = $this->factory->comment->create( $args );521 $id1 = self::factory()->comment->create( $args ); 522 $id2 = self::factory()->comment->create( $args ); 523 523 524 524 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 575 575 ); 576 576 577 $id = $this->factory->comment->create( $args );577 $id = self::factory()->comment->create( $args ); 578 578 579 579 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 599 599 wp_set_current_user( 0 ); 600 600 601 $post_id = $this->factory->post->create( array( 'post_status' => 'private' ) );601 $post_id = self::factory()->post->create( array( 'post_status' => 'private' ) ); 602 602 603 603 $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); … … 617 617 ); 618 618 619 $this->factory->comment->create( $args );619 self::factory()->comment->create( $args ); 620 620 $args['user_id'] = self::$subscriber_id; 621 $this->factory->comment->create( $args );621 self::factory()->comment->create( $args ); 622 622 unset( $args['user_id'] ); 623 $this->factory->comment->create( $args );623 self::factory()->comment->create( $args ); 624 624 625 625 // Limit to comment author. … … 660 660 ); 661 661 662 $this->factory->comment->create( $args );662 self::factory()->comment->create( $args ); 663 663 $args['user_id'] = self::$subscriber_id; 664 $this->factory->comment->create( $args );664 self::factory()->comment->create( $args ); 665 665 unset( $args['user_id'] ); 666 $this->factory->comment->create( $args );666 self::factory()->comment->create( $args ); 667 667 668 668 $total_comments = self::$total_comments + 3; … … 710 710 'comment_post_ID' => self::$post_id, 711 711 ); 712 $parent_id = $this->factory->comment->create( $args );713 $parent_id2 = $this->factory->comment->create( $args );712 $parent_id = self::factory()->comment->create( $args ); 713 $parent_id2 = self::factory()->comment->create( $args ); 714 714 $args['comment_parent'] = $parent_id; 715 $this->factory->comment->create( $args );715 self::factory()->comment->create( $args ); 716 716 $args['comment_parent'] = $parent_id2; 717 $this->factory->comment->create( $args );717 self::factory()->comment->create( $args ); 718 718 719 719 $total_comments = self::$total_comments + 4; … … 746 746 'comment_post_ID' => self::$post_id, 747 747 ); 748 $parent_id = $this->factory->comment->create( $args );749 $parent_id2 = $this->factory->comment->create( $args );748 $parent_id = self::factory()->comment->create( $args ); 749 $parent_id2 = self::factory()->comment->create( $args ); 750 750 $args['comment_parent'] = $parent_id; 751 $this->factory->comment->create( $args );751 self::factory()->comment->create( $args ); 752 752 $args['comment_parent'] = $parent_id2; 753 $this->factory->comment->create( $args );753 self::factory()->comment->create( $args ); 754 754 755 755 $total_comments = self::$total_comments + 4; … … 787 787 ); 788 788 789 $id = $this->factory->comment->create( $args );789 $id = self::factory()->comment->create( $args ); 790 790 791 791 $total_comments = self::$total_comments + 1; … … 826 826 827 827 // 3rd page. 828 $this->factory->comment->create(828 self::factory()->comment->create( 829 829 array( 830 830 'comment_post_ID' => self::$post_id, … … 896 896 897 897 public function test_get_comments_valid_date() { 898 $comment1 = $this->factory->comment->create(898 $comment1 = self::factory()->comment->create( 899 899 array( 900 900 'comment_date' => '2016-01-15T00:00:00Z', … … 902 902 ) 903 903 ); 904 $comment2 = $this->factory->comment->create(904 $comment2 = self::factory()->comment->create( 905 905 array( 906 906 'comment_date' => '2016-01-16T00:00:00Z', … … 908 908 ) 909 909 ); 910 $comment3 = $this->factory->comment->create(910 $comment3 = self::factory()->comment->create( 911 911 array( 912 912 'comment_date' => '2016-01-17T00:00:00Z', … … 1004 1004 wp_set_current_user( 0 ); 1005 1005 1006 $comment_id = $this->factory->comment->create(1006 $comment_id = self::factory()->comment->create( 1007 1007 array( 1008 1008 'comment_approved' => 1, … … 1019 1019 wp_set_current_user( self::$admin_id ); 1020 1020 1021 $comment_id = $this->factory->comment->create(1021 $comment_id = self::factory()->comment->create( 1022 1022 array( 1023 1023 'comment_approved' => 1, … … 1048 1048 1049 1049 public function test_get_comment_with_children_link() { 1050 $comment_id_1 = $this->factory->comment->create(1050 $comment_id_1 = self::factory()->comment->create( 1051 1051 array( 1052 1052 'comment_approved' => 1, … … 1056 1056 ); 1057 1057 1058 $child_comment = $this->factory->comment->create(1058 $child_comment = self::factory()->comment->create( 1059 1059 array( 1060 1060 'comment_approved' => 1, … … 1072 1072 1073 1073 public function test_get_comment_without_children_link() { 1074 $comment_id_1 = $this->factory->comment->create(1074 $comment_id_1 = self::factory()->comment->create( 1075 1075 array( 1076 1076 'comment_approved' => 1, … … 1094 1094 ); 1095 1095 1096 $password_comment = $this->factory->comment->create( $args );1096 $password_comment = self::factory()->comment->create( $args ); 1097 1097 1098 1098 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $password_comment ) ); … … 1112 1112 ); 1113 1113 1114 $password_comment = $this->factory->comment->create( $args );1114 $password_comment = self::factory()->comment->create( $args ); 1115 1115 1116 1116 $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $password_comment ) ); … … 1491 1491 1492 1492 public function test_create_item_assign_different_user() { 1493 $subscriber_id = $this->factory->user->create(1493 $subscriber_id = self::factory()->user->create( 1494 1494 array( 1495 1495 'role' => 'subscriber', … … 1522 1522 1523 1523 public function test_create_comment_without_type() { 1524 $post_id = $this->factory->post->create();1524 $post_id = self::factory()->post->create(); 1525 1525 1526 1526 wp_set_current_user( self::$admin_id ); … … 1560 1560 */ 1561 1561 public function test_create_comment_with_invalid_type() { 1562 $post_id = $this->factory->post->create();1562 $post_id = self::factory()->post->create(); 1563 1563 1564 1564 wp_set_current_user( self::$admin_id ); … … 1584 1584 1585 1585 public function test_create_comment_invalid_email() { 1586 $post_id = $this->factory->post->create();1586 $post_id = self::factory()->post->create(); 1587 1587 1588 1588 wp_set_current_user( self::$admin_id ); … … 1607 1607 1608 1608 public function test_create_item_current_user() { 1609 $user_id = $this->factory->user->create(1609 $user_id = self::factory()->user->create( 1610 1610 array( 1611 1611 'role' => 'subscriber', … … 1729 1729 1730 1730 public function test_create_comment_with_status_IP_and_user_agent() { 1731 $post_id = $this->factory->post->create();1731 $post_id = self::factory()->post->create(); 1732 1732 1733 1733 wp_set_current_user( self::$admin_id ); … … 2007 2007 wp_set_current_user( self::$subscriber_id ); 2008 2008 2009 $this->factory->comment->create(2009 self::factory()->comment->create( 2010 2010 array( 2011 2011 'comment_post_ID' => self::$post_id, … … 2032 2032 2033 2033 public function test_create_comment_closed() { 2034 $post_id = $this->factory->post->create(2034 $post_id = self::factory()->post->create( 2035 2035 array( 2036 2036 'comment_status' => 'closed', … … 2304 2304 2305 2305 public function test_update_item() { 2306 $post_id = $this->factory->post->create();2306 $post_id = self::factory()->post->create(); 2307 2307 2308 2308 wp_set_current_user( self::$admin_id ); … … 2348 2348 update_option( 'timezone_string', $params['timezone_string'] ); 2349 2349 2350 $comment_id = $this->factory->comment->create();2350 $comment_id = self::factory()->comment->create(); 2351 2351 2352 2352 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', $comment_id ) ); … … 2375 2375 2376 2376 public function test_update_item_no_content() { 2377 $post_id = $this->factory->post->create();2377 $post_id = self::factory()->post->create(); 2378 2378 2379 2379 wp_set_current_user( self::$admin_id ); … … 2413 2413 wp_set_current_user( self::$admin_id ); 2414 2414 2415 $comment_id = $this->factory->comment->create(2415 $comment_id = self::factory()->comment->create( 2416 2416 array( 2417 2417 'comment_approved' => 0, … … 2440 2440 wp_set_current_user( self::$admin_id ); 2441 2441 2442 $comment_id = $this->factory->comment->create(2442 $comment_id = self::factory()->comment->create( 2443 2443 array( 2444 2444 'comment_approved' => 0, … … 2721 2721 2722 2722 public function test_update_comment_private_post_invalid_permission() { 2723 $private_comment_id = $this->factory->comment->create(2723 $private_comment_id = self::factory()->comment->create( 2724 2724 array( 2725 2725 'comment_approved' => 1, … … 2746 2746 wp_set_current_user( self::$admin_id ); 2747 2747 2748 $comment_id_1 = $this->factory->comment->create(2748 $comment_id_1 = self::factory()->comment->create( 2749 2749 array( 2750 2750 'comment_approved' => 1, … … 2754 2754 ); 2755 2755 2756 $child_comment = $this->factory->comment->create(2756 $child_comment = self::factory()->comment->create( 2757 2757 array( 2758 2758 'comment_approved' => 1, … … 3048 3048 wp_set_current_user( self::$admin_id ); 3049 3049 3050 $comment_id = $this->factory->comment->create(3050 $comment_id = self::factory()->comment->create( 3051 3051 array( 3052 3052 'comment_approved' => 1, … … 3068 3068 wp_set_current_user( self::$admin_id ); 3069 3069 3070 $comment_id = $this->factory->comment->create(3070 $comment_id = self::factory()->comment->create( 3071 3071 array( 3072 3072 'comment_approved' => 1, … … 3089 3089 wp_set_current_user( self::$admin_id ); 3090 3090 3091 $comment_id = $this->factory->comment->create(3091 $comment_id = self::factory()->comment->create( 3092 3092 array( 3093 3093 'comment_approved' => 1, … … 3124 3124 wp_set_current_user( self::$admin_id ); 3125 3125 3126 $comment_id_1 = $this->factory->comment->create(3126 $comment_id_1 = self::factory()->comment->create( 3127 3127 array( 3128 3128 'comment_approved' => 1, … … 3132 3132 ); 3133 3133 3134 $child_comment = $this->factory->comment->create(3134 $child_comment = self::factory()->comment->create( 3135 3135 array( 3136 3136 'comment_approved' => 1,
Note: See TracChangeset
for help on using the changeset viewer.