Ticket #21977: unittest.21977.diff
File unittest.21977.diff, 2.8 KB (added by , 12 years ago) |
---|
-
tests/xmlrpc/wp/editTerm.php
92 92 $this->make_user_by_role( 'editor' ); 93 93 94 94 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) ); 95 $this->assertInstanceOf( 'IXR_Error', $result ); 96 $this->assertEquals( 500, $result->code ); 97 $this->assertEquals( __('Empty Term'), $result->message ); 95 $this->assertNotInstanceOf( 'IXR_Error', $result ); 96 $this->assertInternalType( 'boolean', $result ); 97 98 $term = get_term( $this->child_term['term_id'], 'category' ); 99 $this->assertEquals( '0', $term->parent ); 98 100 } 99 101 102 function test_parent_null() { 103 $this->make_user_by_role( 'editor' ); 104 105 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => NULL, 'name' => 'test' ) ) ); 106 107 $this->assertNotInstanceOf( 'IXR_Error', $result ); 108 $this->assertInternalType( 'boolean', $result ); 109 110 $term = get_term( $this->child_term['term_id'], 'category' ); 111 $this->assertEquals( '0', $term->parent ); 112 } 113 100 114 function test_parent_invalid() { 101 115 $this->make_user_by_role( 'editor' ); 102 116 -
tests/xmlrpc/wp/newTerm.php
47 47 $this->assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result->message ); 48 48 } 49 49 50 function test_empty_term () {50 function test_empty_term_name() { 51 51 $this->make_user_by_role( 'editor' ); 52 52 53 53 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) ); … … 65 65 $this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message ); 66 66 } 67 67 68 function test_parent_empty() { 69 $this->make_user_by_role( 'editor' ); 70 71 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) ); 72 $this->assertNotInstanceOf( 'IXR_Error', $result ); 73 $this->assertStringMatchesFormat( '%d', $result ); 74 } 75 76 function test_parent_null() { 77 $this->make_user_by_role( 'editor' ); 78 79 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => NULL, 'name' => 'test' ) ) ); 80 $this->assertNotInstanceOf( 'IXR_Error', $result ); 81 $this->assertStringMatchesFormat( '%d', $result ); 82 } 83 68 84 function test_parent_invalid() { 69 85 $this->make_user_by_role( 'editor' ); 70 86