mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
XML-RPC: in wp_xmlrpc_server::wp_editTerm(), check ! empty when applying parent logic.
Adds unit tests. Props hrishiv90, markoheijnen, sam2kb. Fixes #21977. git-svn-id: https://develop.svn.wordpress.org/trunk@34580 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -92,9 +92,20 @@ class Tests_XMLRPC_wp_editTerm extends WP_XMLRPC_UnitTestCase {
|
||||
$this->make_user_by_role( 'editor' );
|
||||
|
||||
$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
|
||||
$this->assertInstanceOf( 'IXR_Error', $result );
|
||||
$this->assertEquals( 500, $result->code );
|
||||
$this->assertEquals( __('Empty Term'), $result->message );
|
||||
$this->assertNotInstanceOf( 'IXR_Error', $result );
|
||||
$this->assertTrue( $result );
|
||||
}
|
||||
|
||||
function test_parent_null() {
|
||||
$this->make_user_by_role( 'editor' );
|
||||
|
||||
$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => NULL, 'name' => 'test' ) ) );
|
||||
|
||||
$this->assertNotInstanceOf( 'IXR_Error', $result );
|
||||
$this->assertInternalType( 'boolean', $result );
|
||||
|
||||
$term = get_term( $this->child_term['term_id'], 'category' );
|
||||
$this->assertEquals( '0', $term->parent );
|
||||
}
|
||||
|
||||
function test_parent_invalid() {
|
||||
|
||||
Reference in New Issue
Block a user