Changeset 34570 for trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
- Timestamp:
- 09/26/2015 02:48:47 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r34524 r34570 5 5 */ 6 6 class Tests_XMLRPC_wp_editComment extends WP_XMLRPC_UnitTestCase { 7 8 function test_author_can_edit_own_comment() { 9 $author_id = $this->make_user_by_role( 'author' ); 10 $post_id = $this->factory->post->create( array( 11 'post_title' => 'Post test by author', 12 'post_author' => $author_id 13 ) ); 14 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 )); 21 22 $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 23 'status' => 'hold' 24 ) ) ); 25 $this->assertNotInstanceOf( 'IXR_Error', $result ); 26 $this->assertTrue( $result ); 27 } 28 29 function test_author_cannot_edit_others_comment() { 30 $this->make_user_by_role( 'author' ); 31 $editor_id = $this->make_user_by_role( 'editor' ); 32 $post_id = $this->factory->post->create( array( 33 'post_title' => 'Post test by editor', 34 'post_author' => $editor_id 35 ) ); 36 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 ) ); 43 44 $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 'status' => 'hold' ) ) ); 45 $this->assertInstanceOf( 'IXR_Error', $result ); 46 $this->assertEquals( 403, $result->code ); 47 $this->assertEquals( __( 'You are not allowed to moderate or edit this comment.' ), $result->message ); 48 } 49 7 50 function test_trash_comment() { 8 51 $this->make_user_by_role( 'administrator' );
Note: See TracChangeset
for help on using the changeset viewer.