Changeset 768 in tests for trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php
- Timestamp:
- 06/30/2012 05:48:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php
r735 r768 1 1 <?php 2 2 3 class TestXMLRPCServer_wp_editTerm extends WP XMLRPCServerTestCase {3 class TestXMLRPCServer_wp_editTerm extends WP_XMLRPC_UnitTestCase { 4 4 var $parent_term; 5 5 var $child_term; … … 14 14 } 15 15 16 function tearDown() {17 parent::tearDown();18 19 wp_delete_term( $this->parent_term['term_id'], 'category' );20 wp_delete_term( $this->child_term['term_id'], 'category' );21 wp_delete_term( $this->post_tag['term_id'], 'post_tag' );22 }23 24 16 function test_invalid_username_password() { 25 17 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) ); … … 29 21 30 22 function test_empty_taxonomy() { 23 $this->make_user_by_role( 'subscriber' ); 24 31 25 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) ); 32 26 $this->assertInstanceOf( 'IXR_Error', $result ); … … 36 30 37 31 function test_invalid_taxonomy() { 32 $this->make_user_by_role( 'subscriber' ); 33 38 34 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'not_existing' ) ) ); 39 35 $this->assertInstanceOf( 'IXR_Error', $result ); … … 43 39 44 40 function test_incapable_user() { 41 $this->make_user_by_role( 'subscriber' ); 42 45 43 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'category' ) ) ); 46 44 $this->assertInstanceOf( 'IXR_Error', $result ); … … 50 48 51 49 function test_term_not_exists() { 50 $this->make_user_by_role( 'editor' ); 51 52 52 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) ); 53 53 $this->assertInstanceOf( 'IXR_Error', $result ); … … 57 57 58 58 function test_empty_term() { 59 $this->make_user_by_role( 'editor' ); 60 59 61 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) ); 60 62 $this->assertInstanceOf( 'IXR_Error', $result ); … … 64 66 65 67 function test_empty_term_name() { 68 $this->make_user_by_role( 'editor' ); 69 66 70 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->parent_term['term_id'], array( 'taxonomy' => 'category', 'name' => '' ) ) ); 67 71 $this->assertInstanceOf( 'IXR_Error', $result ); … … 71 75 72 76 function test_parent_for_nonhierarchical() { 77 $this->make_user_by_role( 'editor' ); 78 73 79 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->post_tag['term_id'], array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term['term_id'] ) ) ); 74 80 $this->assertInstanceOf( 'IXR_Error', $result ); … … 78 84 79 85 function test_parent_empty() { 86 $this->make_user_by_role( 'editor' ); 87 80 88 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) ); 81 89 $this->assertInstanceOf( 'IXR_Error', $result ); … … 85 93 86 94 function test_parent_invalid() { 95 $this->make_user_by_role( 'editor' ); 96 87 97 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) ); 88 98 $this->assertInstanceOf( 'IXR_Error', $result ); … … 91 101 92 102 function test_parent_not_existing() { 103 $this->make_user_by_role( 'editor' ); 104 93 105 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) ); 94 106 $this->assertInstanceOf( 'IXR_Error', $result ); … … 98 110 99 111 function test_parent_duplicate_slug() { 112 $this->make_user_by_role( 'editor' ); 113 100 114 $parent_term = get_term_by( 'id', $this->parent_term['term_id'], 'category' ); 101 115 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) ); … … 106 120 107 121 function test_edit_all_fields() { 122 $this->make_user_by_role( 'editor' ); 123 108 124 $fields = array( 'taxonomy' => 'category', 'name' => 'Child 2', 'parent' => $this->parent_term['term_id'], 'description' => 'Child term', 'slug' => 'child_2' ); 109 125 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], $fields ) );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)