Changeset 39189 for trunk/tests/phpunit/tests/xmlrpc/wp/newTerm.php
- Timestamp:
- 11/10/2016 01:53:08 AM (9 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/xmlrpc/wp/newTerm.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/newTerm.php
r38078 r39189 5 5 */ 6 6 class Tests_XMLRPC_wp_newTerm extends WP_XMLRPC_UnitTestCase { 7 var $parent_term;8 7 9 function setUp() { 10 parent::setUp(); 8 protected static $parent_term_id; 11 9 12 $this->parent_term = wp_insert_term( 'parent' . rand_str(), 'category' ); 13 $this->assertInternalType( 'array', $this->parent_term ); 14 $this->parent_term = $this->parent_term['term_id']; 10 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 11 self::$parent_term_id = $factory->term->create( array( 12 'taxonomy' => 'category', 13 ) ); 15 14 } 16 15 … … 60 59 $this->make_user_by_role( 'editor' ); 61 60 62 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term, 'name' => 'test' ) ) );61 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) ); 63 62 $this->assertInstanceOf( 'IXR_Error', $result ); 64 63 $this->assertEquals( 403, $result->code ); … … 95 94 $this->make_user_by_role( 'editor' ); 96 95 97 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test' ) ) );96 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) ); 98 97 $this->assertNotInstanceOf( 'IXR_Error', $result ); 99 98 $this->assertStringMatchesFormat( '%d', $result ); … … 103 102 $this->make_user_by_role( 'editor' ); 104 103 105 $taxonomy = array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );104 $taxonomy = array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' ); 106 105 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) ); 107 106 $this->assertNotInstanceOf( 'IXR_Error', $result );
Note: See TracChangeset
for help on using the changeset viewer.