Changeset 42343 for trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
- Timestamp:
- 11/30/2017 11:09:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r40417 r42343 8 8 function test_author_can_edit_own_comment() { 9 9 $author_id = $this->make_user_by_role( 'author' ); 10 $post_id = self::factory()->post->create( array( 11 'post_title' => 'Post test by author', 12 'post_author' => $author_id 13 ) ); 10 $post_id = self::factory()->post->create( 11 array( 12 'post_title' => 'Post test by author', 13 'post_author' => $author_id, 14 ) 15 ); 14 16 15 $comment_id = wp_insert_comment(array( 16 'comment_post_ID' => $post_id, 17 'comment_author' => 'Commenter 1', 18 'comment_author_url' => "http://example.com/1/", 19 'comment_approved' => 1, 20 )); 17 $comment_id = wp_insert_comment( 18 array( 19 'comment_post_ID' => $post_id, 20 'comment_author' => 'Commenter 1', 21 'comment_author_url' => 'http://example.com/1/', 22 'comment_approved' => 1, 23 ) 24 ); 21 25 22 $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 23 'status' => 'hold' 24 ) ) ); 26 $result = $this->myxmlrpcserver->wp_editComment( 27 array( 28 1, 29 'author', 30 'author', 31 $comment_id, 32 array( 33 'status' => 'hold', 34 ), 35 ) 36 ); 25 37 $this->assertNotIXRError( $result ); 26 38 $this->assertTrue( $result ); … … 30 42 $this->make_user_by_role( 'author' ); 31 43 $editor_id = $this->make_user_by_role( 'editor' ); 32 $post_id = self::factory()->post->create( array( 33 'post_title' => 'Post test by editor', 34 'post_author' => $editor_id 35 ) ); 44 $post_id = self::factory()->post->create( 45 array( 46 'post_title' => 'Post test by editor', 47 'post_author' => $editor_id, 48 ) 49 ); 36 50 37 $comment_id = wp_insert_comment( array( 38 'comment_post_ID' => $post_id, 39 'comment_author' => 'Commenter 2', 40 'comment_author_url' => 'http://example.com/2/', 41 'comment_approved' => 0, 42 ) ); 51 $comment_id = wp_insert_comment( 52 array( 53 'comment_post_ID' => $post_id, 54 'comment_author' => 'Commenter 2', 55 'comment_author_url' => 'http://example.com/2/', 56 'comment_approved' => 0, 57 ) 58 ); 43 59 44 60 $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 'status' => 'hold' ) ) ); … … 53 69 54 70 $comment_data = array( 55 'comment_post_ID' => $post_id,56 'comment_author' => 'Test commenter',57 'comment_author_url' => 'http://example.com/',71 'comment_post_ID' => $post_id, 72 'comment_author' => 'Test commenter', 73 'comment_author_url' => 'http://example.com/', 58 74 'comment_author_email' => 'example@example.com', 59 'comment_content' => 'Comment content',60 'comment_approved' => '1'75 'comment_content' => 'Comment content', 76 'comment_approved' => '1', 61 77 ); 62 $comment_id = wp_insert_comment( $comment_data );78 $comment_id = wp_insert_comment( $comment_data ); 63 79 64 80 $this->assertEquals( '1', get_comment( $comment_id )->comment_approved ); 65 81 66 $this->myxmlrpcserver->wp_editComment( array( 1, 'administrator', 'administrator', $comment_id, array( 67 'status' => 'trash' 68 ) ) ); 82 $this->myxmlrpcserver->wp_editComment( 83 array( 84 1, 85 'administrator', 86 'administrator', 87 $comment_id, 88 array( 89 'status' => 'trash', 90 ), 91 ) 92 ); 69 93 70 94 $this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved );
Note: See TracChangeset
for help on using the changeset viewer.