<!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"> &lt;?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-&gt;post_date_ts = strtotime( '+1 day' );
-                $this-&gt;post_data = array(
-                        'post_title' =&gt; rand_str(),
-                        'post_content' =&gt; rand_str( 2000 ),
-                        'post_excerpt' =&gt; rand_str( 100 ),
-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
-                        'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
-                );
-                $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this-&gt;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-&gt;_delete_all_posts();
</span><ins>+                $this-&gt;make_user_by_role( 'author' );
</ins><span class="cx"> 
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this-&gt;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-&gt;post_id );
</del><ins>+                $this-&gt;make_user_by_role( 'author' );
+                $editor = $this-&gt;make_user_by_role( 'editor' );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor ) );
</ins><span class="cx"> 
</span><del>-                $post_data_editor = array(
-                        'post_title' =&gt; rand_str(),
-                        'post_content' =&gt; rand_str( 2000 ),
-                        'post_excerpt' =&gt; rand_str( 100 ),
-                        'post_author' =&gt; get_user_by( 'login', 'editor' )-&gt;ID,
-                );
-                $post_id = wp_insert_post( $post_data_editor );
-
</del><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $results = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $original_title = 'Post test';
</span><span class="cx">                 $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><span class="cx">                 $post2 = array( 'wp_author_id' =&gt; $author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><span class="cx">                 $post2 = array( 'wp_author_id' =&gt; $author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Title', 'post_content' =&gt; 'Content', 'post_excerpt' =&gt; 'Excerpt', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Title', 'post_author' =&gt; $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-&gt;make_user_by_role( 'author' );
</ins><span class="cx">                 $this-&gt;post_date_ts = strtotime( '+1 day' );
</span><span class="cx">                 $this-&gt;post_data = array(
</span><span class="cx">                         'post_title' =&gt; rand_str(),
</span><span class="cx">                         'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
</del><ins>+                        'post_author' =&gt; $author_id,
</ins><span class="cx">                         'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'username', 'password' ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;code );
</span><span class="lines">@@ -119,7 +115,6 @@
</span><span class="cx">                 $this-&gt;assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
</span><span class="cx">                 $this-&gt;assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
</span><span class="cx"> 
</span><del>-                delete_post_thumbnail( $this-&gt;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-&gt;make_user_by_role( 'author' );
</ins><span class="cx">                 $this-&gt;post_date_ts = strtotime( '+1 day' );
</span><span class="cx">                 $this-&gt;post_data = array(
</span><span class="cx">                         'post_title' =&gt; rand_str(),
</span><span class="cx">                         'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
</del><ins>+                        'post_author' =&gt; $author_id,
</ins><span class="cx">                         'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this-&gt;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-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $post = array();
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array();
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'ID' =&gt; 103948 );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_publish() {
</span><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;knownWPBug( 20356 );
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; 99999999 );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $my_author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 404, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_user() {
</span><del>-                $this-&gt;_insert_quick_posts( 1 );
-                $post_id = array_pop( $this-&gt;post_ids );
</del><ins>+                $this-&gt;make_user_by_role( 'subscriber' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
</ins><span class="cx"> 
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;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-&gt;_insert_quick_posts( 1 );
-                $post_id = array_pop( $this-&gt;post_ids );
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
</ins><span class="cx"> 
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
</span><span class="cx">                 $this-&gt;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-&gt;assertEquals( 'trash', $post-&gt;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>-&lt;?php
-
-class TestXMLRPCServer_wp_deleteTerm extends WPXMLRPCServerTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this-&gt;term['term_id'], 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_incapable_user() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this-&gt;term['term_id'] ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-        function test_empty_term() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
-        }
-
-        function test_invalid_term() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-                $this-&gt;assertEquals( __('Invalid term ID'), $result-&gt;message );
-        }
-
-        function test_term_deleted() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this-&gt;term['term_id'] ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertInternalType( 'boolean', $result );
-        }
-}
</del><ins>+&lt;?php
+
+class TestXMLRPCServer_wp_deleteTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_empty_taxonomy() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this-&gt;term['term_id'] ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+        function test_empty_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
+        }
+
+        function test_invalid_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+                $this-&gt;assertEquals( __('Invalid term ID'), $result-&gt;message );
+        }
+
+        function test_term_deleted() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this-&gt;term['term_id'] ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $original_title = 'Post test';
</span><span class="cx">                 $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><span class="cx">                 $post2 = array( 'post_author' =&gt; $author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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' )-&gt;ID;
</del><span class="cx">                 $post2 = array( 'post_author' =&gt; $author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $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' )-&gt;ID;
</del><ins>+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $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-&gt;author = get_user_by( 'login', 'editor' );
-                $this-&gt;_insert_quick_posts( 1 );
-                $post_id = array_pop( $this-&gt;post_ids );
</del><ins>+                $editor_id = $this-&gt;make_user_by_role( 'editor' );
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
</ins><span class="cx">                 stick_post( $post_id );
</span><span class="cx"> 
</span><span class="cx">                 $post2 = array( 'sticky' =&gt; false );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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-&gt;author = get_user_by( 'login', 'editor' );
-                $this-&gt;_insert_quick_posts( 1 );
-                $post_id = array_pop( $this-&gt;post_ids );
</del><ins>+                $editor_id = $this-&gt;make_user_by_role( 'editor' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
</ins><span class="cx">                 stick_post( $post_id );
</span><span class="cx"> 
</span><span class="cx">                 $post2 = array( 'post_password' =&gt; 'foobar',  'sticky' =&gt; false );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;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-&gt;parent_term['term_id'], 'category' );
-                wp_delete_term( $this-&gt;child_term['term_id'], 'category' );
-                wp_delete_term( $this-&gt;post_tag['term_id'], 'post_tag' );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' =&gt; '' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'not_existing' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' =&gt; 'category' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 404, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' =&gt; 'category' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 500, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;post_tag['term_id'], array( 'taxonomy' =&gt; 'post_tag', 'parent' =&gt; $this-&gt;parent_term['term_id'] ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], array( 'taxonomy' =&gt; 'category', 'parent' =&gt; '', 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 500, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 'dasda', 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 500, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_parent_not_existing() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 9999, 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $parent_term = get_term_by( 'id', $this-&gt;parent_term['term_id'], 'category' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], array( 'taxonomy' =&gt; 'category', 'slug' =&gt; $parent_term-&gt;slug ) ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $fields = array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'Child 2', 'parent' =&gt; $this-&gt;parent_term['term_id'], 'description' =&gt; 'Child term', 'slug' =&gt; 'child_2' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;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"> &lt;?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-&gt;_insert_quick_posts( 1 );
-                $this-&gt;post_id = $this-&gt;post_ids[0];
</del><ins>+                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create();
</ins><span class="cx"> 
</span><span class="cx">                 $this-&gt;parent_comment_data = array(
</span><span class="cx">                         'comment_post_ID' =&gt; $this-&gt;post_id,
</span><span class="lines">@@ -34,14 +33,6 @@
</span><span class="cx">                 $this-&gt;child_comment_id = wp_insert_comment( $this-&gt;child_comment_data );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_comment( $this-&gt;child_comment_id );
-                wp_delete_comment( $this-&gt;parent_comment_id );
-                wp_delete_post( $this-&gt;post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'username', 'password', $this-&gt;parent_comment_id ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'contributor', 'contributor', $this-&gt;parent_comment_id ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_valid_comment() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;parent_comment_id ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;child_comment_id ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 404, $result-&gt;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"> &lt;?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-&gt;_insert_quick_posts( 1 );
-                $this-&gt;post_id = $this-&gt;post_ids[0];
-                $this-&gt;_insert_quick_comments( $this-&gt;post_id, 15 );
</del><ins>+                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $this-&gt;post_id, 15 );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'username', 'password', array() ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_capable_user() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', array() ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array(
</span><span class="cx">                         'post_id' =&gt; $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array(
</span><span class="cx">                         'post_id' =&gt; $this-&gt;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"> &lt;?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-&gt;attachment_id );
-                wp_delete_post( $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $fields = array( 'post' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getMediaItem( array( 1, 'author', 'author', $this-&gt;attachment_id, $fields ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this-&gt;assertInternalType( 'array', $result );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'administrator' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
</span><span class="cx">                 $this-&gt;assertInternalType( 'array', $result );
</span><span class="cx"> 
</span><span class="lines">@@ -27,6 +31,8 @@
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;knownWPBug( 20201 );
</span><span class="cx"> 
</span><ins>+                $this-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'administrator' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator' ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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' =&gt; rand_str(),
</span><span class="cx">                         'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
</del><ins>+                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><span class="lines">@@ -37,12 +35,16 @@
</span><span class="cx">         function test_invalid_pageid() {
</span><span class="cx">                 $this-&gt;knownWPBug(20336);
</span><span class="cx"> 
</span><del>-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, 9999, 'author', 'author' ) );
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
</ins><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 404, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_valid_page() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;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' =&gt; rand_str(),
</span><span class="cx">                         'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
</del><ins>+                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'username', 'password' ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'contributor', 'contributor' ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">         function test_date() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $results = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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' =&gt; rand_str(),
</span><span class="cx">             'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">             'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-            'post_author' =&gt; get_user_by( 'login', 'administrator' )-&gt;ID,
</del><ins>+            'post_author' =&gt; $this-&gt;make_user_by_role( 'administrator' ),
</ins><span class="cx">             'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">         );
</span><span class="cx">         $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><del>-        $this-&gt;editor_id = get_user_by( 'login', 'editor' )-&gt;ID;
</del><ins>+        $this-&gt;editor_id = $this-&gt;make_user_by_role( 'editor' );
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    function tearDown() {
-        parent::tearDown();
-
-        wp_delete_post( $this-&gt;post_id );
-    }
-
</del><span class="cx">     function test_invalid_username_password() {
</span><span class="cx">         $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'username', 'password' ) );
</span><span class="cx">         $this-&gt;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-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">         $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'contributor', 'contributor' ) );
</span><span class="cx">         $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         $this-&gt;assertEquals( 401, $result-&gt;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"> &lt;?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' =&gt; rand_str(),
</span><span class="cx">                         'post_content' =&gt; rand_str( 2000 ),
</span><span class="cx">                         'post_excerpt' =&gt; rand_str( 100 ),
</span><del>-                        'post_author' =&gt; get_user_by( 'login', 'author' )-&gt;ID,
</del><ins>+                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
</ins><span class="cx">                         'post_date'  =&gt; strftime( &quot;%Y-%m-%d %H:%M:%S&quot;, $this-&gt;post_date_ts ),
</span><span class="cx">                 );
</span><span class="cx">                 $this-&gt;post_id = wp_insert_post( $this-&gt;post_data );
</span><span class="lines">@@ -22,12 +22,6 @@
</span><span class="cx">                 $this-&gt;post_custom_field['id'] = add_post_meta( $this-&gt;post_id, $this-&gt;post_custom_field['key'], $this-&gt;post_custom_field['value'] );
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this-&gt;post_id );
-        }
-
</del><span class="cx">         function test_invalid_username_password() {
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'username', 'password', 1 ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_valid_post_type_name() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_valid_type() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', $this-&gt;cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' =&gt; true ) ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;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-&gt;knownWPBug( 20991 );
</span><span class="cx"> 
</span><ins>+                $this-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor' ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_invalid_post_type() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $filter = array( 'post_type' =&gt; 'invalid_post_type_name' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_filters() {
</span><ins>+                $this-&gt;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' =&gt; 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-&gt;_insert_quick_posts( $num_posts, $cpt_name );
</del><ins>+                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( $num_posts, array( 'post_type' =&gt; $cpt_name ) );
</ins><span class="cx"> 
</span><span class="cx">                 // get them all
</span><span class="cx">                 $filter = array( 'post_type' =&gt; $cpt_name, 'number' =&gt; $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 ) &gt; 0 );
</span><del>-                // verify that $post_ids (populated by _insert_quick_posts) matches $posts_found
-                $this-&gt;assertEquals( 0, count( array_diff( $this-&gt;post_ids, $posts_found ) ) );
</del><ins>+                // verify that $post_ids matches $posts_found
+                $this-&gt;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-&gt;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-&gt;post_ids[$i];
-                        $this-&gt;_insert_quick_comments( $post, rand( 1, 20 ) );
</del><ins>+                        $post = $post_ids[$i];
+                        $this-&gt;factory-&gt;comment-&gt;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-&gt;post_ids[$random_posts[0]] );
</del><ins>+                $post = get_post( $post_ids[$random_posts[0]] );
</ins><span class="cx">                 $post-&gt;post_status = 'draft';
</span><span class="cx">                 wp_update_post( $post );
</span><span class="cx">                 $filter3 = array( 'post_type' =&gt; $cpt_name, 'post_status' =&gt; '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-&gt;_insert_quick_posts( 1 );
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+                $this-&gt;factory-&gt;post-&gt;create();
</ins><span class="cx"> 
</span><span class="cx">                 // check default fields
</span><span class="cx">                 $results = $this-&gt;myxmlrpcserver-&gt;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>-&lt;?php
-
-class TestXMLRPCServer_wp_getTaxonomies extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomies( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_taxonomy_validated() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
</del><ins>+&lt;?php
+
+class TestXMLRPCServer_wp_getTaxonomies extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomies( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_taxonomy_validated() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
+                $this-&gt;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>-&lt;?php
-
-class TestXMLRPCServer_wp_getTaxonomy extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', '' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'not_existing' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_incapable_user() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-        function test_taxonomy_validated() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_prepare_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $taxonomy = get_taxonomy( 'category' );
-                $this-&gt;assertEquals( 'category', $result['name'], 'name' );
-                $this-&gt;assertEquals( true, $result['_builtin'], '_builtin' );
-                $this-&gt;assertEquals( $taxonomy-&gt;show_ui, $result['show_ui'], 'show_ui' );
-                $this-&gt;assertEquals( $taxonomy-&gt;public, $result['public'], 'public' );
-                $this-&gt;assertEquals( $taxonomy-&gt;hierarchical, $result['hierarchical'], 'hierarchical' );
-                $this-&gt;assertEquals( (array) $taxonomy-&gt;labels, $result['labels'], 'labels' );
-                $this-&gt;assertEquals( (array) $taxonomy-&gt;cap, $result['cap'], 'capabilities' );
-                $this-&gt;assertEquals( (array) $taxonomy-&gt;object_type, $result['object_type'], 'object_types' );
-        }
</del><ins>+&lt;?php
+
+class TestXMLRPCServer_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_empty_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+        function test_taxonomy_validated() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_prepare_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $taxonomy = get_taxonomy( 'category' );
+                $this-&gt;assertEquals( 'category', $result['name'], 'name' );
+                $this-&gt;assertEquals( true, $result['_builtin'], '_builtin' );
+                $this-&gt;assertEquals( $taxonomy-&gt;show_ui, $result['show_ui'], 'show_ui' );
+                $this-&gt;assertEquals( $taxonomy-&gt;public, $result['public'], 'public' );
+                $this-&gt;assertEquals( $taxonomy-&gt;hierarchical, $result['hierarchical'], 'hierarchical' );
+                $this-&gt;assertEquals( (array) $taxonomy-&gt;labels, $result['labels'], 'labels' );
+                $this-&gt;assertEquals( (array) $taxonomy-&gt;cap, $result['cap'], 'capabilities' );
+                $this-&gt;assertEquals( (array) $taxonomy-&gt;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>-&lt;?php
-
-class TestXMLRPCServer_wp_getTerm extends WPXMLRPCServerTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this-&gt;term['term_id'], 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_incapable_user() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this-&gt;term['term_id'] ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-
-        function test_empty_term() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
-        }
-
-        function test_invalid_term() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-                $this-&gt;assertEquals( __('Invalid term ID'), $result-&gt;message );
-        }
-
-        function test_valid_term() {
-                $term = get_term( $this-&gt;term['term_id'], 'category', ARRAY_A );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', $this-&gt;term['term_id'] ) );
-
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $result, $term );
-
-                // Check DataTypes
-                $this-&gt;assertInternalType( 'string', $result['name'] );
-                $this-&gt;assertInternalType( 'string', $result['slug'] );
-                $this-&gt;assertInternalType( 'string', $result['taxonomy'] );
-                $this-&gt;assertInternalType( 'string', $result['description'] );
-                $this-&gt;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-&gt;assertStringMatchesFormat( '%d', $result['term_id'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['term_group'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['parent'] );
-
-                // Check Data
-                $this-&gt;assertEquals( 0, $result['count'] );
-                $this-&gt;assertEquals( $term['name'], $result['name'] );
-                $this-&gt;assertEquals( $term['slug'], $result['slug'] );
-                $this-&gt;assertEquals( 'category', $result['taxonomy'] );
-                $this-&gt;assertEquals( $term['description'], $result['description'] );
-        }
-}
</del><ins>+&lt;?php
+
+class TestXMLRPCServer_wp_getTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_empty_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this-&gt;term['term_id'] ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+
+        function test_empty_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
+        }
+
+        function test_invalid_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+                $this-&gt;assertEquals( __('Invalid term ID'), $result-&gt;message );
+        }
+
+        function test_valid_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $term = get_term( $this-&gt;term['term_id'], 'category', ARRAY_A );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerm( array( 1, 'editor', 'editor', 'category', $this-&gt;term['term_id'] ) );
+
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $result, $term );
+
+                // Check DataTypes
+                $this-&gt;assertInternalType( 'string', $result['name'] );
+                $this-&gt;assertInternalType( 'string', $result['slug'] );
+                $this-&gt;assertInternalType( 'string', $result['taxonomy'] );
+                $this-&gt;assertInternalType( 'string', $result['description'] );
+                $this-&gt;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-&gt;assertStringMatchesFormat( '%d', $result['term_id'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['term_group'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['parent'] );
+
+                // Check Data
+                $this-&gt;assertEquals( 0, $result['count'] );
+                $this-&gt;assertEquals( $term['name'], $result['name'] );
+                $this-&gt;assertEquals( $term['slug'], $result['slug'] );
+                $this-&gt;assertEquals( 'category', $result['taxonomy'] );
+                $this-&gt;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>-&lt;?php
-
-class TestXMLRPCServer_wp_getTerms extends WPXMLRPCServerTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'username', 'password', 'category' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_empty_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', '' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_invalid_taxonomy() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
-        }
-
-        function test_incapable_user() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-        function test_valid_terms() {
-                // make sure there's at least one category
-                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
-
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $term ) {
-                        $this-&gt;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-&gt;assertStringMatchesFormat( '%d', $term['term_id'] );
-                        $this-&gt;assertStringMatchesFormat( '%d', $term['term_group'] );
-                        $this-&gt;assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
-                        $this-&gt;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 &lt; $num_terms; $i++ )
-                        wp_insert_term( rand_str( 10 ), $tax_name );
-
-
-                // test fetching all terms
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                $this-&gt;assertEquals( $num_terms, count( $results ) );
-                foreach ( $results as $term ) {
-                        $this-&gt;assertEquals( $tax_name, $term['taxonomy'] );
-                }
-
-                // test paged results
-                $filter = array( 'number' =&gt; 5 );
-                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-                $this-&gt;assertEquals( 5, count( $results2 ) );
-                $this-&gt;assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
-
-                $filter['offset'] = 10;
-                $results3 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results3 );
-                $this-&gt;assertEquals( $num_terms - 10, count( $results3 ) );
-                $this-&gt;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' =&gt; true );
-                $results4 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results4 );
-                $this-&gt;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-&gt;_insert_quick_posts( 5, 'post', array( 'post_category' =&gt; array( $cat1 ) ) );
-                $this-&gt;_insert_quick_posts( 3, 'post', array( 'post_category' =&gt; array( $cat2 ) ) );
-
-                $filter = array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC' );
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-                $this-&gt;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-&gt;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' =&gt; $name );
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-                $this-&gt;assertEquals( 1, count( $results ) );
-                $this-&gt;assertEquals( $name, $results[0]['name'] );
-                $this-&gt;assertEquals( $name_id, $results[0]['term_id'] );
-
-                // search by partial name
-                $filter = array( 'search' =&gt; substr( $name, 0, 10 ) );
-                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
-                $this-&gt;assertEquals( 1, count( $results2 ) );
-                $this-&gt;assertEquals( $name, $results2[0]['name'] );
-                $this-&gt;assertEquals( $name_id, $results2[0]['term_id'] );
-
-                wp_delete_category( $name_id );
-        }
-}
</del><ins>+&lt;?php
+
+class TestXMLRPCServer_wp_getTerms extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'username', 'password', 'category' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_empty_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', '' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+        function test_valid_terms() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                // make sure there's at least one category
+                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
+
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $term ) {
+                        $this-&gt;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-&gt;assertStringMatchesFormat( '%d', $term['term_id'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $term['term_group'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $term['parent'] );
+                }
+        }
+
+        function test_custom_taxonomy() {
+                $this-&gt;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 &lt; $num_terms; $i++ )
+                        wp_insert_term( rand_str( 10 ), $tax_name );
+
+
+                // test fetching all terms
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                $this-&gt;assertEquals( $num_terms, count( $results ) );
+                foreach ( $results as $term ) {
+                        $this-&gt;assertEquals( $tax_name, $term['taxonomy'] );
+                }
+
+                // test paged results
+                $filter = array( 'number' =&gt; 5 );
+                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+                $this-&gt;assertEquals( 5, count( $results2 ) );
+                $this-&gt;assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
+
+                $filter['offset'] = 10;
+                $results3 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results3 );
+                $this-&gt;assertEquals( $num_terms - 10, count( $results3 ) );
+                $this-&gt;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' =&gt; true );
+                $results4 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results4 );
+                $this-&gt;assertEquals( 0, count( $results4 ) );
+
+                unset($GLOBALS['wp_taxonomies'][$tax_name]);
+        }
+
+        function test_term_ordering() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+
+                $this-&gt;factory-&gt;post-&gt;create_many( 5, array( 'post_category' =&gt; array( $cat1 ) ) );
+                $this-&gt;factory-&gt;post-&gt;create_many( 3, array( 'post_category' =&gt; array( $cat2 ) ) );
+
+                $filter = array( 'orderby' =&gt; 'count', 'order' =&gt; 'DESC' );
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+                $this-&gt;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-&gt;assertFalse( false, 'Incorrect category ordering.' );
+                        }
+                }
+        }
+
+        function test_terms_search() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $name = rand_str( 30 );
+                $name_id = wp_create_category( $name );
+
+                // search by full name
+                $filter = array( 'search' =&gt; $name );
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+                $this-&gt;assertEquals( 1, count( $results ) );
+                $this-&gt;assertEquals( $name, $results[0]['name'] );
+                $this-&gt;assertEquals( $name_id, $results[0]['term_id'] );
+
+                // search by partial name
+                $filter = array( 'search' =&gt; substr( $name, 0, 10 ) );
+                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
+                $this-&gt;assertEquals( 1, count( $results2 ) );
+                $this-&gt;assertEquals( $name, $results2[0]['name'] );
+                $this-&gt;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"> &lt;?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-&gt;myxmlrpcserver-&gt;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-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_no_content() {
</span><ins>+                $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', array() ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 500, $result-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'ID' =&gt; 103948 );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_publish() {
</span><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_private() {
</span><ins>+                $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; 99999999 );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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' )-&gt;ID;
</del><ins>+                $my_author_id = $this-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;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-&gt;make_user_by_role( 'author' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'foobar_status' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'contributor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private', 'sticky' =&gt; true );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'quote' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'tumblr' );
</span><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
</span><span class="cx">                 $this-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array(
</span><span class="cx">                         'post_title' =&gt; 'Test',
</span><span class="cx">                         'terms' =&gt; 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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $post = array(
</span><span class="cx">                         'post_title' =&gt; 'Test',
</span><span class="cx">                         'terms' =&gt; 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-&gt;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-&gt;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-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result2 );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result2-&gt;code );
</span><del>-
-                // cleanup
-                wp_delete_term( $child_cat, 'category' );
-                wp_delete_term( $cat1, 'category' );
-                wp_delete_term( $cat2-&gt;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"> &lt;?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-&gt;term_ids = array();
</del><ins>+
</ins><span class="cx">                 $this-&gt;parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
</span><span class="cx">                 $this-&gt;parent_term = $this-&gt;parent_term['term_id'];
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_term( $this-&gt;parent_term, 'category' );
-                foreach ( $this-&gt;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-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'username', 'password', array() ) );
</span><span class="cx">                 $this-&gt;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-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' =&gt; '' ) ) );
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; '' ) ) );
</ins><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;code );
</span><span class="cx">                 $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_invalid_taxonomy() {
</span><del>-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' =&gt; 'not_existing' ) ) );
</del><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'not_existing' ) ) );
</ins><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;code );
</span><span class="cx">                 $this-&gt;assertEquals( __( 'Invalid taxonomy' ), $result-&gt;message );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_incapable_user() {
</span><ins>+                $this-&gt;make_user_by_role( 'subscriber' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' =&gt; 'category' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 401, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'post_tag', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 'dasda', 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 500, $result-&gt;code );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_parent_not_existing() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 9999, 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertEquals( 403, $result-&gt;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-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this-&gt;term_ids[] = $result;
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_add_term_with_parent() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test' ) ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this-&gt;term_ids[] = $result;
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function test_add_term_with_all() {
</span><ins>+                $this-&gt;make_user_by_role( 'editor' );
+
</ins><span class="cx">                 $taxonomy = array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test_all', 'description' =&gt; 'Test all', 'slug' =&gt; 'test_all' );
</span><span class="cx">                 $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
</span><span class="cx">                 $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
</span><span class="cx">                 $this-&gt;assertStringMatchesFormat( '%d', $result );
</span><del>-
-                $this-&gt;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"> &lt;?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-&gt;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>