<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[768] trunk/wp-testcase/test-xmlrpc-api: Port the XML-RPC test suite.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://unit-tests.trac.wordpress.org/changeset/768">768</a></dd>
<dt>Author</dt> <dd>maxcutler</dd>
<dt>Date</dt> <dd>2012-06-30 17:48:18 +0000 (Sat, 30 Jun 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Port the XML-RPC test suite.
Fixes <a href="http://unit-tests.trac.wordpress.org/ticket/45">#45</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwptestcasetestxmlrpcapitest_mt_getRecentPostTitlesphp">trunk/wp-testcase/test-xmlrpc-api/test_mt_getRecentPostTitles.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_mw_editPostphp">trunk/wp-testcase/test-xmlrpc-api/test_mw_editPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_mw_getPostphp">trunk/wp-testcase/test-xmlrpc-api/test_mw_getPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_mw_getRecentPostsphp">trunk/wp-testcase/test-xmlrpc-api/test_mw_getRecentPosts.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_mw_newPostphp">trunk/wp-testcase/test-xmlrpc-api/test_mw_newPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_deletePostphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_deletePost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_deleteTermphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_deleteTerm.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_editPostphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_editPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_editTermphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getCommentphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getComment.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getCommentsphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getComments.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getMediaItemphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getMediaItem.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getOptionsphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getOptions.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPagephp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPage.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPageListphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPageList.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPagesphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPages.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPostphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPostTypephp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostType.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPostTypesphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostTypes.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getPostsphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getPosts.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getTaxonomiesphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomies.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getTaxonomyphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomy.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getTermphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerm.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_getTermsphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerms.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_newPostphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_newPost.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_newTermphp">trunk/wp-testcase/test-xmlrpc-api/test_wp_newTerm.php</a></li>
<li><a href="#trunkwptestcasetestxmlrpcapitest_wp_uploadFilephp">trunk/wp-testcase/test-xmlrpc-api/test_wp_uploadFile.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwptestcasetestxmlrpcapitest_mt_getRecentPostTitlesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_mt_getRecentPostTitles.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_mt_getRecentPostTitles.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_mt_getRecentPostTitles.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,33 +1,7 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-include_once(ABSPATH . WPINC . '/post-thumbnail-template.php');
</del><ins>+class TestXMLRPCServer_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><del>-class TestXMLRPCServer_mt_getRecentPostTitles extends WPXMLRPCServerTestCase {
-        var $post_data;
-        var $post_id;
-        var $post_date_ts;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => get_user_by( 'login', 'author' )->ID,
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -36,6 +10,7 @@
</span><span class="cx">
</span><span class="cx">         function test_no_posts() {
</span><span class="cx">                 $this->_delete_all_posts();
</span><ins>+                $this->make_user_by_role( 'author' );
</ins><span class="cx">
</span><span class="cx">                 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -43,24 +18,18 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_no_editable_posts() {
</span><del>-                wp_delete_post( $this->post_id );
</del><ins>+                $this->make_user_by_role( 'author' );
+                $editor = $this->make_user_by_role( 'editor' );
+                $this->factory->post->create( array( 'post_author' => $editor ) );
</ins><span class="cx">
</span><del>-                $post_data_editor = array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => get_user_by( 'login', 'editor' )->ID,
-                );
-                $post_id = wp_insert_post( $post_data_editor );
-
</del><span class="cx">                 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 0, count( $result ) );
</span><del>-
-                wp_delete_post( $post_id );
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_date() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $results );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_mw_editPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_mw_editPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_mw_editPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_mw_editPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_mw_editPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_mw_editPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $post = array();
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_edit_own_post() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -25,7 +25,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_edit_others_post() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $this->make_user_by_role( 'editor' );
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -40,7 +42,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_edit_others_post() {
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $original_title = 'Post test';
</span><span class="cx">                 $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="lines">@@ -56,11 +60,13 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_reassign_author() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><span class="cx">                 $post2 = array( 'wp_author_id' => $author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -71,11 +77,12 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_reassign_author() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><span class="cx">                 $post2 = array( 'wp_author_id' => $author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -88,7 +95,8 @@
</span><span class="cx">         function test_post_thumbnail() {
</span><span class="cx">                 add_theme_support( 'post-thumbnails' );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -140,7 +148,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_edit_basic_post_info() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Title', 'post_content' => 'Content', 'post_excerpt' => 'Excerpt', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -174,7 +183,8 @@
</span><span class="cx">
</span><span class="cx">         // Not allowed since [19914]
</span><span class="cx">         function test_change_post_type() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Title', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_mw_getPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_mw_getPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_mw_getPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_mw_getPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">
</span><span class="cx"> include_once(ABSPATH . WPINC . '/post-thumbnail-template.php');
</span><span class="cx">
</span><del>-class TestXMLRPCServer_mw_getPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_mw_getPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_data;
</span><span class="cx">         var $post_id;
</span><span class="cx">         var $post_date_ts;
</span><span class="lines">@@ -10,24 +10,18 @@
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">
</span><ins>+                $author_id = $this->make_user_by_role( 'author' );
</ins><span class="cx">                 $this->post_date_ts = strtotime( '+1 day' );
</span><span class="cx">                 $this->post_data = array(
</span><span class="cx">                         'post_title' => rand_str(),
</span><span class="cx">                         'post_content' => rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' => rand_str( 100 ),
</span><del>-                        'post_author' => get_user_by( 'login', 'author' )->ID,
</del><ins>+                        'post_author' => $author_id,
</ins><span class="cx">                         'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this->post_id = wp_insert_post( $this->post_data );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'username', 'password' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -35,6 +29,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="lines">@@ -119,7 +115,6 @@
</span><span class="cx">                 $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
</span><span class="cx">                 $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
</span><span class="cx">
</span><del>-                delete_post_thumbnail( $this->post_id );
</del><span class="cx">                 remove_theme_support( 'post-thumbnails' );
</span><span class="cx">         }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_mw_getRecentPostsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_mw_getRecentPosts.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_mw_getRecentPosts.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_mw_getRecentPosts.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">
</span><span class="cx"> include_once(ABSPATH . WPINC . '/post-thumbnail-template.php');
</span><span class="cx">
</span><del>-class TestXMLRPCServer_mw_getRecentPosts extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_mw_getRecentPosts extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_data;
</span><span class="cx">         var $post_id;
</span><span class="cx">         var $post_date_ts;
</span><span class="lines">@@ -10,24 +10,18 @@
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">
</span><ins>+                $author_id = $this->make_user_by_role( 'author' );
</ins><span class="cx">                 $this->post_date_ts = strtotime( '+1 day' );
</span><span class="cx">                 $this->post_data = array(
</span><span class="cx">                         'post_title' => rand_str(),
</span><span class="cx">                         'post_content' => rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' => rand_str( 100 ),
</span><del>-                        'post_author' => get_user_by( 'login', 'author' )->ID,
</del><ins>+                        'post_author' => $author_id,
</ins><span class="cx">                         'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this->post_id = wp_insert_post( $this->post_data );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -121,11 +115,12 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                delete_post_thumbnail( $this->post_id );
</del><span class="cx">                 remove_theme_support( 'post-thumbnails' );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_date() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $results );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_mw_newPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_mw_newPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_mw_newPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_mw_newPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_mw_newPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_mw_newPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $post = array();
</span><span class="lines">@@ -10,6 +10,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $post = array();
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -17,6 +19,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_no_content() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array();
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -25,6 +29,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_basic_content() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -32,6 +38,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_ignore_id() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'ID' => 103948 );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -39,12 +47,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_publish() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'post_status' => 'publish' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_publish() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'post_status' => 'publish' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -52,14 +64,18 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_other_author() {
</span><del>-                $other_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $this->make_user_by_role( 'editor' );
+                $other_author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_other_author() {
</span><del>-                $other_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $this->make_user_by_role( 'contributor' );
+                $other_author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -68,6 +84,8 @@
</span><span class="cx">
</span><span class="cx">         function test_invalid_author() {
</span><span class="cx">                 $this->knownWPBug( 20356 );
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -75,7 +93,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_author() {
</span><del>-                $my_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $my_author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -89,6 +108,8 @@
</span><span class="cx">         function test_post_thumbnail() {
</span><span class="cx">                 add_theme_support( 'post-thumbnails' );
</span><span class="cx">
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 // create attachment
</span><span class="cx">                 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
</span><span class="cx">                 $contents = file_get_contents( $filename );
</span><span class="lines">@@ -112,6 +133,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_set_post_type_as_page() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'post_type' => 'page' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -119,6 +142,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_set_post_type_as_page() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'title' => 'Test', 'post_type' => 'page' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_deletePostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_deletePost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_deletePost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_deletePost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_deletePost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_deletePost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
</span><span class="lines">@@ -9,25 +9,25 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_post() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 404, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><del>-                $this->_insert_quick_posts( 1 );
-                $post_id = array_pop( $this->post_ids );
</del><ins>+                $this->make_user_by_role( 'subscriber' );
+                $post_id = $this->factory->post->create();
</ins><span class="cx">
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><del>-
-                wp_delete_post( $post_id, true );
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_post_deleted() {
</span><del>-                $this->_insert_quick_posts( 1 );
-                $post_id = array_pop( $this->post_ids );
</del><ins>+                $this->make_user_by_role( 'editor' );
+                $post_id = $this->factory->post->create();
</ins><span class="cx">
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -35,7 +35,5 @@
</span><span class="cx">
</span><span class="cx">                 $post = get_post( $post_id );
</span><span class="cx">                 $this->assertEquals( 'trash', $post->post_status );
</span><del>-
-                wp_delete_post( $post_id, true );
</del><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_deleteTermphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_deleteTerm.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_deleteTerm.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_deleteTerm.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,64 +1,70 @@
</span><del>-<?php
-
-class TestXMLRPCServer_wp_deleteTerm extends WPXMLRPCServerTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this->term['term_id'], 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_empty_term() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_invalid_term() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-                $this->assertEquals( __('Invalid term ID'), $result->message );
-        }
-
-        function test_term_deleted() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertInternalType( 'boolean', $result );
-        }
-}
</del><ins>+<?php
+
+class TestXMLRPCServer_wp_deleteTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_invalid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+                $this->assertEquals( __('Invalid term ID'), $result->message );
+        }
+
+        function test_term_deleted() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertInternalType( 'boolean', $result );
+        }
+}
</ins></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_editPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_editPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_editPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_editPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_editPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_editPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
</span><span class="lines">@@ -9,7 +9,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_edit_own_post() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -24,7 +25,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_edit_others_post() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -39,7 +42,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_edit_others_post() {
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $original_title = 'Post test';
</span><span class="cx">                 $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="lines">@@ -55,11 +60,13 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_reassign_author() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><span class="cx">                 $post2 = array( 'post_author' => $author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -70,11 +77,12 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_reassign_author() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><span class="cx">                 $post2 = array( 'post_author' => $author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -87,7 +95,8 @@
</span><span class="cx">         function test_post_thumbnail() {
</span><span class="cx">                 add_theme_support( 'post-thumbnails' );
</span><span class="cx">
</span><del>-                $author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">
</span><span class="lines">@@ -152,7 +161,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_edit_custom_fields() {
</span><del>-                $contributor_id = get_user_by( 'login', 'contributor' )->ID;
</del><ins>+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
</span><span class="cx">                 $post_id = wp_insert_post( $post );
</span><span class="cx">                 $mid_edit = add_post_meta( $post_id, 'custom_field_key', '12345678' );
</span><span class="lines">@@ -185,32 +195,27 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_unsticky() {
</span><del>-                $this->author = get_user_by( 'login', 'editor' );
-                $this->_insert_quick_posts( 1 );
-                $post_id = array_pop( $this->post_ids );
</del><ins>+                $editor_id = $this->make_user_by_role( 'editor' );
+
+                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
</ins><span class="cx">                 stick_post( $post_id );
</span><span class="cx">
</span><span class="cx">                 $post2 = array( 'sticky' => false );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertFalse( is_sticky( $post_id ) );
</span><del>-
-                wp_delete_post( $post_id, true );
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_password_transition_unsticky() {
</span><span class="cx">                 // when transitioning to private status or adding a post password, post should be un-stuck
</span><del>-                $this->author = get_user_by( 'login', 'editor' );
-                $this->_insert_quick_posts( 1 );
-                $post_id = array_pop( $this->post_ids );
</del><ins>+                $editor_id = $this->make_user_by_role( 'editor' );
+                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
</ins><span class="cx">                 stick_post( $post_id );
</span><span class="cx">
</span><span class="cx">                 $post2 = array( 'post_password' => 'foobar', 'sticky' => false );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertFalse( is_sticky( $post_id ) );
</span><del>-
-                wp_delete_post( $post_id, true );
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_editTermphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_editTerm.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_editTerm extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_editTerm extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $parent_term;
</span><span class="cx">         var $child_term;
</span><span class="cx">         var $post_tag;
</span><span class="lines">@@ -13,14 +13,6 @@
</span><span class="cx">                 $this->post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this->parent_term['term_id'], 'category' );
-                wp_delete_term( $this->child_term['term_id'], 'category' );
-                wp_delete_term( $this->post_tag['term_id'], 'post_tag' );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -28,6 +20,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_taxonomy() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -35,6 +29,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_taxonomy() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'not_existing' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -42,6 +38,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'category' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="lines">@@ -49,6 +47,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_term_not_exists() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 404, $result->code );
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_term() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 500, $result->code );
</span><span class="lines">@@ -63,6 +65,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_term_name() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->parent_term['term_id'], array( 'taxonomy' => 'category', 'name' => '' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -70,6 +74,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_for_nonhierarchical() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->post_tag['term_id'], array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term['term_id'] ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -77,6 +83,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_empty() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 500, $result->code );
</span><span class="lines">@@ -84,12 +92,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_invalid() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 500, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_not_existing() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -97,6 +109,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_duplicate_slug() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $parent_term = get_term_by( 'id', $this->parent_term['term_id'], 'category' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -105,6 +119,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_edit_all_fields() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $fields = array( 'taxonomy' => 'category', 'name' => 'Child 2', 'parent' => $this->parent_term['term_id'], 'description' => 'Child term', 'slug' => 'child_2' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], $fields ) );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getCommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getComment.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getComment.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getComment.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getComment extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getComment extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_id;
</span><span class="cx">         var $parent_comment_id;
</span><span class="cx">         var $parent_comment_data;
</span><span class="lines">@@ -11,8 +11,7 @@
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">
</span><del>-                $this->_insert_quick_posts( 1 );
-                $this->post_id = $this->post_ids[0];
</del><ins>+                $this->post_id = $this->factory->post->create();
</ins><span class="cx">
</span><span class="cx">                 $this->parent_comment_data = array(
</span><span class="cx">                         'comment_post_ID' => $this->post_id,
</span><span class="lines">@@ -34,14 +33,6 @@
</span><span class="cx">                 $this->child_comment_id = wp_insert_comment( $this->child_comment_data );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_comment( $this->child_comment_id );
-                wp_delete_comment( $this->parent_comment_id );
-                wp_delete_post( $this->post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', $this->parent_comment_id ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -49,12 +40,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', $this->parent_comment_id ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_comment() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->parent_comment_id ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">
</span><span class="lines">@@ -89,6 +84,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_child_comment() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->child_comment_id ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">
</span><span class="lines">@@ -97,6 +94,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_id() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 404, $result->code );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getCommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getComments.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getComments.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getComments.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,23 +1,16 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getComments extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getComments extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_id;
</span><span class="cx">
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">
</span><del>-                $this->_insert_quick_posts( 1 );
-                $this->post_id = $this->post_ids[0];
-                $this->_insert_quick_comments( $this->post_id, 15 );
</del><ins>+                $this->post_id = $this->factory->post->create();
+                $this->factory->comment->create_post_comments( $this->post_id, 15 );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -25,12 +18,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_user() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $results );
</span><span class="cx">
</span><span class="lines">@@ -41,6 +38,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_post_filter() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array(
</span><span class="cx">                         'post_id' => $this->post_id
</span><span class="cx">                 );
</span><span class="lines">@@ -53,6 +52,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_number_filter() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array(
</span><span class="cx">                         'post_id' => $this->post_id,
</span><span class="cx">                 );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getMediaItemphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getMediaItem.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getMediaItem.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getMediaItem.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> <?php
</span><del>-class TestXMLRPCServer_wp_getMediaItem extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getMediaItem extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_id;
</span><span class="cx">         var $attachment_data;
</span><span class="cx">         var $attachment_id;
</span><span class="lines">@@ -36,12 +36,9 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function tearDown() {
</span><del>-                parent::tearDown();
-
-                wp_delete_attachment( $this->attachment_id );
-                wp_delete_post( $this->post_id );
-
</del><span class="cx">                 remove_theme_support( 'post-thumbnails' );
</span><ins>+
+                parent::tearDown();
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="lines">@@ -51,6 +48,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_media_item() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $fields = array( 'post' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getOptionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getOptions.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getOptions.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getOptions.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getOptions extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getOptions extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
</span><span class="lines">@@ -9,12 +9,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_username_password() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="cx">                 $this->assertEquals( 'WordPress', $result['software_name']['value'] );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_option_value() {
</span><ins>+                $this->make_user_by_role( 'administrator' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="cx">
</span><span class="lines">@@ -27,6 +31,8 @@
</span><span class="cx">
</span><span class="cx">                 $this->knownWPBug( 20201 );
</span><span class="cx">
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="cx">
</span><span class="lines">@@ -110,6 +116,8 @@
</span><span class="cx">         function test_option_values_admin() {
</span><span class="cx">                 global $wp_version;
</span><span class="cx">
</span><ins>+                $this->make_user_by_role( 'administrator' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator' ) );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPagephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPage.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPage.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPage.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,8 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-include_once(ABSPATH . WPINC . '/post-thumbnail-template.php');
-
-class TestXMLRPCServer_wp_getPage extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPage extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_data;
</span><span class="cx">         var $post_id;
</span><span class="cx">         var $post_date_ts;
</span><span class="lines">@@ -16,7 +14,7 @@
</span><span class="cx">                         'post_title' => rand_str(),
</span><span class="cx">                         'post_content' => rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' => rand_str( 100 ),
</span><del>-                        'post_author' => get_user_by( 'login', 'author' )->ID,
</del><ins>+                        'post_author' => $this->make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this->post_id = wp_insert_post( $this->post_data );
</span><span class="lines">@@ -37,12 +35,16 @@
</span><span class="cx">         function test_invalid_pageid() {
</span><span class="cx">                 $this->knownWPBug(20336);
</span><span class="cx">
</span><del>-                $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'author', 'author' ) );
</del><ins>+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
</ins><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 404, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_page() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">
</span><span class="lines">@@ -80,6 +82,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_date() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPageListphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPageList.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPageList.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPageList.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">
</span><span class="cx"> include_once(ABSPATH . WPINC . '/post-thumbnail-template.php');
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPageList extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPageList extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_data;
</span><span class="cx">         var $post_id;
</span><span class="cx">         var $post_date_ts;
</span><span class="lines">@@ -16,18 +16,12 @@
</span><span class="cx">                         'post_title' => rand_str(),
</span><span class="cx">                         'post_content' => rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' => rand_str( 100 ),
</span><del>-                        'post_author' => get_user_by( 'login', 'author' )->ID,
</del><ins>+                        'post_author' => $this->make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this->post_id = wp_insert_post( $this->post_data );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -35,13 +29,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-
</del><span class="cx">         function test_date() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $results );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPagesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPages.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPages.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPages.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPages extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPages extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx"> var $post_data;
</span><span class="cx"> var $post_id;
</span><span class="cx"> var $post_date_ts;
</span><span class="lines">@@ -15,19 +15,13 @@
</span><span class="cx"> 'post_title' => rand_str(),
</span><span class="cx"> 'post_content' => rand_str( 2000 ),
</span><span class="cx"> 'post_excerpt' => rand_str( 100 ),
</span><del>- 'post_author' => get_user_by( 'login', 'administrator' )->ID,
</del><ins>+ 'post_author' => $this->make_user_by_role( 'administrator' ),
</ins><span class="cx"> 'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx"> );
</span><span class="cx"> $this->post_id = wp_insert_post( $this->post_data );
</span><del>- $this->editor_id = get_user_by( 'login', 'editor' )->ID;
</del><ins>+ $this->editor_id = $this->make_user_by_role( 'editor' );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- function tearDown() {
- parent::tearDown();
-
- wp_delete_post( $this->post_id );
- }
-
</del><span class="cx"> function test_invalid_username_password() {
</span><span class="cx"> $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) );
</span><span class="cx"> $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -35,6 +29,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx"> $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) );
</span><span class="cx"> $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx"> $this->assertEquals( 401, $result->code );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $post_data;
</span><span class="cx">         var $post_id;
</span><span class="cx">         var $post_date_ts;
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">                         'post_title' => rand_str(),
</span><span class="cx">                         'post_content' => rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' => rand_str( 100 ),
</span><del>-                        'post_author' => get_user_by( 'login', 'author' )->ID,
</del><ins>+                        'post_author' => $this->make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this->post_id = wp_insert_post( $this->post_data );
</span><span class="lines">@@ -22,12 +22,6 @@
</span><span class="cx">                 $this->post_custom_field['id'] = add_post_meta( $this->post_id, $this->post_custom_field['key'], $this->post_custom_field['value'] );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPostTypephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostType.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostType.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostType.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPostType extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPostType extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $cpt_name;
</span><span class="cx">         var $cpt_args;
</span><span class="cx">
</span><span class="lines">@@ -27,23 +27,31 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_post_type_name() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_post_type_name() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_valid_type() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPostTypesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostTypes.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostTypes.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPostTypes.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPostTypes extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -8,6 +8,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="lines">@@ -15,6 +17,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_user() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span><span class="lines">@@ -22,6 +26,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_simple_filter() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertInternalType( 'array', $result );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getPostsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getPosts.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getPosts.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getPosts.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_getPosts extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_getPosts extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) );
</span><span class="lines">@@ -11,6 +11,8 @@
</span><span class="cx">         function test_incapable_user() {
</span><span class="cx">                 $this->knownWPBug( 20991 );
</span><span class="cx">
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="lines">@@ -22,17 +24,23 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_user() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_post_type() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array( 'post_type' => 'invalid_post_type_name' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_filters() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $cpt_name = 'test_wp_getposts_cpt';
</span><span class="cx">                 register_post_type( $cpt_name, array(
</span><span class="cx">                         'taxonomies' => array( 'post_tag', 'category' ),
</span><span class="lines">@@ -40,7 +48,7 @@
</span><span class="cx">                 ));
</span><span class="cx">
</span><span class="cx">                 $num_posts = 17;
</span><del>-                $this->_insert_quick_posts( $num_posts, $cpt_name );
</del><ins>+                $post_ids = $this->factory->post->create_many( $num_posts, array( 'post_type' => $cpt_name ) );
</ins><span class="cx">
</span><span class="cx">                 // get them all
</span><span class="cx">                 $filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 );
</span><span class="lines">@@ -59,14 +67,14 @@
</span><span class="cx">                         }
</span><span class="cx">                         $filter['offset'] += $filter['number'];
</span><span class="cx">                 } while ( count( $presults ) > 0 );
</span><del>-                // verify that $post_ids (populated by _insert_quick_posts) matches $posts_found
-                $this->assertEquals( 0, count( array_diff( $this->post_ids, $posts_found ) ) );
</del><ins>+                // verify that $post_ids matches $posts_found
+                $this->assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) );
</ins><span class="cx">
</span><span class="cx">                 // add comments to some of the posts
</span><del>-                $random_posts = array_rand( $this->post_ids, $num_posts / 2 );
</del><ins>+                $random_posts = array_rand( $post_ids, $num_posts / 2 );
</ins><span class="cx">                 foreach ( $random_posts as $i ) {
</span><del>-                        $post = $this->post_ids[$i];
-                        $this->_insert_quick_comments( $post, rand( 1, 20 ) );
</del><ins>+                        $post = $post_ids[$i];
+                        $this->factory->comment->create_post_comments( $post, rand( 1, 20 ) );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // get results ordered by comment count
</span><span class="lines">@@ -81,7 +89,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // set one of the posts to draft and get drafts
</span><del>-                $post = get_post( $this->post_ids[$random_posts[0]] );
</del><ins>+                $post = get_post( $post_ids[$random_posts[0]] );
</ins><span class="cx">                 $post->post_status = 'draft';
</span><span class="cx">                 wp_update_post( $post );
</span><span class="cx">                 $filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );
</span><span class="lines">@@ -92,7 +100,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_fields() {
</span><del>-                $this->_insert_quick_posts( 1 );
</del><ins>+                $this->make_user_by_role( 'editor' );
+                $this->factory->post->create();
</ins><span class="cx">
</span><span class="cx">                 // check default fields
</span><span class="cx">                 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getTaxonomiesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomies.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomies.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomies.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,15 +1,17 @@
</span><del>-<?php
-
-class TestXMLRPCServer_wp_getTaxonomies extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_taxonomy_validated() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
</del><ins>+<?php
+
+class TestXMLRPCServer_wp_getTaxonomies extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_taxonomy_validated() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getTaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomy.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomy.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getTaxonomy.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,49 +1,59 @@
</span><del>-<?php
-
-class TestXMLRPCServer_wp_getTaxonomy extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'not_existing' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_taxonomy_validated() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_prepare_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $taxonomy = get_taxonomy( 'category' );
-                $this->assertEquals( 'category', $result['name'], 'name' );
-                $this->assertEquals( true, $result['_builtin'], '_builtin' );
-                $this->assertEquals( $taxonomy->show_ui, $result['show_ui'], 'show_ui' );
-                $this->assertEquals( $taxonomy->public, $result['public'], 'public' );
-                $this->assertEquals( $taxonomy->hierarchical, $result['hierarchical'], 'hierarchical' );
-                $this->assertEquals( (array) $taxonomy->labels, $result['labels'], 'labels' );
-                $this->assertEquals( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
-                $this->assertEquals( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
-        }
</del><ins>+<?php
+
+class TestXMLRPCServer_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_taxonomy_validated() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_prepare_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $taxonomy = get_taxonomy( 'category' );
+                $this->assertEquals( 'category', $result['name'], 'name' );
+                $this->assertEquals( true, $result['_builtin'], '_builtin' );
+                $this->assertEquals( $taxonomy->show_ui, $result['show_ui'], 'show_ui' );
+                $this->assertEquals( $taxonomy->public, $result['public'], 'public' );
+                $this->assertEquals( $taxonomy->hierarchical, $result['hierarchical'], 'hierarchical' );
+                $this->assertEquals( (array) $taxonomy->labels, $result['labels'], 'labels' );
+                $this->assertEquals( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
+                $this->assertEquals( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
+        }
</ins><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getTermphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerm.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerm.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerm.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,88 +1,94 @@
</span><del>-<?php
-
-class TestXMLRPCServer_wp_getTerm extends WPXMLRPCServerTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this->term['term_id'], 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-
-        function test_empty_term() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_invalid_term() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-                $this->assertEquals( __('Invalid term ID'), $result->message );
-        }
-
-        function test_valid_term() {
-                $term = get_term( $this->term['term_id'], 'category', ARRAY_A );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
-
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $result, $term );
-
-                // Check DataTypes
-                $this->assertInternalType( 'string', $result['name'] );
-                $this->assertInternalType( 'string', $result['slug'] );
-                $this->assertInternalType( 'string', $result['taxonomy'] );
-                $this->assertInternalType( 'string', $result['description'] );
-                $this->assertInternalType( 'int', $result['count'] );
-
-                // We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
-                $this->assertStringMatchesFormat( '%d', $result['term_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['term_group'] );
-                $this->assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['parent'] );
-
-                // Check Data
-                $this->assertEquals( 0, $result['count'] );
-                $this->assertEquals( $term['name'], $result['name'] );
-                $this->assertEquals( $term['slug'], $result['slug'] );
-                $this->assertEquals( 'category', $result['taxonomy'] );
-                $this->assertEquals( $term['description'], $result['description'] );
-        }
-}
</del><ins>+<?php
+
+class TestXMLRPCServer_wp_getTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_invalid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+                $this->assertEquals( __('Invalid term ID'), $result->message );
+        }
+
+        function test_valid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $term = get_term( $this->term['term_id'], 'category', ARRAY_A );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $result, $term );
+
+                // Check DataTypes
+                $this->assertInternalType( 'string', $result['name'] );
+                $this->assertInternalType( 'string', $result['slug'] );
+                $this->assertInternalType( 'string', $result['taxonomy'] );
+                $this->assertInternalType( 'string', $result['description'] );
+                $this->assertInternalType( 'int', $result['count'] );
+
+                // We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+                $this->assertStringMatchesFormat( '%d', $result['term_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['term_group'] );
+                $this->assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['parent'] );
+
+                // Check Data
+                $this->assertEquals( 0, $result['count'] );
+                $this->assertEquals( $term['name'], $result['name'] );
+                $this->assertEquals( $term['slug'], $result['slug'] );
+                $this->assertEquals( 'category', $result['taxonomy'] );
+                $this->assertEquals( $term['description'], $result['description'] );
+        }
+}
</ins></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_getTermsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerms.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerms.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_getTerms.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,139 +1,146 @@
</span><del>-<?php
-
-class TestXMLRPCServer_wp_getTerms extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_valid_terms() {
-                // make sure there's at least one category
-                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
-
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $term ) {
-                        $this->assertInternalType( 'int', $term['count'] );
-
-                        // We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
-                        $this->assertStringMatchesFormat( '%d', $term['term_id'] );
-                        $this->assertStringMatchesFormat( '%d', $term['term_group'] );
-                        $this->assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
-                        $this->assertStringMatchesFormat( '%d', $term['parent'] );
-                }
-
-                wp_delete_term( $cat['term_id'], 'category' );
-        }
-
-        function test_custom_taxonomy() {
-                // create a taxonomy and some terms for it
-                $tax_name = 'wp_getTerms_custom_taxonomy';
-                $num_terms = 12;
-                register_taxonomy( $tax_name, 'post' );
-                for( $i = 0; $i < $num_terms; $i++ )
-                        wp_insert_term( rand_str( 10 ), $tax_name );
-
-
-                // test fetching all terms
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                $this->assertEquals( $num_terms, count( $results ) );
-                foreach ( $results as $term ) {
-                        $this->assertEquals( $tax_name, $term['taxonomy'] );
-                }
-
-                // test paged results
-                $filter = array( 'number' => 5 );
-                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertEquals( 5, count( $results2 ) );
-                $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
-
-                $filter['offset'] = 10;
-                $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
-                $this->assertEquals( $num_terms - 10, count( $results3 ) );
-                $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
-
-                // test hide_empty (since none have been attached to posts yet, all should be hidden
-                $filter = array( 'hide_empty' => true );
-                $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results4 );
-                $this->assertEquals( 0, count( $results4 ) );
-
-                unset($GLOBALS['wp_taxonomies'][$tax_name]);
-        }
-
-        function test_term_ordering() {
-                $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
-                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
-
-                $this->_insert_quick_posts( 5, 'post', array( 'post_category' => array( $cat1 ) ) );
-                $this->_insert_quick_posts( 3, 'post', array( 'post_category' => array( $cat2 ) ) );
-
-                $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertNotEquals( 0, count( $results ) );
-
-                foreach( $results as $term ) {
-                        if ( $term['term_id'] == $cat1 ) {
-                                break; // found cat1 first as expected
-                        }
-                        else if ( $term['term_id'] == $cat2 ) {
-                                $this->assertFalse( false, 'Incorrect category ordering.' );
-                        }
-                }
-
-                wp_delete_category( $cat1 );
-                wp_delete_category( $cat2 );
-        }
-
-        function test_terms_search() {
-                $name = rand_str( 30 );
-                $name_id = wp_create_category( $name );
-
-                // search by full name
-                $filter = array( 'search' => $name );
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertEquals( 1, count( $results ) );
-                $this->assertEquals( $name, $results[0]['name'] );
-                $this->assertEquals( $name_id, $results[0]['term_id'] );
-
-                // search by partial name
-                $filter = array( 'search' => substr( $name, 0, 10 ) );
-                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
-                $this->assertEquals( 1, count( $results2 ) );
-                $this->assertEquals( $name, $results2[0]['name'] );
-                $this->assertEquals( $name_id, $results2[0]['term_id'] );
-
-                wp_delete_category( $name_id );
-        }
-}
</del><ins>+<?php
+
+class TestXMLRPCServer_wp_getTerms extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_valid_terms() {
+                $this->make_user_by_role( 'editor' );
+
+                // make sure there's at least one category
+                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
+
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $term ) {
+                        $this->assertInternalType( 'int', $term['count'] );
+
+                        // We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+                        $this->assertStringMatchesFormat( '%d', $term['term_id'] );
+                        $this->assertStringMatchesFormat( '%d', $term['term_group'] );
+                        $this->assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
+                        $this->assertStringMatchesFormat( '%d', $term['parent'] );
+                }
+        }
+
+        function test_custom_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                // create a taxonomy and some terms for it
+                $tax_name = 'wp_getTerms_custom_taxonomy';
+                $num_terms = 12;
+                register_taxonomy( $tax_name, 'post' );
+                for( $i = 0; $i < $num_terms; $i++ )
+                        wp_insert_term( rand_str( 10 ), $tax_name );
+
+
+                // test fetching all terms
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                $this->assertEquals( $num_terms, count( $results ) );
+                foreach ( $results as $term ) {
+                        $this->assertEquals( $tax_name, $term['taxonomy'] );
+                }
+
+                // test paged results
+                $filter = array( 'number' => 5 );
+                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertEquals( 5, count( $results2 ) );
+                $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
+
+                $filter['offset'] = 10;
+                $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
+                $this->assertEquals( $num_terms - 10, count( $results3 ) );
+                $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
+
+                // test hide_empty (since none have been attached to posts yet, all should be hidden
+                $filter = array( 'hide_empty' => true );
+                $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results4 );
+                $this->assertEquals( 0, count( $results4 ) );
+
+                unset($GLOBALS['wp_taxonomies'][$tax_name]);
+        }
+
+        function test_term_ordering() {
+                $this->make_user_by_role( 'editor' );
+
+                $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+
+                $this->factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
+                $this->factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
+
+                $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertNotEquals( 0, count( $results ) );
+
+                foreach( $results as $term ) {
+                        if ( $term['term_id'] == $cat1 ) {
+                                break; // found cat1 first as expected
+                        }
+                        else if ( $term['term_id'] == $cat2 ) {
+                                $this->assertFalse( false, 'Incorrect category ordering.' );
+                        }
+                }
+        }
+
+        function test_terms_search() {
+                $this->make_user_by_role( 'editor' );
+
+                $name = rand_str( 30 );
+                $name_id = wp_create_category( $name );
+
+                // search by full name
+                $filter = array( 'search' => $name );
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertEquals( 1, count( $results ) );
+                $this->assertEquals( $name, $results[0]['name'] );
+                $this->assertEquals( $name_id, $results[0]['term_id'] );
+
+                // search by partial name
+                $filter = array( 'search' => substr( $name, 0, 10 ) );
+                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
+                $this->assertEquals( 1, count( $results2 ) );
+                $this->assertEquals( $name, $results2[0]['name'] );
+                $this->assertEquals( $name_id, $results2[0]['term_id'] );
+        }
+}
</ins></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_newPostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_newPost.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_newPost.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_newPost.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_newPost extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_newPost extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">
</span><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) );
</span><span class="lines">@@ -9,12 +9,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_no_content() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 500, $result->code );
</span><span class="lines">@@ -22,6 +26,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_basic_content() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -29,6 +35,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_ignore_id() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'ID' => 103948 );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -36,12 +44,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_publish() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_publish() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -49,12 +61,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_private() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_private() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -62,14 +78,18 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_other_author() {
</span><del>-                $other_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $other_author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_other_author() {
</span><del>-                $other_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $other_author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -77,6 +97,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_author() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_author' => 99999999 );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -84,7 +106,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_author() {
</span><del>-                $my_author_id = get_user_by( 'login', 'author' )->ID;
</del><ins>+                $my_author_id = $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -98,6 +121,8 @@
</span><span class="cx">         function test_post_thumbnail() {
</span><span class="cx">                 add_theme_support( 'post-thumbnails' );
</span><span class="cx">
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 // create attachment
</span><span class="cx">                 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
</span><span class="cx">                 $contents = file_get_contents( $filename );
</span><span class="lines">@@ -121,6 +146,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_post_status() {
</span><ins>+                $this->make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -128,6 +155,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_sticky() {
</span><ins>+                $this->make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'sticky' => true );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -135,6 +164,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_capable_sticky() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'sticky' => true );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -142,6 +173,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_private_sticky() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -149,6 +182,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_post_format() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_format' => 'quote' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -156,6 +191,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_post_format() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -163,6 +200,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_taxonomy() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array(
</span><span class="cx">                         'post_title' => 'Test',
</span><span class="cx">                         'terms' => array(
</span><span class="lines">@@ -185,6 +224,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_term_id() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array(
</span><span class="cx">                         'post_title' => 'Test',
</span><span class="cx">                         'terms' => array(
</span><span class="lines">@@ -197,6 +238,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_terms() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $tag1 = wp_create_tag ( rand_str( 30 ) );
</span><span class="cx">                 $tag2 = wp_create_tag ( rand_str( 30 ) );
</span><span class="cx">                 $tag3 = wp_create_tag ( rand_str( 30 ) );
</span><span class="lines">@@ -217,6 +260,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_terms_names() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $ambiguous_name = rand_str( 30 );
</span><span class="cx">                 $parent_cat = wp_create_category( $ambiguous_name );
</span><span class="cx">                 $child_cat = wp_create_category( $ambiguous_name, $parent_cat );
</span><span class="lines">@@ -252,12 +297,6 @@
</span><span class="cx">                 $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result2 );
</span><span class="cx">                 $this->assertEquals( 401, $result2->code );
</span><del>-
-                // cleanup
-                wp_delete_term( $child_cat, 'category' );
-                wp_delete_term( $cat1, 'category' );
-                wp_delete_term( $cat2->term_id, 'category' );
-                wp_delete_term( $parent_cat, 'category' );
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_newTermphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_newTerm.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_newTerm.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_newTerm.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,24 +1,15 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_newTerm extends WPXMLRPCServerTestCase {
-        var $term_ids = array();
</del><ins>+class TestXMLRPCServer_wp_newTerm extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         var $parent_term;
</span><span class="cx">
</span><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><del>-                $this->term_ids = array();
</del><ins>+
</ins><span class="cx">                 $this->parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
</span><span class="cx">                 $this->parent_term = $this->parent_term['term_id'];
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this->parent_term, 'category' );
-                foreach ( $this->term_ids as $term_id )
-                        wp_delete_term( $term_id, 'category' );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="lines">@@ -26,20 +17,26 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_taxonomy() {
</span><del>-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => '' ) ) );
</del><ins>+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) );
</ins><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="cx">                 $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_invalid_taxonomy() {
</span><del>-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'not_existing' ) ) );
</del><ins>+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) );
</ins><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="cx">                 $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this->make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 401, $result->code );
</span><span class="lines">@@ -47,6 +44,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_empty_term() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -54,6 +53,8 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_for_nonhierarchical() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -61,12 +62,16 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_invalid() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 500, $result->code );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_parent_not_existing() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertEquals( 403, $result->code );
</span><span class="lines">@@ -75,27 +80,27 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">         function test_add_term() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this->term_ids[] = $result;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_add_term_with_parent() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this->term_ids[] = $result;
</del><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function test_add_term_with_all() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $taxonomy = array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
</span><span class="cx">                 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
</span><span class="cx">                 $this->assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this->assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this->term_ids[] = $result;
</del><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwptestcasetestxmlrpcapitest_wp_uploadFilephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-testcase/test-xmlrpc-api/test_wp_uploadFile.php (767 => 768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-testcase/test-xmlrpc-api/test_wp_uploadFile.php        2012-06-30 17:47:33 UTC (rev 767)
+++ trunk/wp-testcase/test-xmlrpc-api/test_wp_uploadFile.php        2012-06-30 17:48:18 UTC (rev 768)
</span><span class="lines">@@ -1,7 +1,9 @@
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-class TestXMLRPCServer_wp_uploadFile extends WPXMLRPCServerTestCase {
</del><ins>+class TestXMLRPCServer_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
</ins><span class="cx">         function test_valid_attachment() {
</span><ins>+                $this->make_user_by_role( 'editor' );
+
</ins><span class="cx">                 // create attachment
</span><span class="cx">                 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
</span><span class="cx">                 $contents = file_get_contents( $filename );
</span></span></pre>
</div>
</div>
</body>
</html>