Comments: In get_comment_statuses()
, also return trash
.
XML-RPC: In `wp_xmlrpc_server::wp_editComment()`, allow comments to be trashed. Introduce unit tests for `wp_editComment` in `xmlrpc/*` #NeverForget Props tyxla, wonderboymusic. Fixes #30965. git-svn-id: https://develop.svn.wordpress.org/trunk@34524 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
15935e0aed
commit
3e46dd8b92
@ -237,6 +237,8 @@ function get_comment_statuses() {
|
|||||||
'approve' => _x('Approved', 'adjective'),
|
'approve' => _x('Approved', 'adjective'),
|
||||||
/* translators: comment status */
|
/* translators: comment status */
|
||||||
'spam' => _x('Spam', 'adjective'),
|
'spam' => _x('Spam', 'adjective'),
|
||||||
|
/* translators: comment status */
|
||||||
|
'trash' => _x('Trash', 'adjective'),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
|
29
tests/phpunit/tests/xmlrpc/wp/editComment.php
Normal file
29
tests/phpunit/tests/xmlrpc/wp/editComment.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group xmlrpc
|
||||||
|
*/
|
||||||
|
class Tests_XMLRPC_wp_editComment extends WP_XMLRPC_UnitTestCase {
|
||||||
|
function test_trash_comment() {
|
||||||
|
$this->make_user_by_role( 'administrator' );
|
||||||
|
$post_id = $this->factory->post->create();
|
||||||
|
|
||||||
|
$comment_data = array(
|
||||||
|
'comment_post_ID' => $post_id,
|
||||||
|
'comment_author' => 'Test commenter',
|
||||||
|
'comment_author_url' => 'http://example.com/',
|
||||||
|
'comment_author_email' => 'example@example.com',
|
||||||
|
'comment_content' => rand_str( 100 ),
|
||||||
|
'comment_approved' => '1'
|
||||||
|
);
|
||||||
|
$comment_id = wp_insert_comment( $comment_data );
|
||||||
|
|
||||||
|
$this->assertEquals( '1', get_comment( $comment_id )->comment_approved );
|
||||||
|
|
||||||
|
$this->myxmlrpcserver->wp_editComment( array( 1, 'administrator', 'administrator', $comment_id, array(
|
||||||
|
'status' => 'trash'
|
||||||
|
) ) );
|
||||||
|
|
||||||
|
$this->assertEquals( 'trash', get_comment( $comment_id )->comment_approved );
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user