<!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>[Tests][904] trunk/tests: Rename tests to conform to this standard: the class Tests_A_B_C.php should be found in Tests/A/B/C.php.</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/904">904</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-18 19:01:41 +0000 (Wed, 18 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename tests to conform to this standard: the class Tests_A_B_C.php should be found in Tests/A/B/C.php.

One class per file. Tests are now organized by general component, rather than by the core file they are found in.

Work in progress. Some classes need to be renamed, and some files still need to be moved (and split up).</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkteststest_includes_pluggablephp">trunk/tests/test_includes_pluggable.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/tests/actions/</li>
<li><a href="#trunktestsactionsclosuresphp">trunk/tests/actions/closures.php</a></li>
<li><a href="#trunktestsactionsphp">trunk/tests/actions.php</a></li>
<li>trunk/tests/admin/</li>
<li><a href="#trunktestsadminincludesMiscphp">trunk/tests/admin/includesMisc.php</a></li>
<li><a href="#trunktestsadminincludesPluginphp">trunk/tests/admin/includesPlugin.php</a></li>
<li><a href="#trunktestsadminincludesScreenphp">trunk/tests/admin/includesScreen.php</a></li>
<li><a href="#trunktestsadminincludesTemplatephp">trunk/tests/admin/includesTemplate.php</a></li>
<li><a href="#trunktestsadminincludesThemephp">trunk/tests/admin/includesTheme.php</a></li>
<li><a href="#trunktestsadminbarphp">trunk/tests/adminbar.php</a></li>
<li>trunk/tests/ajax/</li>
<li><a href="#trunktestsajaxAutosavephp">trunk/tests/ajax/Autosave.php</a></li>
<li><a href="#trunktestsajaxCompressionTestphp">trunk/tests/ajax/CompressionTest.php</a></li>
<li><a href="#trunktestsajaxDeleteCommentphp">trunk/tests/ajax/DeleteComment.php</a></li>
<li><a href="#trunktestsajaxDimCommentphp">trunk/tests/ajax/DimComment.php</a></li>
<li><a href="#trunktestsajaxEditCommentphp">trunk/tests/ajax/EditComment.php</a></li>
<li><a href="#trunktestsajaxGetCommentsphp">trunk/tests/ajax/GetComments.php</a></li>
<li><a href="#trunktestsajaxReplytoCommentphp">trunk/tests/ajax/ReplytoComment.php</a></li>
<li><a href="#trunktestsajaxTagSearchphp">trunk/tests/ajax/TagSearch.php</a></li>
<li><a href="#trunktestsbasicphp">trunk/tests/basic.php</a></li>
<li><a href="#trunktestscachephp">trunk/tests/cache.php</a></li>
<li>trunk/tests/canonical/</li>
<li><a href="#trunktestscanonicalcustomRulesphp">trunk/tests/canonical/customRules.php</a></li>
<li><a href="#trunktestscanonicalnoRewritephp">trunk/tests/canonical/noRewrite.php</a></li>
<li><a href="#trunktestscanonicalpageOnFrontphp">trunk/tests/canonical/pageOnFront.php</a></li>
<li><a href="#trunktestscanonicalphp">trunk/tests/canonical.php</a></li>
<li><a href="#trunktestscompatphp">trunk/tests/compat.php</a></li>
<li><a href="#trunktestscronphp">trunk/tests/cron.php</a></li>
<li><a href="#trunktestsdbphp">trunk/tests/db.php</a></li>
<li>trunk/tests/dependencies/</li>
<li><a href="#trunktestsdependenciesscriptsphp">trunk/tests/dependencies/scripts.php</a></li>
<li><a href="#trunktestsdependenciesstylesphp">trunk/tests/dependencies/styles.php</a></li>
<li><a href="#trunktestsdependenciesphp">trunk/tests/dependencies.php</a></li>
<li>trunk/tests/feed/</li>
<li><a href="#trunktestsfeedrss2php">trunk/tests/feed/rss2.php</a></li>
<li><a href="#trunktestsfilephp">trunk/tests/file.php</a></li>
<li><a href="#trunktestsfiltersphp">trunk/tests/filters.php</a></li>
<li>trunk/tests/formatting/</li>
<li><a href="#trunktestsformattingbalanceTagsphp">trunk/tests/formatting/balanceTags.php</a></li>
<li>trunk/tests/http/</li>
<li><a href="#trunktestshttpbasephp">trunk/tests/http/base.php</a></li>
<li><a href="#trunktestshttphttpphp">trunk/tests/http/http.php</a></li>
<li><a href="#trunktestsksesphp">trunk/tests/kses.php</a></li>
<li><a href="#trunktestsmediaphp">trunk/tests/media.php</a></li>
<li><a href="#trunktestsmetaphp">trunk/tests/meta.php</a></li>
<li><a href="#trunktestsmsphp">trunk/tests/ms.php</a></li>
<li>trunk/tests/option/</li>
<li><a href="#trunktestsoptionblogOptionphp">trunk/tests/option/blogOption.php</a></li>
<li><a href="#trunktestsoptionoptionphp">trunk/tests/option/option.php</a></li>
<li><a href="#trunktestsoptionsiteOptionphp">trunk/tests/option/siteOption.php</a></li>
<li><a href="#trunktestsoptionsiteTransientphp">trunk/tests/option/siteTransient.php</a></li>
<li><a href="#trunktestsoptiontransientphp">trunk/tests/option/transient.php</a></li>
<li>trunk/tests/post/</li>
<li><a href="#trunktestspostfilteringphp">trunk/tests/post/filtering.php</a></li>
<li>trunk/tests/query/</li>
<li><a href="#trunktestsqueryresultsphp">trunk/tests/query/results.php</a></li>
<li><a href="#trunktestsqueryphp">trunk/tests/query.php</a></li>
<li><a href="#trunktestsshortcodephp">trunk/tests/shortcode.php</a></li>
<li>trunk/tests/theme/</li>
<li><a href="#trunkteststhemeWPThemephp">trunk/tests/theme/WPTheme.php</a></li>
<li><a href="#trunktestsuploadphp">trunk/tests/upload.php</a></li>
<li><a href="#trunktestsurlphp">trunk/tests/url.php</a></li>
<li>trunk/tests/user/</li>
<li><a href="#trunktestsuserauthorphp">trunk/tests/user/author.php</a></li>
<li><a href="#trunktestsusercapabilitiesphp">trunk/tests/user/capabilities.php</a></li>
<li><a href="#trunktestsusermapMetaCapphp">trunk/tests/user/mapMetaCap.php</a></li>
<li><a href="#trunktestsuserphp">trunk/tests/user.php</a></li>
<li>trunk/tests/xmlrpc/</li>
<li><a href="#trunktestsxmlrpcDisabledphp">trunk/tests/xmlrpc/Disabled.php</a></li>
<li>trunk/tests/xmlrpc/mt/</li>
<li><a href="#trunktestsxmlrpcmtgetRecentPostTitlesphp">trunk/tests/xmlrpc/mt/getRecentPostTitles.php</a></li>
<li>trunk/tests/xmlrpc/mw/</li>
<li><a href="#trunktestsxmlrpcmweditPostphp">trunk/tests/xmlrpc/mw/editPost.php</a></li>
<li><a href="#trunktestsxmlrpcmwgetPostphp">trunk/tests/xmlrpc/mw/getPost.php</a></li>
<li><a href="#trunktestsxmlrpcmwgetRecentPostsphp">trunk/tests/xmlrpc/mw/getRecentPosts.php</a></li>
<li><a href="#trunktestsxmlrpcmwnewPostphp">trunk/tests/xmlrpc/mw/newPost.php</a></li>
<li>trunk/tests/xmlrpc/wp/</li>
<li><a href="#trunktestsxmlrpcwpdeletePostphp">trunk/tests/xmlrpc/wp/deletePost.php</a></li>
<li><a href="#trunktestsxmlrpcwpdeleteTermphp">trunk/tests/xmlrpc/wp/deleteTerm.php</a></li>
<li><a href="#trunktestsxmlrpcwpeditPostphp">trunk/tests/xmlrpc/wp/editPost.php</a></li>
<li><a href="#trunktestsxmlrpcwpeditTermphp">trunk/tests/xmlrpc/wp/editTerm.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetCommentphp">trunk/tests/xmlrpc/wp/getComment.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetCommentsphp">trunk/tests/xmlrpc/wp/getComments.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetMediaItemphp">trunk/tests/xmlrpc/wp/getMediaItem.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetOptionsphp">trunk/tests/xmlrpc/wp/getOptions.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPagephp">trunk/tests/xmlrpc/wp/getPage.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPageListphp">trunk/tests/xmlrpc/wp/getPageList.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPagesphp">trunk/tests/xmlrpc/wp/getPages.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPostphp">trunk/tests/xmlrpc/wp/getPost.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPostTypephp">trunk/tests/xmlrpc/wp/getPostType.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPostTypesphp">trunk/tests/xmlrpc/wp/getPostTypes.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetPostsphp">trunk/tests/xmlrpc/wp/getPosts.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetTaxonomiesphp">trunk/tests/xmlrpc/wp/getTaxonomies.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetTaxonomyphp">trunk/tests/xmlrpc/wp/getTaxonomy.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetTermphp">trunk/tests/xmlrpc/wp/getTerm.php</a></li>
<li><a href="#trunktestsxmlrpcwpgetTermsphp">trunk/tests/xmlrpc/wp/getTerms.php</a></li>
<li><a href="#trunktestsxmlrpcwpnewPostphp">trunk/tests/xmlrpc/wp/newPost.php</a></li>
<li><a href="#trunktestsxmlrpcwpnewTermphp">trunk/tests/xmlrpc/wp/newTerm.php</a></li>
<li><a href="#trunktestsxmlrpcwpuploadFilephp">trunk/tests/xmlrpc/wp/uploadFile.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsajaxtest_admin_ajax_compression_testphp">trunk/tests/ajax/test_admin_ajax_compression_test.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_delete_commentsphp">trunk/tests/ajax/test_admin_ajax_delete_comments.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_dim_commentsphp">trunk/tests/ajax/test_admin_ajax_dim_comments.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_edit_commentphp">trunk/tests/ajax/test_admin_ajax_edit_comment.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_get_commentsphp">trunk/tests/ajax/test_admin_ajax_get_comments.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_replyto_commentphp">trunk/tests/ajax/test_admin_ajax_replyto_comment.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_save_draftphp">trunk/tests/ajax/test_admin_ajax_save_draft.php</a></li>
<li><a href="#trunktestsajaxtest_admin_ajax_tag_searchphp">trunk/tests/ajax/test_admin_ajax_tag_search.php</a></li>
<li>trunk/tests/test-ajax-actions/</li>
<li><a href="#trunkteststestxmlrpcapitest_mt_getRecentPostTitlesphp">trunk/tests/test-xmlrpc-api/test_mt_getRecentPostTitles.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_mw_editPostphp">trunk/tests/test-xmlrpc-api/test_mw_editPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_mw_getPostphp">trunk/tests/test-xmlrpc-api/test_mw_getPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_mw_getRecentPostsphp">trunk/tests/test-xmlrpc-api/test_mw_getRecentPosts.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_mw_newPostphp">trunk/tests/test-xmlrpc-api/test_mw_newPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_deletePostphp">trunk/tests/test-xmlrpc-api/test_wp_deletePost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_deleteTermphp">trunk/tests/test-xmlrpc-api/test_wp_deleteTerm.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_editPostphp">trunk/tests/test-xmlrpc-api/test_wp_editPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_editTermphp">trunk/tests/test-xmlrpc-api/test_wp_editTerm.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getCommentphp">trunk/tests/test-xmlrpc-api/test_wp_getComment.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getCommentsphp">trunk/tests/test-xmlrpc-api/test_wp_getComments.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getMediaItemphp">trunk/tests/test-xmlrpc-api/test_wp_getMediaItem.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getOptionsphp">trunk/tests/test-xmlrpc-api/test_wp_getOptions.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPagephp">trunk/tests/test-xmlrpc-api/test_wp_getPage.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPageListphp">trunk/tests/test-xmlrpc-api/test_wp_getPageList.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPagesphp">trunk/tests/test-xmlrpc-api/test_wp_getPages.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPostphp">trunk/tests/test-xmlrpc-api/test_wp_getPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPostTypephp">trunk/tests/test-xmlrpc-api/test_wp_getPostType.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPostTypesphp">trunk/tests/test-xmlrpc-api/test_wp_getPostTypes.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getPostsphp">trunk/tests/test-xmlrpc-api/test_wp_getPosts.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getTaxonomiesphp">trunk/tests/test-xmlrpc-api/test_wp_getTaxonomies.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getTaxonomyphp">trunk/tests/test-xmlrpc-api/test_wp_getTaxonomy.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getTermphp">trunk/tests/test-xmlrpc-api/test_wp_getTerm.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_getTermsphp">trunk/tests/test-xmlrpc-api/test_wp_getTerms.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_newPostphp">trunk/tests/test-xmlrpc-api/test_wp_newPost.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_newTermphp">trunk/tests/test-xmlrpc-api/test_wp_newTerm.php</a></li>
<li><a href="#trunkteststestxmlrpcapitest_wp_uploadFilephp">trunk/tests/test-xmlrpc-api/test_wp_uploadFile.php</a></li>
<li><a href="#trunkteststest_actionsphp">trunk/tests/test_actions.php</a></li>
<li><a href="#trunkteststest_actions_closuresphp">trunk/tests/test_actions_closures.php</a></li>
<li><a href="#trunkteststest_admin_includes_miscphp">trunk/tests/test_admin_includes_misc.php</a></li>
<li><a href="#trunkteststest_admin_includes_pluginphp">trunk/tests/test_admin_includes_plugin.php</a></li>
<li><a href="#trunkteststest_admin_includes_screenphp">trunk/tests/test_admin_includes_screen.php</a></li>
<li><a href="#trunkteststest_admin_includes_templatephp">trunk/tests/test_admin_includes_template.php</a></li>
<li><a href="#trunkteststest_admin_includes_themephp">trunk/tests/test_admin_includes_theme.php</a></li>
<li><a href="#trunkteststest_cronphp">trunk/tests/test_cron.php</a></li>
<li><a href="#trunkteststest_dbphp">trunk/tests/test_db.php</a></li>
<li><a href="#trunkteststest_filtersphp">trunk/tests/test_filters.php</a></li>
<li><a href="#trunkteststest_httpphp">trunk/tests/test_http.php</a></li>
<li><a href="#trunkteststest_includes_admin_barphp">trunk/tests/test_includes_admin_bar.php</a></li>
<li><a href="#trunkteststest_includes_authorphp">trunk/tests/test_includes_author.php</a></li>
<li><a href="#trunkteststest_includes_balance_tagsphp">trunk/tests/test_includes_balance_tags.php</a></li>
<li><a href="#trunkteststest_includes_cachephp">trunk/tests/test_includes_cache.php</a></li>
<li><a href="#trunkteststest_includes_canonicalphp">trunk/tests/test_includes_canonical.php</a></li>
<li><a href="#trunkteststest_includes_capabilitiesphp">trunk/tests/test_includes_capabilities.php</a></li>
<li><a href="#trunkteststest_includes_classwpdependenciesphp">trunk/tests/test_includes_class-wp-dependencies.php</a></li>
<li><a href="#trunkteststest_includes_classwpthemephp">trunk/tests/test_includes_class-wp-theme.php</a></li>
<li><a href="#trunkteststest_includes_classwpxmlrpcserverphp">trunk/tests/test_includes_class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunkteststest_includes_compatphp">trunk/tests/test_includes_compat.php</a></li>
<li><a href="#trunkteststest_includes_feed_rss2php">trunk/tests/test_includes_feed_rss2.php</a></li>
<li><a href="#trunkteststest_includes_filephp">trunk/tests/test_includes_file.php</a></li>
<li><a href="#trunkteststest_includes_ksesphp">trunk/tests/test_includes_kses.php</a></li>
<li><a href="#trunkteststest_includes_mediaphp">trunk/tests/test_includes_media.php</a></li>
<li><a href="#trunkteststest_includes_metaphp">trunk/tests/test_includes_meta.php</a></li>
<li><a href="#trunkteststest_includes_wpscriptsphp">trunk/tests/test_includes_wp-scripts.php</a></li>
<li><a href="#trunkteststest_includes_wpstylesphp">trunk/tests/test_includes_wp-styles.php</a></li>
<li><a href="#trunkteststest_link_functionsphp">trunk/tests/test_link_functions.php</a></li>
<li><a href="#trunkteststest_metaphp">trunk/tests/test_meta.php</a></li>
<li><a href="#trunkteststest_msphp">trunk/tests/test_ms.php</a></li>
<li><a href="#trunkteststest_optionphp">trunk/tests/test_option.php</a></li>
<li><a href="#trunkteststest_post_filteringphp">trunk/tests/test_post_filtering.php</a></li>
<li><a href="#trunkteststest_queryphp">trunk/tests/test_query.php</a></li>
<li><a href="#trunkteststest_query_resultsphp">trunk/tests/test_query_results.php</a></li>
<li><a href="#trunkteststest_shortcodephp">trunk/tests/test_shortcode.php</a></li>
<li><a href="#trunkteststest_uploadsphp">trunk/tests/test_uploads.php</a></li>
<li><a href="#trunkteststest_userphp">trunk/tests/test_user.php</a></li>
<li><a href="#trunkteststest_user_capabilitiesphp">trunk/tests/test_user_capabilities.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsactionsclosuresphpfromrev903trunkteststest_actions_closuresphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/actions/closures.php (from rev 903, trunk/tests/test_actions_closures.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/actions/closures.php                                (rev 0)
+++ trunk/tests/actions/closures.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;?php
+
+/**
+ * Test do_action() and related functions
+ *
+ * @group hooks
+ */
+class WP_Test_Actions_Closures extends WP_UnitTestCase {
+
+        /**
+         * @ticket 10493
+         */
+        function test_action_closure() {
+                $tag = rand_str();
+                $closure = function($a, $b) { $GLOBALS[$a] = $b;};
+                add_action($tag, $closure, 10, 2);
+
+                $this-&gt;assertSame( 10, has_action($tag, $closure) );
+
+                $context = array( rand_str(), rand_str() );
+                do_action($tag, $context[0], $context[1]);
+
+                $this-&gt;assertSame($GLOBALS[$context[0]], $context[1]);
+
+                $tag2 = rand_str();
+                $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
+                add_action($tag2, $closure2);
+
+                $this-&gt;assertSame( 10, has_action($tag2, $closure2) );
+
+                do_action($tag2);
+
+                $this-&gt;assertTrue($GLOBALS['closure_no_args']);
+        }
+}
</ins></span></pre></div>
<a id="trunktestsactionsphpfromrev903trunkteststest_actionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/actions.php (from rev 903, trunk/tests/test_actions.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/actions.php                                (rev 0)
+++ trunk/tests/actions.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,244 @@
</span><ins>+&lt;?php
+
+/**
+ * Test do_action() and related functions
+ *
+ * @group hooks
+ */
+class WPTestActions extends WP_UnitTestCase {
+
+        function test_simple_action() {
+                $a = new MockAction();
+                $tag = 'test_action';
+
+                add_action($tag, array(&amp;$a, 'action'));
+                do_action($tag);
+
+                // only one event occurred for the hook, with empty args
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                // only our hook was called
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                $args = array_pop($a-&gt;get_args());
+                $this-&gt;assertEquals(array(''), $args);
+        }
+
+        function test_remove_action() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'action'));
+                do_action($tag);
+
+                // make sure our hook was called correctly
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                // now remove the action, do it again, and make sure it's not called this time
+                remove_action($tag, array(&amp;$a, 'action'));
+                do_action($tag);
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+        }
+
+        function test_has_action() {
+                        $tag = rand_str();
+                        $func = rand_str();
+
+                        $this-&gt;assertFalse( has_action($tag, $func) );
+                        $this-&gt;assertFalse( has_action($tag) );
+                        add_action($tag, $func);
+                        $this-&gt;assertEquals( 10, has_action($tag, $func) );
+                        $this-&gt;assertTrue( has_action($tag) );
+                        remove_action($tag, $func);
+                        $this-&gt;assertFalse( has_action($tag, $func) );
+                        $this-&gt;assertFalse( has_action($tag) );
+        }
+
+        // one tag with multiple actions
+        function test_multiple_actions() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+
+                // add both actions to the hook
+                add_action($tag, array(&amp;$a1, 'action'));
+                add_action($tag, array(&amp;$a2, 'action'));
+
+                do_action($tag);
+
+                // both actions called once each
+                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
+                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
+        }
+
+        function test_action_args_1() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_action($tag, array(&amp;$a, 'action'));
+                // call the action with a single argument
+                do_action($tag, $val);
+
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val), array_pop($a-&gt;get_args()));
+        }
+
+        function test_action_args_2() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+                $val1 = rand_str();
+                $val2 = rand_str();
+
+                // a1 accepts two arguments, a2 doesn't
+                add_action($tag, array(&amp;$a1, 'action'), 10, 2);
+                add_action($tag, array(&amp;$a2, 'action'));
+                // call the action with two arguments
+                do_action($tag, $val1, $val2);
+
+                // a1 should be called with both args
+                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val1, $val2), array_pop($a1-&gt;get_args()));
+
+                // a2 should be called with one only
+                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val1), array_pop($a2-&gt;get_args()));
+        }
+
+        function test_action_priority() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'action'), 10);
+                add_action($tag, array(&amp;$a, 'action2'), 9);
+                do_action($tag);
+
+                // two events, one per action
+                $this-&gt;assertEquals(2, $a-&gt;get_call_count());
+
+                $expected = array (
+                        // action2 is called first because it has priority 9
+                        array (
+                                'action' =&gt; 'action2',
+                                'tag' =&gt; $tag,
+                                'args' =&gt; array('')
+                        ),
+                        // action 1 is called second
+                        array (
+                                'action' =&gt; 'action',
+                                'tag' =&gt; $tag,
+                                'args' =&gt; array('')
+                        ),
+                );
+
+                $this-&gt;assertEquals($expected, $a-&gt;get_events());
+        }
+
+        function test_did_action() {
+                $tag1 = rand_str();
+                $tag2 = rand_str();
+
+                // do action tag1 but not tag2
+                do_action($tag1);
+                $this-&gt;assertEquals(1, did_action($tag1));
+                $this-&gt;assertEquals(0, did_action($tag2));
+
+                // do action tag2 a random number of times
+                $count = rand(0, 10);
+                for ($i=0; $i&lt;$count; $i++)
+                        do_action($tag2);
+
+                // tag1's count hasn't changed, tag2 should be correct
+                $this-&gt;assertEquals(1, did_action($tag1));
+                $this-&gt;assertEquals($count, did_action($tag2));
+
+        }
+
+        function test_all_action() {
+                $a = new MockAction();
+                $tag1 = rand_str();
+                $tag2 = rand_str();
+
+                // add an 'all' action
+                add_action('all', array(&amp;$a, 'action'));
+                $this-&gt;assertEquals(10, has_filter('all', array(&amp;$a, 'action')));
+                // do some actions
+                do_action($tag1);
+                do_action($tag2);
+                do_action($tag1);
+                do_action($tag1);
+
+                // our action should have been called once for each tag
+                $this-&gt;assertEquals(4, $a-&gt;get_call_count());
+                // only our hook was called
+                $this-&gt;assertEquals(array($tag1, $tag2, $tag1, $tag1), $a-&gt;get_tags());
+
+                remove_action('all', array(&amp;$a, 'action'));
+                $this-&gt;assertFalse(has_filter('all', array(&amp;$a, 'action')));
+
+        }
+
+        function test_remove_all_action() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action('all', array(&amp;$a, 'action'));
+                $this-&gt;assertEquals(10, has_filter('all', array(&amp;$a, 'action')));
+                do_action($tag);
+
+                // make sure our hook was called correctly
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                // now remove the action, do it again, and make sure it's not called this time
+                remove_action('all', array(&amp;$a, 'action'));
+                $this-&gt;assertFalse(has_filter('all', array(&amp;$a, 'action')));
+                do_action($tag);
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+        }
+
+        function test_action_ref_array() {
+                $obj = new stdClass();
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'action'));
+
+                do_action_ref_array($tag, array(&amp;$obj));
+
+                $args = $a-&gt;get_args();
+                $this-&gt;assertSame($args[0][0], $obj);
+                // just in case we don't trust assertSame
+                $obj-&gt;foo = true;
+                $this-&gt;assertFalse( empty($args[0][0]-&gt;foo) );
+        }
+
+        /**
+         * @ticket 11241
+         */
+        function test_action_keyed_array() {
+                $a = new MockAction();
+
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'action'));
+
+                $context = array( rand_str() =&gt; rand_str() );
+                do_action($tag, $context);
+
+                $args = $a-&gt;get_args();
+                $this-&gt;assertSame($args[0][0], $context);
+
+                $context2 = array( rand_str() =&gt; rand_str(), rand_str() =&gt; rand_str() );
+                do_action($tag, $context2);
+
+                $args = $a-&gt;get_args();
+                $this-&gt;assertSame($args[1][0], $context2);
+
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsadminincludesMiscphpfromrev903trunkteststest_admin_includes_miscphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/admin/includesMisc.php (from rev 903, trunk/tests/test_admin_includes_misc.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesMisc.php                                (rev 0)
+++ trunk/tests/admin/includesMisc.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;?php
+
+/**
+ * @group admin
+ */
+class TestShortenUrl extends WP_UnitTestCase {
+        function test_shorten_url() {
+                $tests = array(
+                        // strip slashes
+                        'wordpress\.org/about/philosophy'
+                                =&gt; 'wordpress.org/about/philosophy', // strip slashes
+                        'http://wordpress.org/about/philosophy/'
+                                =&gt; 'wordpress.org/about/philosophy', // remove http, trailing slash
+                        'http://www.wordpress.org/about/philosophy/'
+                                =&gt; 'wordpress.org/about/philosophy', // remove http, www
+                        'http://wordpress.org/about/philosophy/#box'
+                                =&gt; 'wordpress.org/about/philosophy/#box', // don't shorten 35 characters
+                        'http://wordpress.org/about/philosophy/#decisions'
+                                =&gt; 'wordpress.org/about/philosophy/#...', // shorten to 32 if &gt; 35 after cleaning
+                );
+                foreach ( $tests as $k =&gt; $v )
+                        $this-&gt;assertEquals( $v, url_shorten( $k ) );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsadminincludesPluginphpfromrev903trunkteststest_admin_includes_pluginphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/admin/includesPlugin.php (from rev 903, trunk/tests/test_admin_includes_plugin.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesPlugin.php                                (rev 0)
+++ trunk/tests/admin/includesPlugin.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+&lt;?php
+/**
+ * @group plugins
+ * @group admin
+ */
+class Tests_Admin_includesPlugin extends WP_UnitTestCase {
+        function test_get_plugin_data() {
+                $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
+
+                $default_headers = array(
+                        'Name' =&gt; 'Hello Dolly',
+                        'Title' =&gt; '&lt;a href=&quot;http://wordpress.org/#&quot; title=&quot;Visit plugin homepage&quot;&gt;Hello Dolly&lt;/a&gt;',
+                        'PluginURI' =&gt; 'http://wordpress.org/#',
+                        'Description' =&gt; 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. &lt;cite&gt;By &lt;a href=&quot;http://ma.tt/&quot; title=&quot;Visit author homepage&quot;&gt;Matt Mullenweg&lt;/a&gt;.&lt;/cite&gt;',
+                        'Author' =&gt; '&lt;a href=&quot;http://ma.tt/&quot; title=&quot;Visit author homepage&quot;&gt;Matt Mullenweg&lt;/a&gt;',
+                        'AuthorURI' =&gt; 'http://ma.tt/',
+                        'Version' =&gt; '1.5.1',
+                        'TextDomain' =&gt; 'hello-dolly',
+                        'DomainPath' =&gt; ''
+                );
+
+                $this-&gt;assertTrue( is_array($data) );
+
+                foreach ($default_headers as $name =&gt; $value) {
+                        $this-&gt;assertTrue(isset($data[$name]));
+                        $this-&gt;assertEquals($value, $data[$name]);
+                }
+        }
+
+        function test_menu_page_url() {
+                $current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) ) );
+                update_option( 'siteurl', 'http://example.com' );
+
+                // add some pages
+                add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
+                add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
+                add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
+                add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
+                add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
+                add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
+                add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
+
+                $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
+                $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
+                $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
+                $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
+                $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
+                $expected['not_registered'] = '';
+                $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
+                $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&amp;#038;page=testpages';
+
+                foreach ($expected as $name =&gt; $value) {
+                        $this-&gt;assertEquals( $value, menu_page_url( $name, false ) );
+                }
+
+                wp_set_current_user( $current_user );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsadminincludesScreenphpfromrev903trunkteststest_admin_includes_screenphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/admin/includesScreen.php (from rev 903, trunk/tests/test_admin_includes_screen.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesScreen.php                                (rev 0)
+++ trunk/tests/admin/includesScreen.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,166 @@
</span><ins>+&lt;?php
+
+/**
+ * @group admin
+ */
+class WPTestScreen extends WP_UnitTestCase {
+        var $core_screens = array(
+                'index.php' =&gt; array( 'base' =&gt; 'dashboard', 'id' =&gt; 'dashboard' ),
+                'edit.php' =&gt; array( 'base' =&gt; 'edit', 'id' =&gt; 'edit-post', 'post_type' =&gt; 'post' ),
+                'post-new.php'=&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'post', 'id' =&gt; 'post', 'post_type' =&gt; 'post' ),
+                'edit-tags.php' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-post_tag', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'post_tag' ),
+                'edit-tags.php?taxonomy=post_tag' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-post_tag', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'post_tag' ),
+                'edit-tags.php?taxonomy=category' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-category', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'category' ),
+                'upload.php' =&gt; array( 'base' =&gt; 'upload', 'id' =&gt; 'upload' ),
+                'media-new.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'media', 'id' =&gt; 'media' ),
+                'edit.php?post_type=page' =&gt; array( 'base' =&gt; 'edit', 'id' =&gt; 'edit-page', 'post_type' =&gt; 'page' ),
+                'link-manager.php' =&gt; array( 'base' =&gt; 'link-manager', 'id' =&gt; 'link-manager' ),
+                'link-add.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'link', 'id' =&gt; 'link' ),
+                'edit-tags.php?taxonomy=link_category' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-link_category', 'taxonomy' =&gt; 'link_category' ),
+                'edit-comments.php' =&gt; array( 'base' =&gt; 'edit-comments', 'id' =&gt; 'edit-comments' ),
+                'themes.php' =&gt; array( 'base' =&gt; 'themes', 'id' =&gt; 'themes' ),
+                'widgets.php' =&gt; array( 'base' =&gt; 'widgets', 'id' =&gt; 'widgets' ),
+                'nav-menus.php' =&gt; array( 'base' =&gt; 'nav-menus', 'id' =&gt; 'nav-menus' ),
+                'plugins.php' =&gt; array( 'base' =&gt; 'plugins', 'id' =&gt; 'plugins' ),
+                'users.php' =&gt; array( 'base' =&gt; 'users', 'id' =&gt; 'users' ),
+                'user-new.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'user', 'id' =&gt; 'user' ),
+                'profile.php' =&gt; array( 'base' =&gt; 'profile', 'id' =&gt; 'profile' ),
+                'tools.php' =&gt; array( 'base' =&gt; 'tools', 'id' =&gt; 'tools' ),
+                'import.php' =&gt; array( 'base' =&gt; 'import', 'id' =&gt; 'import' ),
+                'export.php' =&gt; array( 'base' =&gt; 'export', 'id' =&gt; 'export' ),
+                'options-general.php' =&gt; array( 'base' =&gt; 'options-general', 'id' =&gt; 'options-general' ),
+                'options-writing.php' =&gt; array( 'base' =&gt; 'options-writing', 'id' =&gt; 'options-writing' ),
+        );
+
+        function tearDown() {
+                parent::tearDown();
+                unset( $GLOBALS['wp_taxonomies']['old-or-new'] );
+        }
+
+        function test_set_current_screen_with_hook_suffix() {
+                global $current_screen;
+
+                foreach ( $this-&gt;core_screens as $hook_name =&gt; $screen ) {
+                        $_GET = $_POST = $_REQUEST = array();
+                        $GLOBALS['taxnow'] = $GLOBALS['typenow'] = '';
+                        $screen = (object) $screen;
+                        $hook = parse_url( $hook_name );
+
+                        if ( ! empty( $hook['query'] ) ) {
+                                $args = wp_parse_args( $hook['query'] );
+                                if ( isset( $args['taxonomy'] ) )
+                                        $GLOBALS['taxnow'] = $_GET['taxonomy'] = $_POST['taxonomy'] = $_REQUEST['taxonomy'] = $args['taxonomy'];
+                                if ( isset( $args['post_type'] ) )
+                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $args['post_type'];
+                                else if ( isset( $screen-&gt;post_type ) )
+                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen-&gt;post_type;
+                        }
+
+                        $GLOBALS['hook_suffix'] = $hook['path'];
+                        set_current_screen();
+
+                        $this-&gt;assertEquals( $screen-&gt;id, $current_screen-&gt;id, $hook_name );
+                        $this-&gt;assertEquals( $screen-&gt;base, $current_screen-&gt;base, $hook_name );
+                        if ( isset( $screen-&gt;action ) )
+                                $this-&gt;assertEquals( $screen-&gt;action, $current_screen-&gt;action, $hook_name );
+                        if ( isset( $screen-&gt;post_type ) )
+                                $this-&gt;assertEquals( $screen-&gt;post_type, $current_screen-&gt;post_type, $hook_name );
+                        else
+                                $this-&gt;assertEmpty( $current_screen-&gt;post_type, $hook_name );
+                        if ( isset( $screen-&gt;taxonomy ) )
+                                $this-&gt;assertEquals( $screen-&gt;taxonomy, $current_screen-&gt;taxonomy, $hook_name );
+
+                        // With convert_to_screen(), the same ID should return the exact $current_screen.
+                        $this-&gt;assertSame( $current_screen, convert_to_screen( $screen-&gt;id ), $hook_name );
+
+                        // With convert_to_screen(), the hook_suffix should return the exact $current_screen.
+                        // But, convert_to_screen() cannot figure out ?taxonomy and ?post_type.
+                        if ( empty( $hook['query'] ) )
+                                $this-&gt;assertSame( $current_screen, convert_to_screen( $GLOBALS['hook_suffix'] ), $hook_name );
+                }
+        }
+
+        function test_post_type_as_hookname() {
+                $screen = convert_to_screen( 'page' );
+                $this-&gt;assertEquals( $screen-&gt;post_type, 'page' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'page' );
+        }
+
+        function test_post_type_with_special_suffix_as_hookname() {
+                register_post_type( 'value-add' );
+                $screen = convert_to_screen( 'value-add' ); // the -add part is key.
+                $this-&gt;assertEquals( $screen-&gt;post_type, 'value-add' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'value-add' );
+
+                $screen = convert_to_screen( 'edit-value-add' ); // the -add part is key.
+                $this-&gt;assertEquals( $screen-&gt;post_type, 'value-add' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'edit' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'edit-value-add' );
+        }
+
+        function test_taxonomy_with_special_suffix_as_hookname() {
+                register_taxonomy( 'old-or-new', 'post' );
+                $screen = convert_to_screen( 'edit-old-or-new' ); // the -new part is key.
+                $this-&gt;assertEquals( $screen-&gt;taxonomy, 'old-or-new' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'edit-tags' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'edit-old-or-new' );
+        }
+
+        function test_post_type_with_edit_prefix() {
+                register_post_type( 'edit-some-thing' );
+                $screen = convert_to_screen( 'edit-some-thing' );
+                $this-&gt;assertEquals( $screen-&gt;post_type, 'edit-some-thing' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'edit-some-thing' );
+
+                $screen = convert_to_screen( 'edit-edit-some-thing' );
+                $this-&gt;assertEquals( $screen-&gt;post_type, 'edit-some-thing' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'edit' );
+                $this-&gt;assertEquals( $screen-&gt;id, 'edit-edit-some-thing' );
+        }
+
+        function test_post_type_edit_collisions() {
+                register_post_type( 'comments' );
+                register_post_type( 'tags' );
+
+                // Sorry, core wins here.
+                $screen = convert_to_screen( 'edit-comments' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'edit-comments' );
+
+                // The post type wins here. convert_to_screen( $post_type ) is only relevant for meta boxes anyway.
+                $screen = convert_to_screen( 'comments' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
+
+                // Core wins.
+                $screen = convert_to_screen( 'edit-tags' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'edit-tags' );
+
+                $screen = convert_to_screen( 'tags' );
+                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
+        }
+
+        function test_help_tabs() {
+                $tab = rand_str();
+                $tab_args = array(
+                        'id' =&gt; $tab,
+                        'title' =&gt; 'Help!',
+                        'content' =&gt; 'Some content',
+                        'callback' =&gt; false,
+                );
+
+                $screen = get_current_screen();
+                $screen-&gt;add_help_tab( $tab_args );
+                $this-&gt;assertEquals( $screen-&gt;get_help_tab( $tab ), $tab_args );
+
+                $tabs = $screen-&gt;get_help_tabs();
+                $this-&gt;assertArrayHasKey( $tab, $tabs );
+
+                $screen-&gt;remove_help_tab( $tab );
+                $this-&gt;assertNull( $screen-&gt;get_help_tab( $tab ) );
+
+                $screen-&gt;remove_help_tabs();
+                $this-&gt;assertEquals( $screen-&gt;get_help_tabs(), array() );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsadminincludesTemplatephpfromrev903trunkteststest_admin_includes_templatephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/admin/includesTemplate.php (from rev 903, trunk/tests/test_admin_includes_template.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesTemplate.php                                (rev 0)
+++ trunk/tests/admin/includesTemplate.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+&lt;?php
+/**
+ * @group admin
+ */
+class WPTestCheckedSelected extends WP_UnitTestCase {
+        function test_equal() {
+                $this-&gt;assertEquals(' selected=\'selected\'', selected('foo','foo',false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked('foo','foo',false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected('1',1,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked('1',1,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected('1',true,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked('1',true,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected(1,1,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked(1,1,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected(1,true,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked(1,true,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected(true,true,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked(true,true,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected('0',0,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked('0',0,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected(0,0,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked(0,0,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected('',false,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked('',false,false));
+
+                $this-&gt;assertEquals(' selected=\'selected\'', selected(false,false,false));
+                $this-&gt;assertEquals(' checked=\'checked\'', checked(false,false,false));
+        }
+
+        function test_notequal() {
+                $this-&gt;assertEquals('', selected('0','',false));
+                $this-&gt;assertEquals('', checked('0','',false));
+
+                $this-&gt;assertEquals('', selected(0,'',false));
+                $this-&gt;assertEquals('', checked(0,'',false));
+
+                $this-&gt;assertEquals('', selected(0,false,false));
+                $this-&gt;assertEquals('', checked(0,false,false));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsadminincludesThemephpfromrev903trunkteststest_admin_includes_themephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/admin/includesTheme.php (from rev 903, trunk/tests/test_admin_includes_theme.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesTheme.php                                (rev 0)
+++ trunk/tests/admin/includesTheme.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;?php
+/**
+ * @group themes
+ */
+class TestPageTemplates extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;theme_root = DIR_TESTDATA . '/themedir1';
+
+                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
+                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
+
+                add_filter('theme_root', array(&amp;$this, '_theme_root'));
+                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
+
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
+                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
+                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
+
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+                parent::tearDown();
+        }
+
+        // replace the normal theme root dir with our premade test dir
+        function _theme_root($dir) {
+                return $this-&gt;theme_root;
+        }
+
+        /**
+         * @ticket 10959
+         * @ticket 11216
+         */
+        function test_page_templates() {
+                $theme = get_theme('Page Template Theme');
+                $this-&gt;assertFalse( empty($theme) );
+
+                switch_theme($theme['Template'], $theme['Stylesheet']);
+
+                $templates = get_page_templates();
+                $this-&gt;assertEquals(3, count($templates));
+                $this-&gt;assertEquals(&quot;template-top-level.php&quot;, $templates['Top Level']);
+                $this-&gt;assertEquals(&quot;subdir/template-sub-dir.php&quot;, $templates['Sub Dir']);
+                $this-&gt;assertEquals(&quot;template-header.php&quot;, $templates['This Template Header Is On One Line']);
+        }
+}
</ins></span></pre></div>
<a id="trunktestsadminbarphpfromrev903trunkteststest_includes_admin_barphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/adminbar.php (from rev 903, trunk/tests/test_includes_admin_bar.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/adminbar.php                                (rev 0)
+++ trunk/tests/adminbar.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+&lt;?php
+
+/**
+ * @group admin-bar
+ * @group toolbar
+ * @group admin
+ */
+class Tests_AdminBar extends WP_UnitTestCase {
+
+        static function setUpBeforeClass() {
+                WP_UnitTestCase::setUpBeforeClass();
+                require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
+        }
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this-&gt;current_user );
+                parent::tearDown();
+        }
+
+        /**
+         * @ticket 21117
+         */
+        function test_content_post_type() {
+                register_post_type( 'content', array( 'show_in_admin_bar' =&gt; true ) );
+
+                $admin_bar = new WP_Admin_Bar;
+
+                wp_admin_bar_new_content_menu( $admin_bar );
+
+                $nodes = $admin_bar-&gt;get_nodes();
+                $this-&gt;assertFalse( $nodes['new-content']-&gt;parent );
+                $this-&gt;assertEquals( 'new-content', $nodes['add-new-content']-&gt;parent );
+
+                _unregister_post_type( 'content' );
+        }
+
+        /**
+         * @ticket 21117
+         */
+        function test_merging_existing_meta_values() {
+                $admin_bar = new WP_Admin_Bar;
+
+                $admin_bar-&gt;add_node( array(
+                        'id' =&gt; 'test-node',
+                        'meta' =&gt; array( 'class' =&gt; 'test-class' ),
+                ) );
+                $node = $admin_bar-&gt;get_node( 'test-node' );
+                $this-&gt;assertEquals( array( 'class' =&gt; 'test-class' ), $node-&gt;meta );
+
+                $admin_bar-&gt;add_node( array(
+                        'id' =&gt; 'test-node',
+                        'meta' =&gt; array( 'some-meta' =&gt; 'value' ),
+                ) );
+
+                $node = $admin_bar-&gt;get_node( 'test-node' );
+                $this-&gt;assertEquals( array( 'class' =&gt; 'test-class', 'some-meta' =&gt; 'value' ), $node-&gt;meta );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsajaxAutosavephpfromrev903trunkteststestajaxactionstest_admin_ajax_save_draftphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/Autosave.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_save_draft.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/Autosave.php                                (rev 0)
+++ trunk/tests/ajax/Autosave.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,229 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax save draft functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase {
+
+        /**
+         * Post
+         * @var mixed
+         */
+        protected $_post = null;
+        
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_status' =&gt; 'draft' ) );
+                $this-&gt;_post = get_post( $post_id );
+        }
+
+        /**
+         * Test autosaving as a logged out user
+         * @return void
+         */
+        public function test_nopriv_autosave() {
+                
+                // Log out
+                wp_logout();
+                
+                // Set up a default request
+                $_POST = array(
+                    'post_ID'  =&gt; 1,
+                    'autosave' =&gt; 1
+                );
+                
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'nopriv_autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this-&gt;assertEquals( 1, (string) $xml-&gt;response[0]-&gt;autosave['id'] );
+                $this-&gt;assertEquals( 'nopriv_autosave_1', (string) $xml-&gt;response['action'] );
+        }
+
+        /**
+         * Test as a logged out user with no post id
+         * @return void
+         */
+        public function test_nopriv_no_postid() {
+                
+                // Log out
+                wp_logout();
+                
+                // Set up a request
+                $_POST = array(
+                    'autosave'      =&gt; 1
+                );
+                
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'nopriv_autosave' );
+        }
+        
+        /**
+         * Test autosaving a post
+         * @return void
+         */
+        public function test_autosave_post() {
+
+                // Become an admin
+                $this-&gt;_setRole( 'administrator' );
+                        
+                // Set up the $_POST request
+                $md5 = md5( uniqid() );
+                $_POST = array(
+                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
+                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
+                    'post_content'  =&gt; $this-&gt;_post-&gt;post_content . PHP_EOL . $md5,
+                    'autosave'      =&gt; 1
+                );
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this-&gt;assertEquals( $this-&gt;_post-&gt;ID, (int) $xml-&gt;response[0]-&gt;autosave['id'] );
+                $this-&gt;assertEquals( 'autosave_' . $this-&gt;_post-&gt;ID, (string) $xml-&gt;response['action']);
+                
+                // Check that the edit happened
+                $post = get_post( $this-&gt;_post-&gt;ID) ;
+                $this-&gt;assertGreaterThanOrEqual( 0, strpos( $post-&gt;post_content, $md5 ) );
+        }
+
+        /**
+         * Test with an invalid nonce
+         * @return void
+         */
+        public function test_with_invalid_nonce( ) {
+                
+                // Become an administrator                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST = array(
+                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
+                    'autosavenonce' =&gt; md5( uniqid() ),
+                    'autosave'      =&gt; 1
+                );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'autosave' );
+        }
+        
+        /**
+         * Test with a bad post id
+         * @return void
+         */
+        public function test_with_invalid_post_id( ) {
+                
+                // Become an administrator        
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST = array(
+                    'post_ID'       =&gt; 0,
+                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
+                    'autosave'      =&gt; 1
+                );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', 'You are not allowed to edit this post.' );
+                $this-&gt;_handleAjax( 'autosave' );
+        }
+        
+        /**
+         * Test with a locked post
+         * @return void
+         */
+        public function test_locked_post() {
+
+                // Become an administrator                
+                $this-&gt;_setRole( 'administrator' );
+                
+                // Lock the post
+                wp_set_post_lock( $this-&gt;_post-&gt;ID );
+                
+                // Become a different administrator
+                $this-&gt;_setRole( 'administrator' );
+        
+                // Set up the $_POST request
+                $_POST = array(
+                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
+                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
+                    'autosave'      =&gt; 1
+                );
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this-&gt;assertEquals( $this-&gt;_post-&gt;ID, (int) $xml-&gt;response[0]-&gt;autosave['id'] );
+                $this-&gt;assertEquals( 'autosave_' . $this-&gt;_post-&gt;ID, (string) $xml-&gt;response['action']);
+                $this-&gt;assertEquals( 'disable', (string) $xml-&gt;response[0]-&gt;autosave[0]-&gt;supplemental[0]-&gt;disable_autosave);
+        }
+
+
+        /**
+         * Test with a browser that is about to be logged out
+         * @return void
+         */
+        public function test_past_grace_period() {
+                global $login_grace_period;
+                $login_grace_period = 1;
+
+                // Become an admnistrator                
+                $this-&gt;_setRole( 'administrator' );
+                        
+                // Set up the $_POST request
+                $_POST = array(
+                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
+                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
+                    'autosave'      =&gt; 1
+                );
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Look for the warning
+                $this-&gt;assertRegExp( '/Your login has expired. Please open a new browser window/' , $this-&gt;_last_response );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxCompressionTestphpfromrev903trunkteststestajaxactionstest_admin_ajax_compression_testphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/CompressionTest.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_compression_test.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/CompressionTest.php                                (rev 0)
+++ trunk/tests/ajax/CompressionTest.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax compression test functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_CompressionTest extends WP_Ajax_UnitTestCase {
+        
+        /**
+         * Test as a logged out user
+         */
+        public function test_logged_out() {
+                $this-&gt;logout();
+
+                // Set up a default request
+                $_GET['test'] = 1;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this-&gt;_handleAjax( 'wp-compression-test' );
+        }
+        
+        /**
+         * Fetch the test text
+         */
+        public function test_text() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 1;
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this-&gt;assertContains( 'wpCompressionTest', $this-&gt;_last_response );
+        }
+
+        /**
+         * Fetch the test text (gzdeflate)
+         */
+        public function test_gzdeflate() {
+
+                if ( !function_exists( 'gzdeflate' ) ) {
+                        $this-&gt;markTestSkipped( 'gzdeflate function not available' );
+                }
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this-&gt;assertContains( 'wpCompressionTest', gzinflate( $this-&gt;_last_response ) );
+        }
+
+        /**
+         * Fetch the test text (gzencode)
+         */
+        public function test_gzencode() {
+
+                if ( !function_exists('gzencode') ) {
+                        $this-&gt;markTestSkipped( 'gzencode function not available' );
+                }
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this-&gt;assertContains( 'wpCompressionTest', $this-&gt;_gzdecode( $this-&gt;_last_response ) );
+        }
+        
+        /**
+         * Fetch the test text (unknown encoding)
+         */
+        public function test_unknown_encoding() {
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'wp-compression-test' );
+        }
+
+        /**
+         * Set the 'can_compress_scripts' site option to true
+         */
+        public function test_set_yes() {
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 'yes';
+
+                // Set the option to false
+                update_site_option( 'can_compress_scripts', 0 );
+                
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        unset( $e );
+                }
+                
+                // Check the site option
+                $this-&gt;assertEquals( 1, get_site_option( 'can_compress_scripts' ) );
+        }
+
+        /**
+         * Set the 'can_compress_scripts' site option to false
+         */
+        public function test_set_no() {
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 'no';
+
+                // Set the option to true
+                update_site_option( 'can_compress_scripts', 1 );
+                
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        unset( $e );
+                }
+                
+                // Check the site option
+                $this-&gt;assertEquals( 0, get_site_option( 'can_compress_scripts' ) );
+        }
+        
+        /**
+         * Undo gzencode.  This is ugly, but there's no stock gzdecode() function.
+         * @param string $encoded_data
+         * @return string
+         */
+        protected function _gzdecode( $encoded_data ) {
+                
+                // Save the encoded data to a temp file
+                $file = wp_tempnam( 'gzdecode' );
+                file_put_contents( $file, $encoded_data );
+
+                // Flush it to the output buffer and delete the temp file
+                ob_start();
+                readgzfile( $file );
+                unlink( $file );
+                
+                // Save the data stop buffering
+                $data = ob_get_clean();
+                ob_end_clean();
+
+                // Done
+                return $data;
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxDeleteCommentphpfromrev903trunkteststestajaxactionstest_admin_ajax_delete_commentsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/DeleteComment.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_delete_comments.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/DeleteComment.php                                (rev 0)
+++ trunk/tests/ajax/DeleteComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,356 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase {
+
+        /**
+         * List of comments
+         * @var array
+         */
+        protected $_comments = array();
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;_comments = $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
+                $this-&gt;_comments = array_map( 'get_comment', $this-&gt;_comments );
+        }
+
+        /**
+         * Clear the POST actions in between requests
+         */
+        protected function _clear_post_action() {
+                unset($_POST['trash']);
+                unset($_POST['untrash']);
+                unset($_POST['spam']);
+                unset($_POST['unspam']);
+                unset($_POST['delete']);
+                $this-&gt;_last_response = '';
+        }
+        
+        /***********************************************************/
+        /** Test prototype
+    /***********************************************************/
+
+        /**
+         * Test as a privilged user (administrator)
+         * Expects test to pass
+         * @param mixed $comment Comment object
+         * @param string action trash, untrash, etc.
+         * @return void
+         */
+        public function _test_as_admin( $comment, $action ) {
+
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
+                $_POST[$action]       = 1;
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+                
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'delete-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+                
+                // Ensure everything is correct
+                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;comment['id'] );
+                $this-&gt;assertEquals( 'delete-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
+                $this-&gt;assertGreaterThanOrEqual( time() - 10, (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
+                $this-&gt;assertLessThanOrEqual( time(), (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
+                
+                // trash, spam, delete should make the total go down
+                if ( in_array( $action, array( 'trash', 'spam', 'delete' ) ) ) {
+                        $total = $_POST['_total'] - 1;
+
+                // unspam, untrash should make the total go up
+                } elseif ( in_array( $action, array( 'untrash', 'unspam' ) ) ) {
+                        $total = $_POST['_total'] + 1;
+                }
+                
+                // The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
+                $comment_count = wp_count_comments( 0 );
+                $recalc_total = $comment_count-&gt;total_comments;
+
+                // Check for either possible total
+                $this-&gt;assertTrue( in_array( (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;total[0] , array( $total, $recalc_total ) ) );
+        }
+        
+        /**
+         * Test as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @param string action trash, untrash, etc.
+         * @return void
+         */
+        public function _test_as_subscriber( $comment, $action ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Set up the $_POST request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
+                $_POST[$action]       = 1;
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'delete-comment' );
+        }
+
+        
+        /**
+         * Test with a bad nonce
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @param string action trash, untrash, etc.
+         * @return void
+         */
+        public function _test_with_bad_nonce( $comment, $action ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST[$action]       = 1;
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'delete-comment' );
+        }
+
+        /**
+         * Test with a bad id
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @param string action trash, untrash, etc.
+         * @return void
+         */
+        public function _test_with_bad_id( $comment, $action ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id']          = 12346789;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_12346789' );
+                $_POST[$action]       = 1;
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request, look for a timestamp in the exception
+                try {
+                        $this-&gt;_handleAjax( 'delete-comment' );
+                        $this-&gt;fail( 'Expected exception: WPAjaxDieStopException' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        $this-&gt;assertEquals( 10, strlen( $e-&gt;getMessage() ) );
+                        $this-&gt;assertTrue( is_numeric( $e-&gt;getMessage() ) );
+                } catch ( Exception $e ) {
+                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
+                }
+        }
+
+        /**
+         * Test doubling the action (e.g. trash a trashed comment)
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @param string action trash, untrash, etc.
+         * @return void
+         */
+        public function _test_double_action( $comment, $action ) {
+
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
+                $_POST[$action]       = 1;
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'delete-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                $this-&gt;_last_response = '';
+
+                // Force delete the comment
+                if ( 'delete' == $action ) {
+                        wp_delete_comment( $comment-&gt;comment_ID, true );
+                }
+
+                // Make the request again, look for a timestamp in the exception
+                try {
+                        $this-&gt;_handleAjax( 'delete-comment' );                        
+                        $this-&gt;fail( 'Expected exception: WPAjaxDieStopException' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        $this-&gt;assertEquals( 10, strlen( $e-&gt;getMessage() ) );
+                        $this-&gt;assertTrue( is_numeric( $e-&gt;getMessage() ) );
+                } catch ( Exception $e ) {
+                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
+                }
+        }
+
+        /**
+         * Delete a comment as an administrator (expects success)
+         * @return void
+         */
+        public function test_ajax_comment_trash_actions_as_administrator() {
+
+                // Test trash/untrash
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'trash' );
+                $this-&gt;_test_as_admin( $comment, 'untrash' );
+
+                // Test spam/unspam
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'spam' );
+                $this-&gt;_test_as_admin( $comment, 'unspam' );
+
+                // Test delete
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'delete' );
+        }
+
+        /**
+         * Delete a comment as a subscriber (expects permission denied)
+         * @return void
+         */
+        public function test_ajax_comment_trash_actions_as_subscriber() {
+        
+                // Test trash/untrash
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_subscriber( $comment, 'trash' );
+                $this-&gt;_test_as_subscriber( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_subscriber( $comment, 'spam' );
+                $this-&gt;_test_as_subscriber( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_subscriber( $comment, 'delete' );
+        }
+
+        /**
+         * Delete a comment with no id
+         * @return void
+         */
+        public function test_ajax_trash_comment_no_id() {
+        
+                // Test trash/untrash
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'trash' );
+                $this-&gt;_test_as_admin( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'spam' );
+                $this-&gt;_test_as_admin( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment, 'delete' );
+        }
+
+        /**
+         * Delete a comment with a bad nonce
+         * @return void
+         */
+        public function test_ajax_trash_comment_bad_nonce() {
+
+                // Test trash/untrash
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_with_bad_nonce( $comment, 'trash' );
+                $this-&gt;_test_with_bad_nonce( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_with_bad_nonce( $comment, 'spam' );
+                $this-&gt;_test_with_bad_nonce( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_with_bad_nonce( $comment, 'delete' );
+        }
+
+        /**
+         * Test trashing an already trashed comment, etc.
+         * @return void
+         */
+        public function test_ajax_trash_double_action() {
+
+                // Test trash/untrash
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_double_action( $comment, 'trash' );
+                $this-&gt;_test_double_action( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_double_action( $comment, 'spam' );
+                $this-&gt;_test_double_action( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_double_action( $comment, 'delete' );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxDimCommentphpfromrev903trunkteststestajaxactionstest_admin_ajax_dim_commentsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/DimComment.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_dim_comments.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/DimComment.php                                (rev 0)
+++ trunk/tests/ajax/DimComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,239 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase {
+
+        /**
+         * List of comments
+         * @var array
+         */
+        protected $_comments = array();
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;_comments = $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
+                $this-&gt;_comments = array_map( 'get_comment', $this-&gt;_comments );
+        }
+
+        /**
+         * Clear the POST actions in between requests
+         */
+        protected function _clear_post_action() {
+                unset($_POST['id']);
+                unset($_POST['new']);
+                $this-&gt;_last_response = '';
+        }
+        
+        /***********************************************************/
+        /** Test prototype
+        /***********************************************************/
+
+        /**
+         * Test as a privilged user (administrator)
+         * Expects test to pass
+         * @param mixed $comment Comment object
+         * @return void
+         */
+        public function _test_as_admin( $comment ) {
+
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment-&gt;comment_ID );
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+                
+                // Save the comment status
+                $prev_status          = wp_get_comment_status( $comment-&gt;comment_ID );
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'dim-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;comment['id'] );
+                $this-&gt;assertEquals( 'dim-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
+                $this-&gt;assertGreaterThanOrEqual( time() - 10, (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
+                $this-&gt;assertLessThanOrEqual( time(), (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
+
+                // Check the status
+                $current = wp_get_comment_status( $comment-&gt;comment_ID );
+                if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
+                        $this-&gt;assertEquals( 'approved', $current );
+                } else {
+                        $this-&gt;assertEquals( 'unapproved', $current );
+                }
+                
+                // The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
+                $comment_count = wp_count_comments( 0 );
+                $recalc_total = $comment_count-&gt;total_comments;
+                
+                // Delta is not specified, it will always be 1 lower than the request
+                $total = $_POST['_total'] - 1;
+
+                // Check for either possible total
+                $this-&gt;assertTrue( in_array( (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;total[0] , array( $total, $recalc_total ) ) );
+        }
+        
+        /**
+         * Test as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @return void
+         */
+        public function _test_as_subscriber( $comment ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Set up the $_POST request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment-&gt;comment_ID );
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'dim-comment' );
+        }
+        
+        /**
+         * Test with a bad nonce
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @return void
+         */
+        public function _test_with_bad_nonce( $comment ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id']          = $comment-&gt;comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'dim-comment' );
+        }
+
+        /**
+         * Test with a bad id
+         * Expects test to fail
+         * @param mixed $comment Comment object
+         * @return void
+         */
+        public function test_with_bad_id( $comment ) {
+                
+                // Reset request
+                $this-&gt;_clear_post_action();
+                
+                // Become a subscriber                
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id']          = 12346789;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'dim-comment_12346789' );
+                $_POST['_total']      = count( $this-&gt;_comments );
+                $_POST['_per_page']   = 100;
+                $_POST['_page']       = 1;
+                $_POST['_url']        = admin_url( 'edit-comments.php' );
+
+                // Make the request, look for a timestamp in the exception
+                try {
+                        $this-&gt;_handleAjax( 'dim-comment' );
+                        $this-&gt;fail( 'Expected exception: WPAjaxDieContinueException' );
+                } catch ( WPAjaxDieContinueException $e ) {
+
+                        // Get the response
+                        $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                        // Ensure everything is correct
+                        $this-&gt;assertEquals( '0', (string) $xml-&gt;response[0]-&gt;comment['id'] );
+                        $this-&gt;assertEquals( 'dim-comment_0', (string) $xml-&gt;response['action'] );
+                        $this-&gt;assertContains( 'Comment ' . $_POST['id'] . ' does not exist', $this-&gt;_last_response );
+
+                } catch ( Exception $e ) {
+                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
+                }
+        }
+
+        /**
+         * Dim a comment as an administrator (expects success)
+         * @return void
+         */
+        public function test_ajax_comment_dim_actions_as_administrator() {
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment );
+                $this-&gt;_test_as_admin( $comment );
+        }
+
+        /**
+         * Dim a comment as a subscriber (expects permission denied)
+         * @return void
+         */
+        public function test_ajax_comment_dim_actions_as_subscriber() {
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_subscriber( $comment );
+        }
+
+        /**
+         * Dim a comment with no id
+         * @return void
+         */
+        public function test_ajax_dim_comment_no_id() {
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_as_admin( $comment );
+        }
+
+        /**
+         * Dim a comment with a bad nonce
+         * @return void
+         */
+        public function test_ajax_dim_comment_bad_nonce() {
+                $comment = array_pop( $this-&gt;_comments );
+                $this-&gt;_test_with_bad_nonce( $comment );                
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxEditCommentphpfromrev903trunkteststestajaxactionstest_admin_ajax_edit_commentphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/EditComment.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_edit_comment.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/EditComment.php                                (rev 0)
+++ trunk/tests/ajax/EditComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_EditComments extends WP_Ajax_UnitTestCase {
+
+        /**
+         * A post with at least one comment
+         * @var mixed
+         */
+        protected $_comment_post = null;
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
+                $this-&gt;_comment_post = get_post( $post_id );
+        }
+
+        /**
+         * Get comments as a privilged user (administrator)
+         * Expects test to pass
+         * @return void
+         */
+        public function test_as_admin() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'edit-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this-&gt;assertEquals( -1, (string) $xml-&gt;response[0]-&gt;edit_comment['position'] );
+                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;edit_comment['id'] );
+                $this-&gt;assertEquals( 'edit-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
+                
+                // Check the payload
+                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;edit_comment[0]-&gt;response_data );
+                
+                // And supplemental is empty
+                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;edit_comment[0]-&gt;supplemental );
+        }
+
+        /**
+         * Get comments as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'edit-comment' );
+        }
+
+        /**
+         * Get comments with a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+                
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'get-comments' );
+        }
+
+        /**
+         * Get comments for an invalid post
+         * This should return valid XML
+         * @return void
+         */
+        public function test_invalid_comment() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID']                  = 123456789;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'edit-comment' );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxGetCommentsphpfromrev903trunkteststestajaxactionstest_admin_ajax_get_commentsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/GetComments.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_get_comments.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/GetComments.php                                (rev 0)
+++ trunk/tests/ajax/GetComments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase {
+
+        /**
+         * A post with at least one comment
+         * @var mixed
+         */
+        protected $_comment_post = null;
+        
+        /**
+         * A post with no comments
+         * @var mixed
+         */
+        protected $_no_comment_post = null;
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
+                $this-&gt;_comment_post = get_post( $post_id );
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;_no_comment_post = get_post( $post_id );
+        }
+
+        /**
+         * Get comments as a privilged user (administrator)
+         * Expects test to pass
+         * @return void
+         */
+        public function test_as_admin() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action']      = 'get-comments';
+                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
+                
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'get-comments' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this-&gt;assertEquals( 1, (string) $xml-&gt;response[0]-&gt;comments['position'] );
+                $this-&gt;assertEquals( 0, (string) $xml-&gt;response[0]-&gt;comments['id'] );
+                $this-&gt;assertEquals( 'get-comments_0', (string) $xml-&gt;response['action'] );
+                
+                // Check the payload
+                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;comments[0]-&gt;response_data );
+                
+                // And supplemental is empty
+                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;comments[0]-&gt;supplemental );
+        }
+
+        /**
+         * Get comments as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become a subscriber                
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action']      = 'get-comments';
+                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'get-comments' );
+        }
+
+        /**
+         * Get comments with a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST['action']      = 'get-comments';
+                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'get-comments' );
+        }
+
+        /**
+         * Get comments for an invalid post
+         * Bad post IDs are set to 0, this should return valid XML
+         * @return void
+         */
+        public function test_invalid_post() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action']      = 'get-comments';
+                $_POST['p']           = 'b0rk';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'get-comments' );
+        }
+
+        /**
+         * Get comments for an invalid post
+         * Bad post IDs are set to 0, this should return valid XML
+         * @return void
+         */
+        public function test_post_with_no_comments() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action']      = 'get-comments';
+                $_POST['p']           = $this-&gt;_no_comment_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '1' );
+                $this-&gt;_handleAjax( 'get-comments' );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxReplytoCommentphpfromrev903trunkteststestajaxactionstest_admin_ajax_replyto_commentphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/ReplytoComment.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_replyto_comment.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/ReplytoComment.php                                (rev 0)
+++ trunk/tests/ajax/ReplytoComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,227 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase {
+
+        /**
+         * A post with at least one comment
+         * @var mixed
+         */
+        protected $_comment_post = null;
+
+        /**
+         * Draft post
+         * @var mixed
+         */
+        protected $_draft_post = null;
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
+                $this-&gt;_comment_post = get_post( $post_id );
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_status' =&gt; 'draft' ) );
+                $this-&gt;_draft_post = get_post( $post_id );
+        }
+
+        /**
+         * Reply as a privilged user (administrator)
+         * Expects test to pass
+         * @return void
+         */
+        public function test_as_admin() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                    'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'replyto-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this-&gt;assertEquals( -1, (string) $xml-&gt;response[0]-&gt;comment['position'] );
+                $this-&gt;assertGreaterThan( 0, (int) $xml-&gt;response[0]-&gt;comment['id'] );
+                $this-&gt;assertNotEmpty( (string) $xml-&gt;response['action'] );
+
+                // Check the payload
+                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;comment[0]-&gt;response_data );
+
+                // And supplemental is empty
+                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental );
+        }
+
+        /**
+         * Reply as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'replyto-comment' );
+        }
+
+        /**
+         * Reply using a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                    'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'replyto-comment' );
+        }
+
+        /**
+         * Reply to an invalid post
+         * Expects test to fail
+         * @return void
+         */
+        public function test_invalid_post() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = 123456789;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'replyto-comment' );
+        }
+        
+        /**
+         * Reply to a draft post
+         * Expects test to fail
+         * @return void
+         */
+        public function test_with_draft_post() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = $this-&gt;_draft_post-&gt;ID;
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
+                $this-&gt;_handleAjax( 'replyto-comment' );
+        }
+        
+        /**
+         * Reply to a post with a simulated database failure
+         * Expects test to fail
+         * @global $wpdb
+         * @return void
+         */
+        public function test_blocked_comment() {
+                global $wpdb;
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
+
+                // Block comments from being saved, simulate a DB error
+                add_filter( 'query', array( $this, '_block_comments' ) );
+
+                // Make the request
+                try {
+                        $wpdb-&gt;suppress_errors( true );
+                        $this-&gt;_handleAjax( 'replyto-comment' );
+                        $wpdb-&gt;suppress_errors( false );
+                        $this-&gt;fail();
+                } catch ( WPAjaxDieStopException $e )  {
+                        $wpdb-&gt;suppress_errors( false );
+                        $this-&gt;assertContains( '1', $e-&gt;getMessage() );
+                }
+        }
+        
+        /**
+         * Block comments from being saved
+         * @param string $sql
+         * @return string
+         */
+        public function _block_comments( $sql ) {
+                global $wpdb;
+                if ( false !== strpos( $sql, $wpdb-&gt;comments ) &amp;&amp; 0 === stripos( trim ( $sql ), 'INSERT INTO') ) {
+                        remove_filter( 'query', array( $this, '_block_comments' ) );
+                        return '';
+                }
+                return $sql;
+        }
+}
</ins></span></pre></div>
<a id="trunktestsajaxTagSearchphpfromrev903trunkteststestajaxactionstest_admin_ajax_tag_searchphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ajax/TagSearch.php (from rev 903, trunk/tests/test-ajax-actions/test_admin_ajax_tag_search.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/TagSearch.php                                (rev 0)
+++ trunk/tests/ajax/TagSearch.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+&lt;?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax tag search functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_TagSearch extends WP_Ajax_UnitTestCase {
+
+        /**
+         * List of terms to insert on setup
+         * @var array
+         */
+        private $_terms = array(
+                'chattels', 'depo', 'energumen', 'figuriste', 'habergeon', 'impropriation'
+        );
+
+        /**
+         * Setup
+         * @todo use a term factory
+         */
+        public function setUp() {
+                parent::setUp();
+
+                foreach ( $this-&gt;_terms as $term )
+                        wp_insert_term( $term, 'post_tag' );
+        }
+
+        /**
+         * Test as an admin
+         */
+        public function test_post_tag() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q']   = 'chat';
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'ajax-tag-search' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Ensure we found the right match
+                $this-&gt;assertEquals( $this-&gt;_last_response, 'chattels' );
+        }
+
+        /**
+         * Test with no results
+         */
+        public function test_no_results() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q']   = md5(uniqid());
+
+                // Make the request
+                // No output, so we get a stop exception
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this-&gt;_handleAjax( 'ajax-tag-search' );
+        }
+
+        /**
+         * Test with commas
+         */
+        public function test_with_comma() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched
+
+                // Make the request
+                try {
+                        $this-&gt;_handleAjax( 'ajax-tag-search' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Ensure we found the right match
+                $this-&gt;assertEquals( $this-&gt;_last_response, 'chattels' );
+        }
+
+        /**
+         * Test as a logged out user
+         */
+        public function test_logged_out() {
+
+                // Log out
+                wp_logout();
+                
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q']   = 'chat';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'ajax-tag-search' );                
+        }
+
+        /**
+         * Test with an invalid taxonomy type
+         */
+        public function test_invalid_tax() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'invalid-taxonomy';
+                $_GET['q']   = 'chat';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this-&gt;_handleAjax( 'ajax-tag-search' );                
+        }
+        
+        /**
+         * Test as an unprivileged user
+         */
+        public function test_unprivileged_user() {
+
+                // Become an administrator
+                $this-&gt;_setRole( 'subscriber' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q']   = 'chat';
+
+                // Make the request
+                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this-&gt;_handleAjax( 'ajax-tag-search' );                
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_compression_testphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_compression_test.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_compression_test.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_compression_test.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,199 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax compression test functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCompressionTest extends WP_Ajax_UnitTestCase {
-        
-        /**
-         * Test as a logged out user
-         */
-        public function test_logged_out() {
-                $this-&gt;logout();
-
-                // Set up a default request
-                $_GET['test'] = 1;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this-&gt;_handleAjax( 'wp-compression-test' );
-        }
-        
-        /**
-         * Fetch the test text
-         */
-        public function test_text() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 1;
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this-&gt;assertContains( 'wpCompressionTest', $this-&gt;_last_response );
-        }
-
-        /**
-         * Fetch the test text (gzdeflate)
-         */
-        public function test_gzdeflate() {
-
-                if ( !function_exists( 'gzdeflate' ) ) {
-                        $this-&gt;markTestSkipped( 'gzdeflate function not available' );
-                }
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this-&gt;assertContains( 'wpCompressionTest', gzinflate( $this-&gt;_last_response ) );
-        }
-
-        /**
-         * Fetch the test text (gzencode)
-         */
-        public function test_gzencode() {
-
-                if ( !function_exists('gzencode') ) {
-                        $this-&gt;markTestSkipped( 'gzencode function not available' );
-                }
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this-&gt;assertContains( 'wpCompressionTest', $this-&gt;_gzdecode( $this-&gt;_last_response ) );
-        }
-        
-        /**
-         * Fetch the test text (unknown encoding)
-         */
-        public function test_unknown_encoding() {
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'wp-compression-test' );
-        }
-
-        /**
-         * Set the 'can_compress_scripts' site option to true
-         */
-        public function test_set_yes() {
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 'yes';
-
-                // Set the option to false
-                update_site_option( 'can_compress_scripts', 0 );
-                
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        unset( $e );
-                }
-                
-                // Check the site option
-                $this-&gt;assertEquals( 1, get_site_option( 'can_compress_scripts' ) );
-        }
-
-        /**
-         * Set the 'can_compress_scripts' site option to false
-         */
-        public function test_set_no() {
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 'no';
-
-                // Set the option to true
-                update_site_option( 'can_compress_scripts', 1 );
-                
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        unset( $e );
-                }
-                
-                // Check the site option
-                $this-&gt;assertEquals( 0, get_site_option( 'can_compress_scripts' ) );
-        }
-        
-        /**
-         * Undo gzencode.  This is ugly, but there's no stock gzdecode() function.
-         * @param string $encoded_data
-         * @return string
-         */
-        protected function _gzdecode( $encoded_data ) {
-                
-                // Save the encoded data to a temp file
-                $file = wp_tempnam( 'gzdecode' );
-                file_put_contents( $file, $encoded_data );
-
-                // Flush it to the output buffer and delete the temp file
-                ob_start();
-                readgzfile( $file );
-                unlink( $file );
-                
-                // Save the data stop buffering
-                $data = ob_get_clean();
-                ob_end_clean();
-
-                // Done
-                return $data;
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_delete_commentsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_delete_comments.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_delete_comments.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_delete_comments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,356 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax comment functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCommentsDelete extends WP_Ajax_UnitTestCase {
-
-        /**
-         * List of comments
-         * @var array
-         */
-        protected $_comments = array();
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;_comments = $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
-                $this-&gt;_comments = array_map( 'get_comment', $this-&gt;_comments );
-        }
-
-        /**
-         * Clear the POST actions in between requests
-         */
-        protected function _clear_post_action() {
-                unset($_POST['trash']);
-                unset($_POST['untrash']);
-                unset($_POST['spam']);
-                unset($_POST['unspam']);
-                unset($_POST['delete']);
-                $this-&gt;_last_response = '';
-        }
-        
-        /***********************************************************/
-        /** Test prototype
-    /***********************************************************/
-
-        /**
-         * Test as a privilged user (administrator)
-         * Expects test to pass
-         * @param mixed $comment Comment object
-         * @param string action trash, untrash, etc.
-         * @return void
-         */
-        public function _test_as_admin( $comment, $action ) {
-
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
-                $_POST[$action]       = 1;
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-                
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'delete-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-                
-                // Ensure everything is correct
-                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;comment['id'] );
-                $this-&gt;assertEquals( 'delete-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
-                $this-&gt;assertGreaterThanOrEqual( time() - 10, (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
-                $this-&gt;assertLessThanOrEqual( time(), (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
-                
-                // trash, spam, delete should make the total go down
-                if ( in_array( $action, array( 'trash', 'spam', 'delete' ) ) ) {
-                        $total = $_POST['_total'] - 1;
-
-                // unspam, untrash should make the total go up
-                } elseif ( in_array( $action, array( 'untrash', 'unspam' ) ) ) {
-                        $total = $_POST['_total'] + 1;
-                }
-                
-                // The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
-                $comment_count = wp_count_comments( 0 );
-                $recalc_total = $comment_count-&gt;total_comments;
-
-                // Check for either possible total
-                $this-&gt;assertTrue( in_array( (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;total[0] , array( $total, $recalc_total ) ) );
-        }
-        
-        /**
-         * Test as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @param string action trash, untrash, etc.
-         * @return void
-         */
-        public function _test_as_subscriber( $comment, $action ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Set up the $_POST request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
-                $_POST[$action]       = 1;
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'delete-comment' );
-        }
-
-        
-        /**
-         * Test with a bad nonce
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @param string action trash, untrash, etc.
-         * @return void
-         */
-        public function _test_with_bad_nonce( $comment, $action ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST[$action]       = 1;
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'delete-comment' );
-        }
-
-        /**
-         * Test with a bad id
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @param string action trash, untrash, etc.
-         * @return void
-         */
-        public function _test_with_bad_id( $comment, $action ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id']          = 12346789;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_12346789' );
-                $_POST[$action]       = 1;
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request, look for a timestamp in the exception
-                try {
-                        $this-&gt;_handleAjax( 'delete-comment' );
-                        $this-&gt;fail( 'Expected exception: WPAjaxDieStopException' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        $this-&gt;assertEquals( 10, strlen( $e-&gt;getMessage() ) );
-                        $this-&gt;assertTrue( is_numeric( $e-&gt;getMessage() ) );
-                } catch ( Exception $e ) {
-                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
-                }
-        }
-
-        /**
-         * Test doubling the action (e.g. trash a trashed comment)
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @param string action trash, untrash, etc.
-         * @return void
-         */
-        public function _test_double_action( $comment, $action ) {
-
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment-&gt;comment_ID );
-                $_POST[$action]       = 1;
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'delete-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                $this-&gt;_last_response = '';
-
-                // Force delete the comment
-                if ( 'delete' == $action ) {
-                        wp_delete_comment( $comment-&gt;comment_ID, true );
-                }
-
-                // Make the request again, look for a timestamp in the exception
-                try {
-                        $this-&gt;_handleAjax( 'delete-comment' );                        
-                        $this-&gt;fail( 'Expected exception: WPAjaxDieStopException' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        $this-&gt;assertEquals( 10, strlen( $e-&gt;getMessage() ) );
-                        $this-&gt;assertTrue( is_numeric( $e-&gt;getMessage() ) );
-                } catch ( Exception $e ) {
-                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
-                }
-        }
-
-        /**
-         * Delete a comment as an administrator (expects success)
-         * @return void
-         */
-        public function test_ajax_comment_trash_actions_as_administrator() {
-
-                // Test trash/untrash
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'trash' );
-                $this-&gt;_test_as_admin( $comment, 'untrash' );
-
-                // Test spam/unspam
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'spam' );
-                $this-&gt;_test_as_admin( $comment, 'unspam' );
-
-                // Test delete
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'delete' );
-        }
-
-        /**
-         * Delete a comment as a subscriber (expects permission denied)
-         * @return void
-         */
-        public function test_ajax_comment_trash_actions_as_subscriber() {
-        
-                // Test trash/untrash
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_subscriber( $comment, 'trash' );
-                $this-&gt;_test_as_subscriber( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_subscriber( $comment, 'spam' );
-                $this-&gt;_test_as_subscriber( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_subscriber( $comment, 'delete' );
-        }
-
-        /**
-         * Delete a comment with no id
-         * @return void
-         */
-        public function test_ajax_trash_comment_no_id() {
-        
-                // Test trash/untrash
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'trash' );
-                $this-&gt;_test_as_admin( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'spam' );
-                $this-&gt;_test_as_admin( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment, 'delete' );
-        }
-
-        /**
-         * Delete a comment with a bad nonce
-         * @return void
-         */
-        public function test_ajax_trash_comment_bad_nonce() {
-
-                // Test trash/untrash
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_with_bad_nonce( $comment, 'trash' );
-                $this-&gt;_test_with_bad_nonce( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_with_bad_nonce( $comment, 'spam' );
-                $this-&gt;_test_with_bad_nonce( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_with_bad_nonce( $comment, 'delete' );
-        }
-
-        /**
-         * Test trashing an already trashed comment, etc.
-         * @return void
-         */
-        public function test_ajax_trash_double_action() {
-
-                // Test trash/untrash
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_double_action( $comment, 'trash' );
-                $this-&gt;_test_double_action( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_double_action( $comment, 'spam' );
-                $this-&gt;_test_double_action( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_double_action( $comment, 'delete' );
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_dim_commentsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_dim_comments.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_dim_comments.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_dim_comments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,239 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax comment functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCommentsDim extends WP_Ajax_UnitTestCase {
-
-        /**
-         * List of comments
-         * @var array
-         */
-        protected $_comments = array();
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;_comments = $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
-                $this-&gt;_comments = array_map( 'get_comment', $this-&gt;_comments );
-        }
-
-        /**
-         * Clear the POST actions in between requests
-         */
-        protected function _clear_post_action() {
-                unset($_POST['id']);
-                unset($_POST['new']);
-                $this-&gt;_last_response = '';
-        }
-        
-        /***********************************************************/
-        /** Test prototype
-        /***********************************************************/
-
-        /**
-         * Test as a privilged user (administrator)
-         * Expects test to pass
-         * @param mixed $comment Comment object
-         * @return void
-         */
-        public function _test_as_admin( $comment ) {
-
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment-&gt;comment_ID );
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-                
-                // Save the comment status
-                $prev_status          = wp_get_comment_status( $comment-&gt;comment_ID );
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'dim-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;comment['id'] );
-                $this-&gt;assertEquals( 'dim-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
-                $this-&gt;assertGreaterThanOrEqual( time() - 10, (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
-                $this-&gt;assertLessThanOrEqual( time(), (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;time[0] );
-
-                // Check the status
-                $current = wp_get_comment_status( $comment-&gt;comment_ID );
-                if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
-                        $this-&gt;assertEquals( 'approved', $current );
-                } else {
-                        $this-&gt;assertEquals( 'unapproved', $current );
-                }
-                
-                // The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
-                $comment_count = wp_count_comments( 0 );
-                $recalc_total = $comment_count-&gt;total_comments;
-                
-                // Delta is not specified, it will always be 1 lower than the request
-                $total = $_POST['_total'] - 1;
-
-                // Check for either possible total
-                $this-&gt;assertTrue( in_array( (int) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental[0]-&gt;total[0] , array( $total, $recalc_total ) ) );
-        }
-        
-        /**
-         * Test as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @return void
-         */
-        public function _test_as_subscriber( $comment ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Set up the $_POST request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment-&gt;comment_ID );
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'dim-comment' );
-        }
-        
-        /**
-         * Test with a bad nonce
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @return void
-         */
-        public function _test_with_bad_nonce( $comment ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id']          = $comment-&gt;comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'dim-comment' );
-        }
-
-        /**
-         * Test with a bad id
-         * Expects test to fail
-         * @param mixed $comment Comment object
-         * @return void
-         */
-        public function test_with_bad_id( $comment ) {
-                
-                // Reset request
-                $this-&gt;_clear_post_action();
-                
-                // Become a subscriber                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id']          = 12346789;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'dim-comment_12346789' );
-                $_POST['_total']      = count( $this-&gt;_comments );
-                $_POST['_per_page']   = 100;
-                $_POST['_page']       = 1;
-                $_POST['_url']        = admin_url( 'edit-comments.php' );
-
-                // Make the request, look for a timestamp in the exception
-                try {
-                        $this-&gt;_handleAjax( 'dim-comment' );
-                        $this-&gt;fail( 'Expected exception: WPAjaxDieContinueException' );
-                } catch ( WPAjaxDieContinueException $e ) {
-
-                        // Get the response
-                        $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                        // Ensure everything is correct
-                        $this-&gt;assertEquals( '0', (string) $xml-&gt;response[0]-&gt;comment['id'] );
-                        $this-&gt;assertEquals( 'dim-comment_0', (string) $xml-&gt;response['action'] );
-                        $this-&gt;assertContains( 'Comment ' . $_POST['id'] . ' does not exist', $this-&gt;_last_response );
-
-                } catch ( Exception $e ) {
-                        $this-&gt;fail( 'Unexpected exception type: ' . get_class( $e ) );
-                }
-        }
-
-        /**
-         * Dim a comment as an administrator (expects success)
-         * @return void
-         */
-        public function test_ajax_comment_dim_actions_as_administrator() {
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment );
-                $this-&gt;_test_as_admin( $comment );
-        }
-
-        /**
-         * Dim a comment as a subscriber (expects permission denied)
-         * @return void
-         */
-        public function test_ajax_comment_dim_actions_as_subscriber() {
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_subscriber( $comment );
-        }
-
-        /**
-         * Dim a comment with no id
-         * @return void
-         */
-        public function test_ajax_dim_comment_no_id() {
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_as_admin( $comment );
-        }
-
-        /**
-         * Dim a comment with a bad nonce
-         * @return void
-         */
-        public function test_ajax_dim_comment_bad_nonce() {
-                $comment = array_pop( $this-&gt;_comments );
-                $this-&gt;_test_with_bad_nonce( $comment );                
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_edit_commentphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_edit_comment.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_edit_comment.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_edit_comment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,149 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax comment functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCommentsEdit extends WP_Ajax_UnitTestCase {
-
-        /**
-         * A post with at least one comment
-         * @var mixed
-         */
-        protected $_comment_post = null;
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
-                $this-&gt;_comment_post = get_post( $post_id );
-        }
-
-        /**
-         * Get comments as a privilged user (administrator)
-         * Expects test to pass
-         * @return void
-         */
-        public function test_as_admin() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'edit-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this-&gt;assertEquals( -1, (string) $xml-&gt;response[0]-&gt;edit_comment['position'] );
-                $this-&gt;assertEquals( $comment-&gt;comment_ID, (string) $xml-&gt;response[0]-&gt;edit_comment['id'] );
-                $this-&gt;assertEquals( 'edit-comment_' . $comment-&gt;comment_ID, (string) $xml-&gt;response['action'] );
-                
-                // Check the payload
-                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;edit_comment[0]-&gt;response_data );
-                
-                // And supplemental is empty
-                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;edit_comment[0]-&gt;supplemental );
-        }
-
-        /**
-         * Get comments as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'edit-comment' );
-        }
-
-        /**
-         * Get comments with a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-                
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'get-comments' );
-        }
-
-        /**
-         * Get comments for an invalid post
-         * This should return valid XML
-         * @return void
-         */
-        public function test_invalid_comment() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID']                  = 123456789;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'edit-comment' );
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_get_commentsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_get_comments.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_get_comments.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_get_comments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,160 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax comment functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCommentsGet extends WP_Ajax_UnitTestCase {
-
-        /**
-         * A post with at least one comment
-         * @var mixed
-         */
-        protected $_comment_post = null;
-        
-        /**
-         * A post with no comments
-         * @var mixed
-         */
-        protected $_no_comment_post = null;
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
-                $this-&gt;_comment_post = get_post( $post_id );
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;_no_comment_post = get_post( $post_id );
-        }
-
-        /**
-         * Get comments as a privilged user (administrator)
-         * Expects test to pass
-         * @return void
-         */
-        public function test_as_admin() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action']      = 'get-comments';
-                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
-                
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'get-comments' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this-&gt;assertEquals( 1, (string) $xml-&gt;response[0]-&gt;comments['position'] );
-                $this-&gt;assertEquals( 0, (string) $xml-&gt;response[0]-&gt;comments['id'] );
-                $this-&gt;assertEquals( 'get-comments_0', (string) $xml-&gt;response['action'] );
-                
-                // Check the payload
-                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;comments[0]-&gt;response_data );
-                
-                // And supplemental is empty
-                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;comments[0]-&gt;supplemental );
-        }
-
-        /**
-         * Get comments as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become a subscriber                
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action']      = 'get-comments';
-                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'get-comments' );
-        }
-
-        /**
-         * Get comments with a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST['action']      = 'get-comments';
-                $_POST['p']           = $this-&gt;_comment_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'get-comments' );
-        }
-
-        /**
-         * Get comments for an invalid post
-         * Bad post IDs are set to 0, this should return valid XML
-         * @return void
-         */
-        public function test_invalid_post() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action']      = 'get-comments';
-                $_POST['p']           = 'b0rk';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'get-comments' );
-        }
-
-        /**
-         * Get comments for an invalid post
-         * Bad post IDs are set to 0, this should return valid XML
-         * @return void
-         */
-        public function test_post_with_no_comments() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action']      = 'get-comments';
-                $_POST['p']           = $this-&gt;_no_comment_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '1' );
-                $this-&gt;_handleAjax( 'get-comments' );
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_replyto_commentphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_replyto_comment.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_replyto_comment.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_replyto_comment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,227 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax comment functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxCommentsReply extends WP_Ajax_UnitTestCase {
-
-        /**
-         * A post with at least one comment
-         * @var mixed
-         */
-        protected $_comment_post = null;
-
-        /**
-         * Draft post
-         * @var mixed
-         */
-        protected $_draft_post = null;
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 5 );
-                $this-&gt;_comment_post = get_post( $post_id );
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_status' =&gt; 'draft' ) );
-                $this-&gt;_draft_post = get_post( $post_id );
-        }
-
-        /**
-         * Reply as a privilged user (administrator)
-         * Expects test to pass
-         * @return void
-         */
-        public function test_as_admin() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                    'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'replyto-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this-&gt;assertEquals( -1, (string) $xml-&gt;response[0]-&gt;comment['position'] );
-                $this-&gt;assertGreaterThan( 0, (int) $xml-&gt;response[0]-&gt;comment['id'] );
-                $this-&gt;assertNotEmpty( (string) $xml-&gt;response['action'] );
-
-                // Check the payload
-                $this-&gt;assertNotEmpty( (string) $xml-&gt;response[0]-&gt;comment[0]-&gt;response_data );
-
-                // And supplemental is empty
-                $this-&gt;assertEmpty( (string) $xml-&gt;response[0]-&gt;comment[0]-&gt;supplemental );
-        }
-
-        /**
-         * Reply as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'replyto-comment' );
-        }
-
-        /**
-         * Reply using a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                    'post_id' =&gt; $this-&gt;_comment_post-&gt;ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
-                $_POST['comment_ID']                  = $comment-&gt;comment_ID;
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'replyto-comment' );
-        }
-
-        /**
-         * Reply to an invalid post
-         * Expects test to fail
-         * @return void
-         */
-        public function test_invalid_post() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = 123456789;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'replyto-comment' );
-        }
-        
-        /**
-         * Reply to a draft post
-         * Expects test to fail
-         * @return void
-         */
-        public function test_with_draft_post() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = $this-&gt;_draft_post-&gt;ID;
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
-                $this-&gt;_handleAjax( 'replyto-comment' );
-        }
-        
-        /**
-         * Reply to a post with a simulated database failure
-         * Expects test to fail
-         * @global $wpdb
-         * @return void
-         */
-        public function test_blocked_comment() {
-                global $wpdb;
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID']             = $this-&gt;_comment_post-&gt;ID;
-
-                // Block comments from being saved, simulate a DB error
-                add_filter( 'query', array( $this, '_block_comments' ) );
-
-                // Make the request
-                try {
-                        $wpdb-&gt;suppress_errors( true );
-                        $this-&gt;_handleAjax( 'replyto-comment' );
-                        $wpdb-&gt;suppress_errors( false );
-                        $this-&gt;fail();
-                } catch ( WPAjaxDieStopException $e )  {
-                        $wpdb-&gt;suppress_errors( false );
-                        $this-&gt;assertContains( '1', $e-&gt;getMessage() );
-                }
-        }
-        
-        /**
-         * Block comments from being saved
-         * @param string $sql
-         * @return string
-         */
-        public function _block_comments( $sql ) {
-                global $wpdb;
-                if ( false !== strpos( $sql, $wpdb-&gt;comments ) &amp;&amp; 0 === stripos( trim ( $sql ), 'INSERT INTO') ) {
-                        remove_filter( 'query', array( $this, '_block_comments' ) );
-                        return '';
-                }
-                return $sql;
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_save_draftphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_save_draft.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_save_draft.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_save_draft.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,229 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax save draft functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxSaveDraft extends WP_Ajax_UnitTestCase {
-
-        /**
-         * Post
-         * @var mixed
-         */
-        protected $_post = null;
-        
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_status' =&gt; 'draft' ) );
-                $this-&gt;_post = get_post( $post_id );
-        }
-
-        /**
-         * Test autosaving as a logged out user
-         * @return void
-         */
-        public function test_nopriv_autosave() {
-                
-                // Log out
-                wp_logout();
-                
-                // Set up a default request
-                $_POST = array(
-                    'post_ID'  =&gt; 1,
-                    'autosave' =&gt; 1
-                );
-                
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'nopriv_autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this-&gt;assertEquals( 1, (string) $xml-&gt;response[0]-&gt;autosave['id'] );
-                $this-&gt;assertEquals( 'nopriv_autosave_1', (string) $xml-&gt;response['action'] );
-        }
-
-        /**
-         * Test as a logged out user with no post id
-         * @return void
-         */
-        public function test_nopriv_no_postid() {
-                
-                // Log out
-                wp_logout();
-                
-                // Set up a request
-                $_POST = array(
-                    'autosave'      =&gt; 1
-                );
-                
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'nopriv_autosave' );
-        }
-        
-        /**
-         * Test autosaving a post
-         * @return void
-         */
-        public function test_autosave_post() {
-
-                // Become an admin
-                $this-&gt;_setRole( 'administrator' );
-                        
-                // Set up the $_POST request
-                $md5 = md5( uniqid() );
-                $_POST = array(
-                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
-                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
-                    'post_content'  =&gt; $this-&gt;_post-&gt;post_content . PHP_EOL . $md5,
-                    'autosave'      =&gt; 1
-                );
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this-&gt;assertEquals( $this-&gt;_post-&gt;ID, (int) $xml-&gt;response[0]-&gt;autosave['id'] );
-                $this-&gt;assertEquals( 'autosave_' . $this-&gt;_post-&gt;ID, (string) $xml-&gt;response['action']);
-                
-                // Check that the edit happened
-                $post = get_post( $this-&gt;_post-&gt;ID) ;
-                $this-&gt;assertGreaterThanOrEqual( 0, strpos( $post-&gt;post_content, $md5 ) );
-        }
-
-        /**
-         * Test with an invalid nonce
-         * @return void
-         */
-        public function test_with_invalid_nonce( ) {
-                
-                // Become an administrator                
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST = array(
-                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
-                    'autosavenonce' =&gt; md5( uniqid() ),
-                    'autosave'      =&gt; 1
-                );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'autosave' );
-        }
-        
-        /**
-         * Test with a bad post id
-         * @return void
-         */
-        public function test_with_invalid_post_id( ) {
-                
-                // Become an administrator        
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST = array(
-                    'post_ID'       =&gt; 0,
-                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
-                    'autosave'      =&gt; 1
-                );
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', 'You are not allowed to edit this post.' );
-                $this-&gt;_handleAjax( 'autosave' );
-        }
-        
-        /**
-         * Test with a locked post
-         * @return void
-         */
-        public function test_locked_post() {
-
-                // Become an administrator                
-                $this-&gt;_setRole( 'administrator' );
-                
-                // Lock the post
-                wp_set_post_lock( $this-&gt;_post-&gt;ID );
-                
-                // Become a different administrator
-                $this-&gt;_setRole( 'administrator' );
-        
-                // Set up the $_POST request
-                $_POST = array(
-                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
-                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
-                    'autosave'      =&gt; 1
-                );
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this-&gt;_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this-&gt;assertEquals( $this-&gt;_post-&gt;ID, (int) $xml-&gt;response[0]-&gt;autosave['id'] );
-                $this-&gt;assertEquals( 'autosave_' . $this-&gt;_post-&gt;ID, (string) $xml-&gt;response['action']);
-                $this-&gt;assertEquals( 'disable', (string) $xml-&gt;response[0]-&gt;autosave[0]-&gt;supplemental[0]-&gt;disable_autosave);
-        }
-
-
-        /**
-         * Test with a browser that is about to be logged out
-         * @return void
-         */
-        public function test_past_grace_period() {
-                global $login_grace_period;
-                $login_grace_period = 1;
-
-                // Become an admnistrator                
-                $this-&gt;_setRole( 'administrator' );
-                        
-                // Set up the $_POST request
-                $_POST = array(
-                    'post_ID'       =&gt; $this-&gt;_post-&gt;ID,
-                    'autosavenonce' =&gt; wp_create_nonce( 'autosave' ),
-                    'autosave'      =&gt; 1
-                );
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Look for the warning
-                $this-&gt;assertRegExp( '/Your login has expired. Please open a new browser window/' , $this-&gt;_last_response );
-        }
-}
</del></span></pre></div>
<a id="trunktestsajaxtest_admin_ajax_tag_searchphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/ajax/test_admin_ajax_tag_search.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-ajax-actions/test_admin_ajax_tag_search.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/ajax/test_admin_ajax_tag_search.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,153 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Admin ajax functions to be tested
- */
-include_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
-
-/**
- * Testing ajax tag search functionality
- *
- * @package    WordPress
- * @subpackage UnitTests
- * @since      3.4.0
- * @group      ajax
- * @runTestsInSeparateProcesses
- */
-class TestAjaxTagSearch extends WP_Ajax_UnitTestCase {
-
-        /**
-         * List of terms to insert on setup
-         * @var array
-         */
-        private $_terms = array(
-                'chattels', 'depo', 'energumen', 'figuriste', 'habergeon', 'impropriation'
-        );
-
-        /**
-         * Setup
-         * @todo use a term factory
-         */
-        public function setUp() {
-                parent::setUp();
-
-                foreach ( $this-&gt;_terms as $term )
-                        wp_insert_term( $term, 'post_tag' );
-        }
-
-        /**
-         * Test as an admin
-         */
-        public function test_post_tag() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q']   = 'chat';
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'ajax-tag-search' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Ensure we found the right match
-                $this-&gt;assertEquals( $this-&gt;_last_response, 'chattels' );
-        }
-
-        /**
-         * Test with no results
-         */
-        public function test_no_results() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q']   = md5(uniqid());
-
-                // Make the request
-                // No output, so we get a stop exception
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this-&gt;_handleAjax( 'ajax-tag-search' );
-        }
-
-        /**
-         * Test with commas
-         */
-        public function test_with_comma() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched
-
-                // Make the request
-                try {
-                        $this-&gt;_handleAjax( 'ajax-tag-search' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Ensure we found the right match
-                $this-&gt;assertEquals( $this-&gt;_last_response, 'chattels' );
-        }
-
-        /**
-         * Test as a logged out user
-         */
-        public function test_logged_out() {
-
-                // Log out
-                wp_logout();
-                
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q']   = 'chat';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'ajax-tag-search' );                
-        }
-
-        /**
-         * Test with an invalid taxonomy type
-         */
-        public function test_invalid_tax() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'invalid-taxonomy';
-                $_GET['q']   = 'chat';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this-&gt;_handleAjax( 'ajax-tag-search' );                
-        }
-        
-        /**
-         * Test as an unprivileged user
-         */
-        public function test_unprivileged_user() {
-
-                // Become an administrator
-                $this-&gt;_setRole( 'subscriber' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q']   = 'chat';
-
-                // Make the request
-                $this-&gt;setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this-&gt;_handleAjax( 'ajax-tag-search' );                
-        }
-
-}
</del></span></pre></div>
<a id="trunktestsbasicphpfromrev903trunkteststest_metaphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/basic.php (from rev 903, trunk/tests/test_meta.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/basic.php                                (rev 0)
+++ trunk/tests/basic.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+&lt;?php
+
+/**
+ * just make sure the test framework is working
+ *
+ * @group testsuite
+ */
+class Tests_Basic extends WP_UnitTestCase {
+        var $val;
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;val = true;
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $this-&gt;val = false;
+        }
+
+        function test_true() {
+                $this-&gt;assertTrue($this-&gt;val);
+        }
+
+        // two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
+        function test_globals() {
+                global $test_foo;
+                $test_foo = array('foo', 'bar', 'baz');
+
+                function test_globals_foo() {
+                        unset($GLOBALS['test_foo'][1]);
+                }
+
+                test_globals_foo();
+
+                $this-&gt;assertEquals($test_foo, array(0=&gt;'foo', 2=&gt;'baz'));
+                $this-&gt;assertEquals($test_foo, $GLOBALS['test_foo']);
+        }
+
+        function test_globals_bar() {
+                global $test_bar;
+                $test_bar = array('a', 'b', 'c');
+                $this-&gt;assertEquals($test_bar, $GLOBALS['test_bar']);
+        }
+
+        // test some helper utility functions
+
+        function test_strip_ws() {
+                $this-&gt;assertEquals('', strip_ws(''));
+                $this-&gt;assertEquals('foo', strip_ws('foo'));
+                $this-&gt;assertEquals('', strip_ws(&quot;\r\n\t  \n\r\t&quot;));
+
+                $in  = &quot;asdf\n&quot;;
+                $in .= &quot;asdf asdf\n&quot;;
+                $in .= &quot;asdf     asdf\n&quot;;
+                $in .= &quot;\tasdf\n&quot;;
+                $in .= &quot;\tasdf\t\n&quot;;
+                $in .= &quot;\t\tasdf\n&quot;;
+                $in .= &quot;foo bar\n\r\n&quot;;
+                $in .= &quot;foo\n&quot;;
+
+                $expected  = &quot;asdf\n&quot;;
+                $expected .= &quot;asdf asdf\n&quot;;
+                $expected .= &quot;asdf     asdf\n&quot;;
+                $expected .= &quot;asdf\n&quot;;
+                $expected .= &quot;asdf\n&quot;;
+                $expected .= &quot;asdf\n&quot;;
+                $expected .= &quot;foo bar\n&quot;;
+                $expected .= &quot;foo&quot;;
+
+                $this-&gt;assertEquals($expected, strip_ws($in));
+
+        }
+
+        function test_mask_input_value() {
+                $in = &lt;&lt;&lt;EOF
+&lt;h2&gt;Assign Authors&lt;/h2&gt;
+&lt;p&gt;To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as &lt;code&gt;admin&lt;/code&gt;s entries.&lt;/p&gt;
+&lt;p&gt;If a new user is created by WordPress, the password will be set, by default, to &quot;changeme&quot;. Quite suggestive, eh? ;)&lt;/p&gt;
+        &lt;ol id=&quot;authors&quot;&gt;&lt;form action=&quot;?import=wordpress&amp;amp;step=2&amp;amp;id=&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wpnonce&quot; value=&quot;855ae98911&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wp_http_referer&quot; value=&quot;wp-test.php&quot; /&gt;&lt;li&gt;Current author: &lt;strong&gt;Alex Shiels&lt;/strong&gt;&lt;br /&gt;Create user  &lt;input type=&quot;text&quot; value=&quot;Alex Shiels&quot; name=&quot;user[]&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt; or map to existing&lt;select name=&quot;userselect[0]&quot;&gt;
+EOF;
+                // _wpnonce value should be replaced with 'xxx'
+                $expected = &lt;&lt;&lt;EOF
+&lt;h2&gt;Assign Authors&lt;/h2&gt;
+&lt;p&gt;To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as &lt;code&gt;admin&lt;/code&gt;s entries.&lt;/p&gt;
+&lt;p&gt;If a new user is created by WordPress, the password will be set, by default, to &quot;changeme&quot;. Quite suggestive, eh? ;)&lt;/p&gt;
+        &lt;ol id=&quot;authors&quot;&gt;&lt;form action=&quot;?import=wordpress&amp;amp;step=2&amp;amp;id=&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wpnonce&quot; value=&quot;***&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wp_http_referer&quot; value=&quot;wp-test.php&quot; /&gt;&lt;li&gt;Current author: &lt;strong&gt;Alex Shiels&lt;/strong&gt;&lt;br /&gt;Create user  &lt;input type=&quot;text&quot; value=&quot;Alex Shiels&quot; name=&quot;user[]&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt; or map to existing&lt;select name=&quot;userselect[0]&quot;&gt;
+EOF;
+                $this-&gt;assertEquals($expected, mask_input_value($in));
+        }
+}
</ins></span></pre></div>
<a id="trunktestscachephpfromrev903trunkteststest_includes_cachephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/cache.php (from rev 903, trunk/tests/test_includes_cache.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/cache.php                                (rev 0)
+++ trunk/tests/cache.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,151 @@
</span><ins>+&lt;?php
+
+/**
+ * @group cache
+ */
+class TestObjectCache extends WP_UnitTestCase {
+        var $cache = NULL;
+
+        function setUp() {
+                parent::setUp();
+                // create two cache objects with a shared cache dir
+                // this simulates a typical cache situation, two separate requests interacting
+                $this-&gt;cache =&amp; $this-&gt;init_cache();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $this-&gt;flush_cache();
+        }
+
+        function &amp;init_cache() {
+                $cache = new WP_Object_Cache();
+                return $cache;
+        }
+
+        function test_miss() {
+                $this-&gt;assertEquals(NULL, $this-&gt;cache-&gt;get(rand_str()));
+        }
+
+        function test_add_get() {
+                $key = rand_str();
+                $val = rand_str();
+
+                $this-&gt;cache-&gt;add($key, $val);
+                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
+        }
+
+        function test_add_get_0() {
+                $key = rand_str();
+                $val = 0;
+
+                // you can store zero in the cache
+                $this-&gt;cache-&gt;add($key, $val);
+                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
+        }
+
+        function test_add_get_null() {
+                $key = rand_str();
+                $val = null;
+
+                $this-&gt;assertTrue( $this-&gt;cache-&gt;add($key, $val) );
+                // null is converted to empty string
+                $this-&gt;assertEquals( '', $this-&gt;cache-&gt;get($key) );
+        }
+
+        function test_add() {
+                $key = rand_str();
+                $val1 = rand_str();
+                $val2 = rand_str();
+
+                // add $key to the cache
+                $this-&gt;assertTrue($this-&gt;cache-&gt;add($key, $val1));
+                $this-&gt;assertEquals($val1, $this-&gt;cache-&gt;get($key));
+                // $key is in the cache, so reject new calls to add()
+                $this-&gt;assertFalse($this-&gt;cache-&gt;add($key, $val2));
+                $this-&gt;assertEquals($val1, $this-&gt;cache-&gt;get($key));
+        }
+
+        function test_replace() {
+                $key = rand_str();
+                $val = rand_str();
+
+                // memcached rejects replace() if the key does not exist
+                $this-&gt;assertFalse($this-&gt;cache-&gt;replace($key, $val));
+                $this-&gt;assertFalse($this-&gt;cache-&gt;get($key));
+        }
+
+        function test_set() {
+                $key = rand_str();
+                $val = rand_str();
+
+                // memcached accepts set() if the key does not exist
+                $this-&gt;assertTrue($this-&gt;cache-&gt;set($key, $val));
+                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
+        }
+
+        function test_flush() {
+                $key = rand_str();
+                $val = rand_str();
+
+                $this-&gt;cache-&gt;add($key, $val);
+                // item is visible to both cache objects
+                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
+                $this-&gt;cache-&gt;flush();
+                // If there is no value get returns false.
+                $this-&gt;assertFalse($this-&gt;cache-&gt;get($key));
+        }
+
+        // Make sure objects are cloned going to and from the cache
+        function test_object_refs() {
+                $key = rand_str();
+                $object_a = new stdClass;
+                $object_a-&gt;foo = 'alpha';
+                $this-&gt;cache-&gt;set( $key, $object_a );
+                $object_a-&gt;foo = 'bravo';
+                $object_b = $this-&gt;cache-&gt;get( $key );
+                $this-&gt;assertEquals( 'alpha', $object_b-&gt;foo );
+                $object_b-&gt;foo = 'charlie';
+                $this-&gt;assertEquals( 'bravo', $object_a-&gt;foo );
+
+                $key = rand_str();
+                $object_a = new stdClass;
+                $object_a-&gt;foo = 'alpha';
+                $this-&gt;cache-&gt;add( $key, $object_a );
+                $object_a-&gt;foo = 'bravo';
+                $object_b = $this-&gt;cache-&gt;get( $key );
+                $this-&gt;assertEquals( 'alpha', $object_b-&gt;foo );
+                $object_b-&gt;foo = 'charlie';
+                $this-&gt;assertEquals( 'bravo', $object_a-&gt;foo );
+        }
+
+        function test_incr() {
+                $key = rand_str();
+
+                $this-&gt;assertFalse( $this-&gt;cache-&gt;incr( $key ) );
+
+                $this-&gt;cache-&gt;set( $key, 0 );
+                $this-&gt;cache-&gt;incr( $key );
+                $this-&gt;assertEquals( 1, $this-&gt;cache-&gt;get( $key ) );
+
+                $this-&gt;cache-&gt;incr( $key, 2 );
+                $this-&gt;assertEquals( 3, $this-&gt;cache-&gt;get( $key ) );
+        }
+
+        function test_decr() {
+                $key = rand_str();
+
+                $this-&gt;assertFalse( $this-&gt;cache-&gt;decr( $key ) );
+
+                $this-&gt;cache-&gt;set( $key, 0 );
+                $this-&gt;cache-&gt;decr( $key );
+                $this-&gt;assertEquals( 0, $this-&gt;cache-&gt;get( $key ) );
+
+                $this-&gt;cache-&gt;set( $key, 3 );
+                $this-&gt;cache-&gt;decr( $key );
+                $this-&gt;assertEquals( 2, $this-&gt;cache-&gt;get( $key ) );
+
+                $this-&gt;cache-&gt;decr( $key, 2 );
+                $this-&gt;assertEquals( 0, $this-&gt;cache-&gt;get( $key ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscanonicalcustomRulesphpfromrev903trunkteststest_includes_canonicalphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/canonical/customRules.php (from rev 903, trunk/tests/test_includes_canonical.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/canonical/customRules.php                                (rev 0)
+++ trunk/tests/canonical/customRules.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_CustomRules extends Tests_Canonical {
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                // Add a custom Rewrite rule to test category redirections.
+                $wp_rewrite-&gt;add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&amp;order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule
+                $wp_rewrite-&gt;flush_rules();
+        }
+
+        function data() {
+                /* Format:
+                 * [0]: $test_url,
+                 * [1]: expected results: Any of the following can be used
+                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+                 *      array( expected query vars to be set, same as 'qv' above )
+                 *      (string) expected redirect location
+                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+                 */
+                return array(
+                        // Custom Rewrite rules leading to Categories
+                        array( '/ccr/uncategorized/sort/asc/', array( 'url' =&gt; '/ccr/uncategorized/sort/asc/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'asc' ) ) ),
+                        array( '/ccr/uncategorized/sort/desc/', array( 'url' =&gt; '/ccr/uncategorized/sort/desc/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'desc' ) ) ),
+                        array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' =&gt; '/ccr/uncategorized/sort/desc/?year=2008', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'desc', 'year' =&gt; '2008' ) ), 17661 ),
+                );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscanonicalnoRewritephpfromrev903trunkteststest_includes_canonicalphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/canonical/noRewrite.php (from rev 903, trunk/tests/test_includes_canonical.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/canonical/noRewrite.php                                (rev 0)
+++ trunk/tests/canonical/noRewrite.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_NoRewrite extends Tests_Canonical {
+
+        var $structure = '';
+
+        // These test cases are run against the test handler in WP_Canonical
+
+        function data() {
+                /* Format:
+                 * [0]: $test_url,
+                 * [1]: expected results: Any of the following can be used
+                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+                 *      array( expected query vars to be set, same as 'qv' above )
+                 *      (string) expected redirect location
+                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+                 */
+                return array(
+                        array( '/?p=123', '/?p=123' ),
+
+                        // This post_type arg should be stripped, because p=1 exists, and does not have post_type= in its query string
+                        array( '/?post_type=fake-cpt&amp;p=1', '/?p=1' ),
+
+                        // Strip an existing but incorrect post_type arg
+                        array( '/?post_type=page&amp;page_id=1', '/?p=1' ),
+
+                        array( '/?p=358 ', array('url' =&gt; '/?p=358',  'qv' =&gt; array('p' =&gt; '358') ) ), // Trailing spaces
+                        array( '/?p=358%20', array('url' =&gt; '/?p=358',  'qv' =&gt; array('p' =&gt; '358') ) ),
+
+                        array( '/?page_id=1', '/?p=1' ), // redirect page_id to p (should cover page_id|p|attachment_id to one another
+                        array( '/?page_id=1&amp;post_type=revision', '/?p=1' ),
+
+                );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscanonicalpageOnFrontphpfromrev903trunkteststest_includes_canonicalphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/canonical/pageOnFront.php (from rev 903, trunk/tests/test_includes_canonical.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/canonical/pageOnFront.php                                (rev 0)
+++ trunk/tests/canonical/pageOnFront.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_PageOnFront extends Tests_Canonical {
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                update_option( 'show_on_front', 'page' );
+                update_option( 'page_for_posts', $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'blog-page', 'post_type' =&gt; 'page' ) ) );
+                update_option( 'page_on_front', $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'front-page', 'post_type' =&gt; 'page' ) ) );
+                $wp_rewrite-&gt;init();
+                flush_rewrite_rules();
+        }
+
+        function data() {
+                /* Format:
+                 * [0]: $test_url,
+                 * [1]: expected results: Any of the following can be used
+                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+                 *      array( expected query vars to be set, same as 'qv' above )
+                 *      (string) expected redirect location
+                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+                 */
+                 return array(
+                         // Check against an odd redirect
+                         array( '/page/2/', '/page/2/', 20385 ),
+                         // The page designated as the front page should redirect to the front of the site
+                         array( '/front-page/', '/' ),
+                         array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
+                 );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscanonicalphpfromrev903trunkteststest_includes_canonicalphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/canonical.php (from rev 903, trunk/tests/test_includes_canonical.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/canonical.php                                (rev 0)
+++ trunk/tests/canonical.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,274 @@
</span><ins>+&lt;?php
+/**
+ * Tests Canonical redirections.
+ *
+ * In the process of doing so, it also tests WP, WP_Rewrite and WP_Query, A fail here may show a bug in any one of these areas.
+ *
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical extends WP_UnitTestCase {
+
+        // This can be defined in a subclass of this class which contains it's own data() method, those tests will be run against the specified permastruct
+        var $structure = '/%year%/%monthnum%/%day%/%postname%/';
+
+        var $old_current_user;
+        var $author_id;
+        var $post_ids;
+        var $term_ids;
+
+        function setUp() {
+                parent::setUp();
+
+                update_option( 'comments_per_page', 5 );
+                update_option( 'posts_per_page', 5 );
+
+                update_option( 'permalink_structure', $this-&gt;structure );
+                create_initial_taxonomies();
+                $GLOBALS['wp_rewrite']-&gt;init();
+                flush_rewrite_rules();
+
+                $this-&gt;old_current_user = get_current_user_id();
+                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'canonical-author' ) );
+                wp_set_current_user( $this-&gt;author_id );
+
+                // Already created by install defaults:
+                // $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'uncategorized' ) );
+
+                $this-&gt;term_ids = array();
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 587, 'post_title' =&gt; 'post-format-test-audio', 'post_date' =&gt; '2008-06-02 00:00:00' ) );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'post-format-test-gallery', 'post_date' =&gt; '2008-06-10 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 611, 'post_type' =&gt; 'attachment', 'post_title' =&gt; 'canola2', 'post_parent' =&gt; $post_id ) );
+
+                $this-&gt;factory-&gt;post-&gt;create( array(
+                        'post_title' =&gt; 'images-test',
+                        'post_date' =&gt; '2008-09-03 00:00:00',
+                        'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2 &lt;!--nextpage--&gt; Page 3'
+                ) );
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 149, 'post_title' =&gt; 'comment-test', 'post_date' =&gt; '2008-03-03 00:00:00' ) );
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2008-09-05 00:00:00' ) );
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 123 ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 1 ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 358 ) );
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'sample-page' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about' ) );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $this-&gt;factory-&gt;post-&gt;create(
+                        array( 'import_id' =&gt; 144, 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $post_id,
+                ) );
+
+                $this-&gt;term_ids['/category/parent/'] = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'parent' ) );
+                $this-&gt;term_ids['/category/parent/child-1/'] = $this-&gt;factory-&gt;term-&gt;create( array(
+                        'taxonomy' =&gt; 'category', 'name' =&gt; 'child-1', 'parent' =&gt; $this-&gt;term_ids['/category/parent/'],
+                ) );
+                $this-&gt;term_ids['/category/parent/child-1/child-2/'] = $this-&gt;factory-&gt;term-&gt;create( array(
+                        'taxonomy' =&gt; 'category', 'name' =&gt; 'child-2', 'parent' =&gt; $this-&gt;term_ids['/category/parent/child-1/'],
+                ) );
+
+                $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-a' ) );
+                $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-b' ) );
+
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'post-formats' ) );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this-&gt;old_current_user );
+
+                $GLOBALS['wp_rewrite']-&gt;init();
+        }
+
+        // URL's are relative to the site &quot;front&quot;, ie. /category/uncategorized/ instead of http://site.../category..
+        // Return url's are full url's with the prepended home.
+        function get_canonical($test_url) {
+                $test_url = home_url( $test_url );
+
+                $can_url = redirect_canonical( $test_url, false );
+                if ( ! $can_url )
+                        return $test_url; // No redirect will take place for this request
+
+                return $can_url;
+        }
+
+        /**
+         * @dataProvider data
+         */
+        function test($test_url, $expected, $ticket = 0) {
+                if ( $ticket )
+                        $this-&gt;knownWPBug( $ticket );
+
+                $ticket_ref = ($ticket &gt; 0) ? 'Ticket #' . $ticket : null;
+
+                if ( is_string($expected) )
+                        $expected = array('url' =&gt; $expected);
+                elseif ( is_array($expected) &amp;&amp; !isset($expected['url']) &amp;&amp; !isset($expected['qv']) )
+                        $expected = array( 'qv' =&gt; $expected );
+
+                if ( !isset($expected['url']) &amp;&amp; !isset($expected['qv']) )
+                        $this-&gt;markTestSkipped('No valid expected output was provided');
+
+                if ( false !== strpos( $test_url, '%d' ) ) {
+                        if ( false !== strpos( $test_url, '/?author=%d' ) )
+                                $test_url = sprintf( $test_url, $this-&gt;author_id );
+                        if ( false !== strpos( $test_url, '?cat=%d' ) )
+                                $test_url = sprintf( $test_url, $this-&gt;term_ids[ $expected['url'] ] );
+                }
+
+                $this-&gt;go_to( home_url( $test_url ) );
+
+                // Does the redirect match what's expected?
+                $can_url = $this-&gt;get_canonical( $test_url );
+                $parsed_can_url = parse_url($can_url);
+
+                // Just test the Path and Query if present
+                if ( isset($expected['url']) )
+                        $this-&gt;assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
+
+                if ( ! isset($expected['qv']) )
+                        return;
+
+                // &quot;make&quot; that the request and check the query is correct
+                $this-&gt;go_to( $can_url );
+
+                // Are all query vars accounted for, And correct?
+                global $wp;
+
+                $query_vars = array_diff($wp-&gt;query_vars, $wp-&gt;extra_query_vars);
+                if ( !empty($parsed_can_url['query']) ) {
+                        parse_str($parsed_can_url['query'], $_qv);
+
+                        // $_qv should not contain any elements which are set in $query_vars already (ie. $_GET vars should not be present in the Rewrite)
+                        $this-&gt;assertEquals( array(), array_intersect( $query_vars, $_qv ), 'Query vars are duplicated from the Rewrite into $_GET; ' . $ticket_ref );
+
+                        $query_vars = array_merge($query_vars, $_qv);
+                }
+
+                $this-&gt;assertEquals( $expected['qv'], $query_vars );
+        }
+
+        function data() {
+                /* Data format:
+                 * [0]: $test_url,
+                 * [1]: expected results: Any of the following can be used
+                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+                 *      array( expected query vars to be set, same as 'qv' above )
+                 *      (string) expected redirect location
+                 * [2]: (optional) The ticket the test refers to, Can be skipped if unknown.
+                 */
+
+                // Please Note: A few test cases are commented out below, Look at the test case following it, in most cases it's simple showing 2 options for the &quot;proper&quot; redirect.
+                return array(
+                        // Categories
+
+                        array( '?cat=%d', '/category/parent/', 15256 ),
+                        array( '?cat=%d', '/category/parent/child-1/', 15256 ),
+                        array( '?cat=%d', '/category/parent/child-1/child-2/' ), // no children
+                        array( '/category/uncategorized/', array( 'url' =&gt; '/category/uncategorized/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized' ) ) ),
+                        array( '/category/uncategorized/page/2/', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ) ),
+                        array( '/category/uncategorized/?paged=2', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ) ),
+                        array( '/category/uncategorized/?paged=2&amp;category_name=uncategorized', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ), 17174 ),
+                        array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
+                        array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
+
+                        // Categories &amp; Intersections with other vars
+                        array( '/category/uncategorized/?tag=post-formats', array( 'url' =&gt; '/category/uncategorized/?tag=post-formats', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'tag' =&gt; 'post-formats') ) ),
+                        array( '/?category_name=cat-a,cat-b', array( 'url' =&gt; '/?category_name=cat-a,cat-b', 'qv' =&gt; array( 'category_name' =&gt; 'cat-a,cat-b' ) ) ),
+
+                        // Taxonomies with extra Query Vars
+                        array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086), // Extra query vars should stay encoded
+
+                        // Categories with Dates
+                        array( '/category/uncategorized/?paged=2&amp;year=2008', array( 'url' =&gt; '/category/uncategorized/page/2/?year=2008', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2, 'year' =&gt; 2008) ), 17661 ),
+//                        array( '/2008/04/?cat=1', array( 'url' =&gt; '/2008/04/?cat=1', 'qv' =&gt; array('cat' =&gt; '1', 'year' =&gt; '2008', 'monthnum' =&gt; '04' ) ), 17661 ),
+                        array( '/2008/04/?cat=1', array( 'url' =&gt; '/category/uncategorized/?year=2008&amp;monthnum=04', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008', 'monthnum' =&gt; '04' ) ), 17661 ),
+//                        array( '/2008/?category_name=cat-a', array( 'url' =&gt; '/2008/?category_name=cat-a', 'qv' =&gt; array('category_name' =&gt; 'cat-a', 'year' =&gt; '2008' ) ) ),
+                        array( '/2008/?category_name=cat-a', array( 'url' =&gt; '/category/cat-a/?year=2008', 'qv' =&gt; array('category_name' =&gt; 'cat-a', 'year' =&gt; '2008' ) ), 20386 ),
+//                        array( '/category/uncategorized/?year=2008', array( 'url' =&gt; '/2008/?category_name=uncategorized', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008' ) ), 17661 ),
+                        array( '/category/uncategorized/?year=2008', array( 'url' =&gt; '/category/uncategorized/?year=2008', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008' ) ), 17661 ),
+
+                        // Pages
+                        array( '/sample%20page/', array( 'url' =&gt; '/sample-page/', 'qv' =&gt; array('pagename' =&gt; 'sample-page', 'page' =&gt; '' ) ), 17653 ), // Page rules always set 'page'
+                        array( '/sample------page/', array( 'url' =&gt; '/sample-page/', 'qv' =&gt; array('pagename' =&gt; 'sample-page', 'page' =&gt; '' ) ), 14773 ),
+                        array( '/child-page-1/', '/parent-page/child-page-1/'),
+                        array( '/?page_id=144', '/parent-page/child-page-1/'),
+                        array( '/abo', '/about/' ),
+
+                        // Posts
+                        array( '?p=587', '/2008/06/02/post-format-test-audio/'),
+                        array( '/?name=images-test', '/2008/09/03/images-test/'),
+                        // Incomplete slug should resolve and remove the ?name= parameter
+                        array( '/?name=images-te', '/2008/09/03/images-test/', 20374),
+                        // Page slug should resolve to post slug and remove the ?pagename= parameter
+                        array( '/?pagename=images-test', '/2008/09/03/images-test/', 20374),
+
+                        array( '/2008/06/02/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+                        array( '/2008/06/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+                        array( '/2008/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+                        array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in
+                        array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+
+                        array( '/2008/09/03/images-test/3/', array( 'url' =&gt; '/2008/09/03/images-test/3/', 'qv' =&gt; array( 'name' =&gt; 'images-test', 'year' =&gt; '2008', 'monthnum' =&gt; '09', 'day' =&gt; '03', 'page' =&gt; '/3' ) ) ), // page = /3 ?!
+                        array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/', 11694 ), // post with 4 pages
+                        array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
+                        array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
+
+                        // Comments
+                        array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/', 20388 ),
+                        array( '/2008/03/03/comment-test/comment-page-20/', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
+                        array( '/2008/03/03/comment-test/?cpage=30', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
+
+                        // Attachments
+                        array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
+                        array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
+
+                        // Dates
+                        array( '/?m=2008', '/2008/' ),
+                        array( '/?m=200809', '/2008/09/'),
+                        array( '/?m=20080905', '/2008/09/05/'),
+
+                        array( '/2008/?day=05', '/2008/?day=05'), // no redirect
+                        array( '/2008/09/?day=05', '/2008/09/05/'),
+                        array( '/2008/?monthnum=9', '/2008/09/'),
+
+                        array( '/?year=2008', '/2008/'),
+
+                        // Authors
+                        array( '/?author=%d', '/author/canonical-author/' ),
+//                        array( '/?author=%d&amp;year=2008', '/2008/?author=3'),
+                        array( '/?author=%d&amp;year=2008', '/author/canonical-author/?year=2008', 17661 ),
+//                        array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
+                        array( '/author/canonical-author/?year=2008', '/author/canonical-author/?year=2008', 17661 ),
+
+                        // Feeds
+                        array( '/?feed=atom', '/feed/atom/' ),
+                        array( '/?feed=rss2', '/feed/' ),
+                        array( '/?feed=comments-rss2', '/comments/feed/'),
+                        array( '/?feed=comments-atom', '/comments/feed/atom/'),
+
+                        // Feeds (per-post)
+                        array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
+                        array( '/?p=149&amp;feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
+                        array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ),
+
+                        // Index
+                        array( '/?paged=1', '/' ),
+                        array( '/page/1/', '/' ),
+                        array( '/page1/', '/' ),
+                        array( '/?paged=2', '/page/2/' ),
+                        array( '/page2/', '/page/2/' ),
+
+                        // Misc
+                        array( '/2008%20', '/2008' ),
+                        array( '//2008////', '/2008/' ),
+
+                        // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static)
+                );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscompatphpfromrev903trunkteststest_includes_compatphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/compat.php (from rev 903, trunk/tests/test_includes_compat.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/compat.php                                (rev 0)
+++ trunk/tests/compat.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;?php
+
+/**
+ * @group compat
+ */
+class Tests_Compat extends WP_UnitTestCase {
+        function test_mb_substr() {
+                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, 3));
+                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, -1));
+                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, -1));
+                $this-&gt;assertEquals('I am your Ð±', _mb_substr('I am your Ð±Ð°Ð±Ð°', 0, 11));
+        }
+
+        function test_hash_hmac_simple() {
+                $this-&gt;assertEquals('140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac('md5', 'simple', 'key'));
+                $this-&gt;assertEquals('993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac('sha1', 'simple', 'key'));
+        }
+
+        function test_hash_hmac_padding() {
+                $this-&gt;assertEquals('3c1399103807cf12ec38228614416a8c', _hash_hmac('md5', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+                $this-&gt;assertEquals('4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac('sha1', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+        }
+
+        function test_hash_hmac_output() {
+                $this-&gt;assertEquals(array( 1 =&gt; '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
+                $this-&gt;assertEquals(array( 1 =&gt; '993003b95758e0ac2eba451a4c5877eb1bb7b92a'), unpack('H40', _hash_hmac('sha1', 'simple', 'key', true)));
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestscronphpfromrev903trunkteststest_cronphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/cron.php (from rev 903, trunk/tests/test_cron.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/cron.php                                (rev 0)
+++ trunk/tests/cron.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,310 @@
</span><ins>+&lt;?php
+
+/**
+ * Test the cron scheduling functions
+ *
+ * @group cron
+ */
+class Tests_Cron extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+
+        function test_wp_get_schedule_empty() {
+                // nothing scheduled
+                $hook = rand_str();
+                $this-&gt;assertFalse(wp_get_schedule($hook));
+        }
+
+        function test_schedule_event_single() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_single_event( $timestamp, $hook );
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // it's a non recurring event
+                $this-&gt;assertEquals( '', wp_get_schedule($hook) );
+
+        }
+
+        function test_schedule_event_single_args() {
+                // schedule an event with arguments and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+                $args = array(rand_str());
+
+                wp_schedule_single_event( $timestamp, $hook, $args );
+                // this returns the timestamp only if we provide matching args
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
+                $this-&gt;assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                // it's a non recurring event
+                $this-&gt;assertEquals( '', wp_get_schedule($hook, $args) );
+        }
+
+        function test_schedule_event() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $recur = 'hourly';
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_event( $timestamp, $recur, $hook );
+                // it's scheduled for the right time
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
+                // it's a recurring event
+                $this-&gt;assertEquals( $recur, wp_get_schedule($hook) );
+        }
+
+        function test_schedule_event_args() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+                $recur = 'hourly';
+                $args = array(rand_str());
+
+                wp_schedule_event( $timestamp, 'hourly', $hook, $args );
+                // this returns the timestamp only if we provide matching args
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
+                $this-&gt;assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                $this-&gt;assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+        }
+
+        function test_unschedule_event() {
+                // schedule an event and make sure it's returned by wp_next_scheduled
+                $hook = rand_str();
+                $timestamp = strtotime('+1 hour');
+
+                wp_schedule_single_event( $timestamp, $hook );
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // now unschedule it and make sure it's gone
+                wp_unschedule_event( $timestamp, $hook );
+                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
+        }
+
+        function test_clear_schedule() {
+                $hook = rand_str();
+                $args = array(rand_str());
+
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+                // make sure they're returned by wp_next_scheduled()
+                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this-&gt;assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array
+                wp_clear_scheduled_hook($hook, $args[0]);
+                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
+        }
+
+        function test_clear_schedule_multiple_args() {
+                $hook = rand_str();
+                $args = array(rand_str(), rand_str());
+
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+                // make sure they're returned by wp_next_scheduled()
+                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this-&gt;assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // note: wp_clear_scheduled_hook() used to expect args passed directly, rather than as an array pre WP 3.0
+                wp_clear_scheduled_hook($hook, $args[0], $args[1]);
+                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
+        }
+
+        /**
+         * @ticket 10468
+         */
+        function test_clear_schedule_new_args() {
+                $hook = rand_str();
+                $args = array(rand_str());
+                $multi_hook = rand_str();
+                $multi_args = array(rand_str(), rand_str());
+
+                // schedule several events with and without arguments
+                wp_schedule_single_event( strtotime('+1 hour'), $hook );
+                wp_schedule_single_event( strtotime('+2 hour'), $hook );
+                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+                wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
+                wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
+
+                // make sure they're returned by wp_next_scheduled()
+                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this-&gt;assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // wp_clear_scheduled_hook() should take args as an array like the other functions.
+                wp_clear_scheduled_hook($hook, $args);
+                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
+
+                // clear the schedule for the args events and make sure they're gone too
+                // wp_clear_scheduled_hook() should take args as an array like the other functions and does from WP 3.0
+                wp_clear_scheduled_hook($multi_hook, $multi_args);
+                $this-&gt;assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
+
+        }
+
+        /**
+         * @ticket 6966
+         */
+        function test_duplicate_event() {
+                // duplicate events close together should be skipped
+                $hook = rand_str();
+                $args = array(rand_str());
+                $ts1 = strtotime('+5 minutes');
+                $ts2 = strtotime('+3 minutes');
+
+                // first one works
+                wp_schedule_single_event( $ts1, $hook, $args );
+                // second one is ignored
+                wp_schedule_single_event( $ts2, $hook, $args );
+
+                // the next event should be at +5 minutes, not +3
+                $this-&gt;assertEquals( $ts1, wp_next_scheduled($hook, $args) );
+        }
+
+        /**
+         * @ticket 6966
+         */
+        function test_not_duplicate_event() {
+                // duplicate events far apart should work normally
+                $hook = rand_str();
+                $args = array(rand_str());
+                $ts1 = strtotime('+30 minutes');
+                $ts2 = strtotime('+3 minutes');
+
+                // first one works
+                wp_schedule_single_event( $ts1, $hook, $args );
+                // second works too
+                wp_schedule_single_event( $ts2, $hook, $args );
+
+                // the next event should be at +5 minutes, not +3
+                $this-&gt;assertEquals( $ts2, wp_next_scheduled($hook, $args) );
+                wp_unschedule_event( $ts2, $hook, $args );
+                // following event should be there too
+                $this-&gt;assertEquals( $ts1, wp_next_scheduled($hook, $args) );
+        }
+}
+
+/*
+ * Disable the WP Cron running test for the moment as it kills the whole test suite.
+ * TODO - Fix it to work with the new cron implementation in trunk
+ *
+class WPTestCronRunning extends _WPEmptyBlog {
+        function setUp() {
+                parent::setUp();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                // make sure the schedule is clear
+                _set_cron_array(array());
+        }
+        function _do_cron() {
+                // FIXME: wp-cron.php is difficult to test, could be wrapped in a function
+                $_GET['check'] = wp_hash('187425');
+                require(ABSPATH.'/wp-cron.php');
+        }
+
+        function test_run_schedule_single() {
+                // schedule an event, run it, and make sure the hook is called
+                $hook = rand_str();
+                $args = array(rand_str());
+                $timestamp = strtotime('-1 second');
+
+                // register a test action
+                $a = new MockAction();
+                add_action($hook, array(&amp;$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_single_event( $timestamp, $hook, $args );
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+
+                // run cron jobs
+                $this-&gt;_do_cron();
+
+                // our action should have been called once with the correct args
+                $this-&gt;assertEquals( 1, $a-&gt;get_call_count() );
+                $this-&gt;assertEquals( array($args), $a-&gt;get_args() );
+
+                // it shouldn't appear in the schedule anymore
+                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
+
+        }
+
+        function test_run_schedule_recurring() {
+                // schedule a recurring event, run it, and make sure the hook is called
+                $hook = rand_str();
+                $args = array(rand_str());
+                $timestamp = strtotime('-1 second');
+                $recur = 'hourly';
+
+                // register a test action
+                $a = new MockAction();
+                add_action($hook, array(&amp;$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_event( $timestamp, $recur, $hook, $args );
+                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                $this-&gt;assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+                // run cron jobs
+                $this-&gt;_do_cron();
+
+                // our action should have been called once with the correct args
+                $this-&gt;assertEquals( 1, $a-&gt;get_call_count() );
+                $this-&gt;assertEquals( array($args), $a-&gt;get_args() );
+
+                // it should appear in the schedule to run again in an hour's time
+                $this-&gt;assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
+
+        }
+}
+*/
</ins></span></pre></div>
<a id="trunktestsdbphpfromrev903trunkteststest_dbphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/db.php (from rev 903, trunk/tests/test_db.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/db.php                                (rev 0)
+++ trunk/tests/db.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+&lt;?php
+
+/**
+ * Test WPDB methods
+ *
+ * @group wpdb
+ */
+class TestWPDB extends WP_UnitTestCase {
+
+        /**
+         * Query log
+         * @var array
+         */
+        protected $_queries = array();
+
+        /**
+         * Set up the test fixture
+         */
+        public function setUp() {
+                parent::setUp();
+                $this-&gt;_queries = array();
+                add_filter( 'query', array( $this, 'query_filter' ) );
+        }
+
+        /**
+         * Tear down the test fixture
+         */
+        public function tearDown() {
+                parent::tearDown();
+                remove_filter( 'query', array( $this, 'query_filter' ) );
+        }
+
+        /**
+         * Log each query
+         * @param string $sql
+         * @return string
+         */
+        public function query_filter( $sql ) {
+                $this-&gt;_queries[] = $sql;
+                return $sql;
+        }
+
+        /**
+         * Test that floats formatted as &quot;0,700&quot; get sanitized properly by wpdb
+         * @global mixed $wpdb
+         *
+         * @ticket 19861
+         */
+        public function test_locale_floats() {
+                global $wpdb;
+
+                // Save the current locale
+                $current_locale = setlocale( LC_ALL, NULL );
+
+                // Switch to Russian
+                $flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES' );
+                if ( false === $flag )
+                        $this-&gt;markTestSkipped( 'No European languages available for testing' );
+
+                // Try an update query
+                $wpdb-&gt;suppress_errors( true );
+                $wpdb-&gt;update(
+                        'test_table',
+                        array( 'float_column' =&gt; 0.7 ),
+                        array( 'meta_id' =&gt; 5 ),
+                        array( '%f' ),
+                        array( '%d' )
+                );
+                $wpdb-&gt;suppress_errors( false );
+
+                // Ensure the float isn't 0,700
+                $this-&gt;assertContains( '0.700', array_pop( $this-&gt;_queries ) );
+
+                // Try a prepare
+                $sql = $wpdb-&gt;prepare( &quot;UPDATE test_table SET float_column = %f AND meta_id = %d&quot;, 0.7, 5 );
+                $this-&gt;assertContains( '0.700', $sql );
+
+                // Restore locale
+                setlocale( LC_ALL, $current_locale );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsdependenciesscriptsphpfromrev903trunkteststest_includes_wpscriptsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/dependencies/scripts.php (from rev 903, trunk/tests/test_includes_wp-scripts.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/dependencies/scripts.php                                (rev 0)
+++ trunk/tests/dependencies/scripts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+&lt;?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class TestWP_Scripts extends WP_UnitTestCase {
+        var $old_wp_scripts;
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;old_wp_scripts = $GLOBALS['wp_scripts'];
+                remove_action( 'wp_default_scripts', 'wp_default_scripts' );
+                $GLOBALS['wp_scripts'] = new WP_Scripts();
+                $GLOBALS['wp_scripts']-&gt;default_version = get_bloginfo( 'version' );
+
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_scripts'] = $this-&gt;old_wp_scripts;
+                add_action( 'wp_default_scripts', 'wp_default_scripts' );
+                parent::tearDown();
+        }
+
+        /**
+         * Test versioning
+         * @ticket 11315
+         */
+        function test_wp_enqueue_script() {
+                wp_enqueue_script('no-deps-no-version', 'example.com', array());
+                wp_enqueue_script('empty-deps-no-version', 'example.com' );
+                wp_enqueue_script('empty-deps-version', 'example.com', array(), 1.2);
+                wp_enqueue_script('empty-deps-null-version', 'example.com', array(), null);
+                $ver = get_bloginfo( 'version' );
+                $expected  = &quot;&lt;script type='text/javascript' src='http://example.com?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com?ver=1.2'&gt;&lt;/script&gt;\n&quot;;
+                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com'&gt;&lt;/script&gt;\n&quot;;
+
+                $this-&gt;assertEquals($expected, get_echo('wp_print_scripts'));
+
+                // No scripts left to print
+                $this-&gt;assertEquals(&quot;&quot;, get_echo('wp_print_scripts'));
+        }
+
+        /**
+         * Test the different protocol references in wp_enqueue_script
+         * @global WP_Scripts $wp_scripts
+         * @ticket 16560
+         */
+        public function test_protocols() {
+                // Init
+                global $wp_scripts;
+                $base_url_backup = $wp_scripts-&gt;base_url;
+                $wp_scripts-&gt;base_url = 'http://example.com/wordpress';
+                $expected = '';
+                $ver = get_bloginfo( 'version' );
+
+                // Try with an HTTP reference
+                wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected  .= &quot;&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+
+                // Try with an HTTPS reference
+                wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected  .= &quot;&lt;script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+
+                // Try with an automatic protocol reference (//)
+                wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected  .= &quot;&lt;script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+
+                // Try with a local resource and an automatic protocol reference (//)
+                $url = '//my_plugin/script.js';
+                wp_enqueue_script( 'plugin-script', $url );
+                $expected  .= &quot;&lt;script type='text/javascript' src='$url?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+
+                // Try with a bad protocol
+                wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected  .= &quot;&lt;script type='text/javascript' src='{$wp_scripts-&gt;base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
+
+                // Go!
+                $this-&gt;assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
+
+                // No scripts left to print
+                $this-&gt;assertEquals( '', get_echo( 'wp_print_scripts' ) );
+
+                // Cleanup
+                $wp_scripts-&gt;base_url = $base_url_backup;
+        }
+}
</ins></span></pre></div>
<a id="trunktestsdependenciesstylesphpfromrev903trunkteststest_includes_wpstylesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/dependencies/styles.php (from rev 903, trunk/tests/test_includes_wp-styles.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/dependencies/styles.php                                (rev 0)
+++ trunk/tests/dependencies/styles.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+&lt;?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class TestWP_Styles extends WP_UnitTestCase {
+        var $old_wp_styles;
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;old_wp_styles = $GLOBALS['wp_styles'];
+                remove_action( 'wp_default_styles', 'wp_default_styles' );
+                $GLOBALS['wp_styles'] = new WP_Styles();
+                $GLOBALS['wp_styles']-&gt;default_version = get_bloginfo( 'version' );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_styles'] = $this-&gt;old_wp_styles;
+                add_action( 'wp_default_styles', 'wp_default_styles' );
+                parent::tearDown();
+        }
+
+        /**
+         * Test versioning
+         * @ticket 11315
+         */
+        function test_wp_enqueue_style() {
+                wp_enqueue_style('no-deps-no-version', 'example.com' );
+                wp_enqueue_style('no-deps-version', 'example.com', array(), 1.2);
+                wp_enqueue_style('no-deps-null-version', 'example.com', array(), null);
+                wp_enqueue_style('no-deps-null-version-print-media', 'example.com', array(), null, 'print');
+                $ver = get_bloginfo( 'version' );
+                $expected  = &quot;&lt;link rel='stylesheet' id='no-deps-no-version-css'  href='http://example.com?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-version-css'  href='http://example.com?ver=1.2' type='text/css' media='all' /&gt;\n&quot;;
+                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-null-version-css'  href='http://example.com' type='text/css' media='all' /&gt;\n&quot;;
+                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-null-version-print-media-css'  href='http://example.com' type='text/css' media='print' /&gt;\n&quot;;
+
+                $this-&gt;assertEquals($expected, get_echo('wp_print_styles'));
+
+                // No styles left to print
+                $this-&gt;assertEquals(&quot;&quot;, get_echo('wp_print_styles'));
+        }
+
+        /**
+         * Test the different protocol references in wp_enqueue_style
+         * @global WP_Styles $wp_styles
+         * @ticket 16560
+         */
+        public function test_protocols() {
+                // Init
+                global $wp_styles;
+                $base_url_backup = $wp_styles-&gt;base_url;
+                $wp_styles-&gt;base_url = 'http://example.com/wordpress';
+                $expected = '';
+                $ver = get_bloginfo( 'version' );
+
+                // Try with an HTTP reference
+                wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-http-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+
+                // Try with an HTTPS reference
+                wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-https-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+
+                // Try with an automatic protocol reference (//)
+                wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-doubleslash-css'  href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+
+                // Try with a local resource and an automatic protocol reference (//)
+                $url = '//my_plugin/style.css';
+                wp_enqueue_style( 'plugin-style', $url );
+                $expected  .= &quot;&lt;link rel='stylesheet' id='plugin-style-css'  href='$url?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+
+                // Try with a bad protocol
+                wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-ftp-css'  href='{$wp_styles-&gt;base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
+
+                // Go!
+                $this-&gt;assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+                // No styles left to print
+                $this-&gt;assertEquals( '', get_echo( 'wp_print_styles' ) );
+
+                // Cleanup
+                $wp_styles-&gt;base_url = $base_url_backup;
+        }
+}
</ins></span></pre></div>
<a id="trunktestsdependenciesphpfromrev903trunkteststest_includes_classwpdependenciesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/dependencies.php (from rev 903, trunk/tests/test_includes_class-wp-dependencies.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/dependencies.php                                (rev 0)
+++ trunk/tests/dependencies.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+&lt;?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies extends WP_UnitTestCase {
+        function test_add() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'one' ));
+                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'two' ));
+
+                //Cannot reuse names
+                $this-&gt;assertFalse($dep-&gt;add( 'one', '' ));
+        }
+
+        function test_remove() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $dep-&gt;remove( 'one' );
+
+                $this-&gt;assertFalse($dep-&gt;query( 'one'));
+                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'two' ));
+
+        }
+
+        function test_enqueue() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $dep-&gt;enqueue('one');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
+
+                $dep-&gt;enqueue('two');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+        }
+
+        function test_dequeue() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $dep-&gt;enqueue('one');
+                $dep-&gt;enqueue('two');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+
+                $dep-&gt;dequeue('one');
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+
+                $dep-&gt;dequeue('two');
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
+        }
+
+        function test_enqueue_args() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $dep-&gt;enqueue('one?arg');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
+                $this-&gt;assertEquals('arg', $dep-&gt;args['one']);
+
+                $dep-&gt;enqueue('two?arg');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+                $this-&gt;assertEquals('arg', $dep-&gt;args['two']);
+        }
+
+        function test_dequeue_args() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
+                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
+
+                $dep-&gt;enqueue('one?arg');
+                $dep-&gt;enqueue('two?arg');
+                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+                $this-&gt;assertEquals('arg', $dep-&gt;args['one']);
+                $this-&gt;assertEquals('arg', $dep-&gt;args['two']);
+
+                $dep-&gt;dequeue('one');
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
+                $this-&gt;assertFalse(isset($dep-&gt;args['one']));
+
+                $dep-&gt;dequeue('two');
+                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
+                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
+                $this-&gt;assertFalse(isset($dep-&gt;args['two']));
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsfeedrss2phpfromrev903trunkteststest_includes_feed_rss2php"></a>
<div class="copfile"><h4>Copied: trunk/tests/feed/rss2.php (from rev 903, trunk/tests/test_includes_feed_rss2.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/feed/rss2.php                                (rev 0)
+++ trunk/tests/feed/rss2.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+&lt;?php
+
+/**
+ * test the RSS 2.0 feed by generating a feed, parsing it, and checking that the
+ * parsed contents match the contents of the posts stored in the database.  Since
+ * we're using a real XML parser, this confirms that the feed is valid, well formed,
+ * and contains the right stuff.
+ *
+ * @group feed
+ */
+class Tests_Feed_RSS2 extends WP_UnitTestCase {
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;factory-&gt;post-&gt;create_many( 25 );
+
+                $this-&gt;post_count = get_option('posts_per_rss');
+                $this-&gt;excerpt_only = get_option('rss_use_excerpt');
+                // this seems to break something
+                update_option('use_smilies', false);
+        }
+
+        function do_rss2() {
+                ob_start();
+                // nasty hack
+                global $post;
+                try {
+                        @require(ABSPATH . 'wp-includes/feed-rss2.php');
+                        $out = ob_get_clean();
+                } catch (Exception $e) {
+                        $out = ob_get_clean();
+                        throw($e);
+                }
+                return $out;
+        }
+
+        function test_rss() {
+                $this-&gt;go_to('/feed/');
+                $feed = $this-&gt;do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get the rss element
+                $rss = xml_find($xml, 'rss');
+
+                // there should only be one rss element
+                $this-&gt;assertEquals(1, count($rss));
+
+                $this-&gt;assertEquals('2.0', $rss[0]['attributes']['version']);
+                $this-&gt;assertEquals('http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content']);
+                $this-&gt;assertEquals('http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw']);
+                $this-&gt;assertEquals('http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc']);
+
+                // rss should have exactly one child element (channel)
+                $this-&gt;assertEquals(1, count($rss[0]['child']));
+        }
+
+        function test_channel() {
+                $this-&gt;go_to('/feed/');
+                $feed = $this-&gt;do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get the rss -&gt; channel element
+                $channel = xml_find($xml, 'rss', 'channel');
+
+                $this-&gt;assertTrue(empty($channel[0]['attributes']));
+
+                $title = xml_find($xml, 'rss', 'channel', 'title');
+                $this-&gt;assertEquals(get_option('blogname'), $title[0]['content']);
+
+                $desc = xml_find($xml, 'rss', 'channel', 'description');
+                $this-&gt;assertEquals(get_option('blogdescription'), $desc[0]['content']);
+
+                $link = xml_find($xml, 'rss', 'channel', 'link');
+                $this-&gt;assertEquals(get_option('siteurl'), $link[0]['content']);
+
+                $pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
+                $this-&gt;assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
+        }
+
+        /**
+         * @ticket UT32
+         */
+        function test_items() {
+                $this-&gt;go_to('/feed/');
+                $feed = $this-&gt;do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get all the rss -&gt; channel -&gt; item elements
+                $items = xml_find($xml, 'rss', 'channel', 'item');
+                $posts = get_posts('numberposts='.$this-&gt;post_count);
+
+                // check each of the items against the known post data
+                for ($i=0; $i &lt; $this-&gt;post_count; $i++) {
+
+                        // title
+                        $title = xml_find($items[$i]['child'], 'title');
+                        $this-&gt;assertEquals($posts[$i]-&gt;post_title, $title[0]['content']);
+
+                        // link
+                        $link = xml_find($items[$i]['child'], 'link');
+                        $this-&gt;assertEquals(get_permalink($posts[$i]-&gt;ID), $link[0]['content']);
+
+                        // comment link
+                        $comments_link = xml_find($items[$i]['child'], 'comments');
+                        $this-&gt;assertEquals(get_permalink($posts[$i]-&gt;ID) . '#comments', $comments_link[0]['content']);
+
+                        // pub date
+                        $pubdate = xml_find($items[$i]['child'], 'pubDate');
+                        $this-&gt;assertEquals(strtotime($posts[$i]-&gt;post_date), strtotime($pubdate[0]['content']));
+
+                        // author
+                        $creator = xml_find($items[$i]['child'], 'dc:creator');
+                        $this-&gt;assertEquals($this-&gt;author-&gt;user_nicename, $creator[0]['content']);
+
+                        // categories (perhaps multiple)
+                        $categories = xml_find($items[$i]['child'], 'category');
+                        $cat_ids = wp_get_post_categories($post-&gt;ID);
+                        if (empty($cat_ids))        $cat_ids = array(1);
+                        // should be the same number of categories
+                        $this-&gt;assertEquals(count($cat_ids), count($categories));
+                        // ..with the same names
+                        for ($j=0; $j &lt; count($cat_ids); $j++)
+                                $this-&gt;assertEquals(get_cat_name($cat_ids[$j]), $categories[$j]['content']);
+
+                        // GUID
+                        $guid = xml_find($items[$i]['child'], 'guid');
+                        $this-&gt;assertEquals('false', $guid[0]['attributes']['isPermaLink']);
+                        $this-&gt;assertEquals($posts[$i]-&gt;guid, $guid[0]['content']);
+
+                        // description/excerpt
+                        $description = xml_find($items[$i]['child'], 'description');
+                        $this-&gt;assertEquals(trim($posts[$i]-&gt;post_excerpt), trim($description[0]['content']));
+
+                        // post content
+                        if (!$this-&gt;excerpt_only) {
+                                $content = xml_find($items[$i]['child'], 'content:encoded');
+                                $this-&gt;assertEquals(trim(apply_filters('the_content', $posts[$i]-&gt;post_content)), trim($content[0]['content']));
+                        }
+
+                        // comment rss
+                        $comment_rss = xml_find($items[$i]['child'], 'wfw:commentRss');
+                        $this-&gt;assertEquals(html_entity_decode(get_post_comments_feed_link($posts[$i]-&gt;ID)), $comment_rss[0]['content']);
+                }
+
+        }
+}
</ins></span></pre></div>
<a id="trunktestsfilephpfromrev903trunkteststest_includes_filephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/file.php (from rev 903, trunk/tests/test_includes_file.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/file.php                                (rev 0)
+++ trunk/tests/file.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+&lt;?php
+
+class Tests_File extends WP_UnitTestCase {
+
+        function setUp() {
+                $this-&gt;dir = dirname(tempnam('/tmp', 'foo'));
+
+                $this-&gt;badchars = '&quot;\'[]*&amp;?$';
+        }
+
+        function is_unique_writable_file($path, $filename) {
+                $fullpath = $path . DIRECTORY_SEPARATOR . $filename;
+
+                $fp = fopen( $fullpath, 'x' );
+                // file already exists?
+                if (!$fp)
+                        return false;
+
+                // write some random contents
+                $c = rand_str();
+                fwrite($fp, $c);
+                fclose($fp);
+
+                if ( file_get_contents($fullpath) === $c )
+                        $result = true;
+                else
+                        $result = false;
+
+                return $result;
+        }
+
+        function test_unique_filename_is_valid() {
+                // make sure it produces a valid, writable, unique filename
+                $filename = wp_unique_filename( $this-&gt;dir, rand_str() . '.txt' );
+
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_is_unique() {
+                // make sure it produces two unique filenames
+                $name = rand_str();
+
+                $filename1 = wp_unique_filename( $this-&gt;dir, $name . '.txt' );
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename1) );
+                $filename2 = wp_unique_filename( $this-&gt;dir, $name . '.txt' );
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename2) );
+
+                // the two should be different
+                $this-&gt;assertNotEquals( $filename1, $filename2 );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename1);
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename2);
+        }
+
+        function test_unique_filename_is_sanitized() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this-&gt;dir, $name . $this-&gt;badchars .  '.txt' );
+
+                // make sure the bad characters were all stripped out
+                $this-&gt;assertEquals( $name . '.txt', $filename );
+
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_with_slashes() {
+                $name = rand_str();
+                // &quot;foo/foo.txt&quot;
+                $filename = wp_unique_filename( $this-&gt;dir, $name . '/' . $name .  '.txt' );
+
+                // the slash should be removed, i.e. &quot;foofoo.txt&quot;
+                $this-&gt;assertEquals( $name . $name . '.txt', $filename );
+
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_multiple_ext() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this-&gt;dir, $name . '.php.txt' );
+
+                // &quot;foo.php.txt&quot; becomes &quot;foo.php_.txt&quot;
+                $this-&gt;assertEquals( $name . '.php_.txt', $filename );
+
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_no_ext() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this-&gt;dir, $name );
+
+                $this-&gt;assertEquals( $name, $filename );
+
+                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
+
+                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsfiltersphpfromrev903trunkteststest_filtersphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/filters.php (from rev 903, trunk/tests/test_filters.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/filters.php                                (rev 0)
+++ trunk/tests/filters.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,243 @@
</span><ins>+&lt;?php
+
+/**
+ * Test apply_filters() and related functions
+ *
+ * @group hooks
+ */
+class WPTestFilters extends WP_UnitTestCase {
+
+        function test_simple_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter($tag, array(&amp;$a, 'filter'));
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+
+                // only one event occurred for the hook, with empty args
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                // only our hook was called
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                $args = array_pop($a-&gt;get_args());
+                $this-&gt;assertEquals(array($val), $args);
+        }
+
+        function test_remove_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter($tag, array(&amp;$a, 'filter'));
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter($tag, array(&amp;$a, 'filter'));
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+        }
+
+        function test_has_filter() {
+                        $tag = rand_str();
+                        $func = rand_str();
+
+                        $this-&gt;assertFalse( has_filter($tag, $func) );
+                        $this-&gt;assertFalse( has_filter($tag) );
+                        add_filter($tag, $func);
+                        $this-&gt;assertEquals( 10, has_filter($tag, $func) );
+                        $this-&gt;assertTrue( has_filter($tag) );
+                        remove_filter($tag, $func);
+                        $this-&gt;assertFalse( has_filter($tag, $func) );
+                        $this-&gt;assertFalse( has_filter($tag) );
+        }
+
+        // one tag with multiple filters
+        function test_multiple_filters() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                // add both filters to the hook
+                add_filter($tag, array(&amp;$a1, 'filter'));
+                add_filter($tag, array(&amp;$a2, 'filter'));
+
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+
+                // both filters called once each
+                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
+                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
+        }
+
+        function test_filter_args_1() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+                $arg1 = rand_str();
+
+                add_filter($tag, array(&amp;$a, 'filter'), 10, 2);
+                // call the filter with a single argument
+                $this-&gt;assertEquals($val, apply_filters($tag, $val, $arg1));
+
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val, $arg1), array_pop($a-&gt;get_args()));
+        }
+
+        function test_filter_args_2() {
+                $a1 = new MockAction();
+                $a2 = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+                $arg1 = rand_str();
+                $arg2 = rand_str();
+
+                // a1 accepts two arguments, a2 doesn't
+                add_filter($tag, array(&amp;$a1, 'filter'), 10, 3);
+                add_filter($tag, array(&amp;$a2, 'filter'));
+                // call the filter with two arguments
+                $this-&gt;assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
+
+                // a1 should be called with both args
+                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val, $arg1, $arg2), array_pop($a1-&gt;get_args()));
+
+                // a2 should be called with one only
+                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
+                $this-&gt;assertEquals(array($val), array_pop($a2-&gt;get_args()));
+        }
+
+        function test_filter_priority() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                // make two filters with different priorities
+                add_filter($tag, array(&amp;$a, 'filter'), 10);
+                add_filter($tag, array(&amp;$a, 'filter2'), 9);
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+
+                // there should be two events, one per filter
+                $this-&gt;assertEquals(2, $a-&gt;get_call_count());
+
+                $expected = array (
+                        // filter2 is called first because it has priority 9
+                        array (
+                                'filter' =&gt; 'filter2',
+                                'tag' =&gt; $tag,
+                                'args' =&gt; array($val)
+                        ),
+                        // filter 1 is called second
+                        array (
+                                'filter' =&gt; 'filter',
+                                'tag' =&gt; $tag,
+                                'args' =&gt; array($val)
+                        ),
+                );
+
+                $this-&gt;assertEquals($expected, $a-&gt;get_events());
+        }
+
+        function test_all_filter() {
+                $a = new MockAction();
+                $tag1 = rand_str();
+                $tag2 = rand_str();
+                $val = rand_str();
+
+                // add an 'all' filter
+                add_filter('all', array(&amp;$a, 'filterall'));
+                // do some filters
+                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
+                $this-&gt;assertEquals($val, apply_filters($tag2, $val));
+                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
+                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
+
+                // our filter should have been called once for each apply_filters call
+                $this-&gt;assertEquals(4, $a-&gt;get_call_count());
+                // the right hooks should have been called in order
+                $this-&gt;assertEquals(array($tag1, $tag2, $tag1, $tag1), $a-&gt;get_tags());
+
+                remove_filter('all', array(&amp;$a, 'filterall'));
+                $this-&gt;assertFalse( has_filter('all', array(&amp;$a, 'filterall')) );
+
+        }
+
+        function test_remove_all_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter('all', array(&amp;$a, 'filterall'));
+                $this-&gt;assertTrue( has_filter('all') );
+                $this-&gt;assertEquals( 10, has_filter('all', array(&amp;$a, 'filterall')) );
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter('all', array(&amp;$a, 'filterall'));
+                $this-&gt;assertFalse( has_filter('all', array(&amp;$a, 'filterall')) );
+                $this-&gt;assertFalse( has_filter('all') );
+                $this-&gt;assertEquals($val, apply_filters($tag, $val));
+                // call cound should remain at 1
+                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
+                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
+        }
+
+        /**
+         * @ticket 9886
+         */
+        function test_filter_ref_array() {
+                $obj = new stdClass();
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'filter'));
+
+                apply_filters_ref_array($tag, array(&amp;$obj));
+
+                $args = $a-&gt;get_args();
+                $this-&gt;assertSame($args[0][0], $obj);
+                // just in case we don't trust assertSame
+                $obj-&gt;foo = true;
+                $this-&gt;assertFalse( empty($args[0][0]-&gt;foo) );
+        }
+
+        /**
+         * @ticket 12723
+         */
+        function test_filter_ref_array_result() {
+                $obj = new stdClass();
+                $a = new MockAction();
+                $b = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&amp;$a, 'filter_append'), 10, 2);
+                add_action($tag, array(&amp;$b, 'filter_append'), 10, 2);
+
+                $result = apply_filters_ref_array($tag, array('string', &amp;$obj));
+
+                $this-&gt;assertEquals($result, 'string_append_append');
+
+                $args = $a-&gt;get_args();
+                $this-&gt;assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj-&gt;foo = true;
+                $this-&gt;assertFalse( empty($args[0][1]-&gt;foo) );
+
+                $args = $b-&gt;get_args();
+                $this-&gt;assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj-&gt;foo = true;
+                $this-&gt;assertFalse( empty($args[0][1]-&gt;foo) );
+
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingbalanceTagsphpfromrev903trunkteststest_includes_balance_tagsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/balanceTags.php (from rev 903, trunk/tests/test_includes_balance_tags.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/balanceTags.php                                (rev 0)
+++ trunk/tests/formatting/balanceTags.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,226 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
+
+        // These are single/self-closing tags that WP has traditionally recognized.
+        var $basic_single_tags = array( 'br', 'hr', 'img', 'input' );
+
+        // This is a complete(?) listing of valid single/self-closing tags.
+        var $single_tags = array(
+                'area', 'base', 'basefont', 'br', 'col', 'command',
+                'embed', 'frame', 'hr', 'img', 'input', 'isindex',
+                'link', 'meta', 'param', 'source' );
+
+        // Tags that can be directly nested within themselves, i.e. &lt;div&gt;&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;
+        var $nestable_tags = array( 'blockquote', 'div', 'q', 'span' );
+        // Use this instead if/when #20401 gets fixed
+        //var $nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
+
+        // These are single tags WP has traditionally properly handled
+        // This test can be removed if #1597 is fixed and the next test passes, as
+        //   it supercedes this test.
+        function test_selfcloses_unclosed_basic_known_single_tags() {
+                foreach ( $this-&gt;basic_single_tags as $tag ) {
+                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&quot;, true ) );
+                }
+        }
+
+        /**
+         * If a recognized valid single tag appears unclosed, it should get self-closed
+         *
+         * @ticket 1597
+         */
+        function test_selfcloses_unclosed_known_single_tags() {
+
+                foreach ( $this-&gt;single_tags as $tag ) {
+                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&quot;, true ) );
+                }
+        }
+
+        // These are single tags WP has traditionally properly handled
+        // This test can be removed if #1597 is fixed and the next test passes, as
+        //   it supercedes this test.
+        function test_selfcloses_basic_known_single_tags_having_closing_tag() {
+                foreach ( $this-&gt;basic_single_tags as $tag ) {
+                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&lt;/$tag&gt;&quot;, true ) );
+                }
+        }
+
+        /**
+         * If a recognized valid single tag is given a closing tag, the closing tag
+         *   should get removed and tag should be self-closed.
+         *
+         * @ticket 1597
+         */
+        function test_selfcloses_known_single_tags_having_closing_tag() {
+
+                foreach ( $this-&gt;single_tags as $tag ) {
+                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&lt;/$tag&gt;&quot;, true ) );
+                }
+        }
+
+        /**
+         * @ticket 1597
+         */
+        function test_closes_unknown_single_tags_with_closing_tag() {
+
+                $inputs = array(
+                        '&lt;strong/&gt;',
+                        '&lt;em /&gt;',
+                        '&lt;p class=&quot;main1&quot;/&gt;',
+                        '&lt;p class=&quot;main2&quot; /&gt;',
+                );
+                $expected = array(
+                        '&lt;strong&gt;&lt;/strong&gt;',
+                        '&lt;em&gt;&lt;/em&gt;',
+                        '&lt;p class=&quot;main1&quot;&gt;&lt;/p&gt;',
+                        '&lt;p class=&quot;main2&quot;&gt;&lt;/p&gt;',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_closes_unclosed_single_tags_having_attributes() {
+                $inputs = array(
+                        '&lt;img src=&quot;/images/example.png&quot;&gt;',
+                        '&lt;input type=&quot;text&quot; name=&quot;example&quot;&gt;'
+                );
+                $expected = array(
+                        '&lt;img src=&quot;/images/example.png&quot;/&gt;',
+                        '&lt;input type=&quot;text&quot; name=&quot;example&quot;/&gt;'
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_allows_validly_closed_single_tags() {
+                $inputs = array(
+                        '&lt;br /&gt;',
+                        '&lt;hr /&gt;',
+                        '&lt;img src=&quot;/images/example.png&quot; /&gt;',
+                        '&lt;input type=&quot;text&quot; name=&quot;example&quot; /&gt;'
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_balances_nestable_tags() {
+                $inputs = array(
+                        '&lt;q&gt;Test&lt;q&gt;Test&lt;/q&gt;',
+                        '&lt;div&gt;&lt;div&gt;Test',
+                        '&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;',
+                );
+                $expected = array(
+                        '&lt;q&gt;Test&lt;q&gt;Test&lt;/q&gt;&lt;/q&gt;',
+                        '&lt;div&gt;&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;',
+                        '&lt;div&gt;Test&lt;/div&gt;',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_allows_adjacent_nestable_tags() {
+                $inputs = array(
+                        '&lt;blockquote&gt;&lt;blockquote&gt;Example quote&lt;/blockquote&gt;&lt;/blockquote&gt;',
+                        '&lt;div class=&quot;container&quot;&gt;&lt;div&gt;This is allowed&gt;&lt;/div&gt;&lt;/div&gt;',
+                        '&lt;span&gt;&lt;span&gt;&lt;span&gt;Example in spans&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;',
+                        '&lt;blockquote&gt;Main quote&lt;blockquote&gt;Example quote&lt;/blockquote&gt; more text&lt;/blockquote&gt;',
+                        '&lt;q&gt;&lt;q class=&quot;inner-q&quot;&gt;Inline quote&lt;/q&gt;&lt;/q&gt;',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        /**
+         * @ticket 20401
+         */
+        function test_allows_immediately_nested_object_tags() {
+
+                $object = '&lt;object id=&quot;obj1&quot;&gt;&lt;param name=&quot;param1&quot;/&gt;&lt;object id=&quot;obj2&quot;&gt;&lt;param name=&quot;param2&quot;/&gt;&lt;/object&gt;&lt;/object&gt;';
+                $this-&gt;assertEquals( $object, balanceTags( $object, true ) );
+        }
+
+        function test_balances_nested_non_nestable_tags() {
+                $inputs = array(
+                        '&lt;b&gt;&lt;b&gt;This is bold&lt;/b&gt;&lt;/b&gt;',
+                        '&lt;b&gt;Some text here &lt;b&gt;This is bold&lt;/b&gt;&lt;/b&gt;',
+                );
+                $expected = array(
+                        '&lt;b&gt;&lt;/b&gt;&lt;b&gt;This is bold&lt;/b&gt;',
+                        '&lt;b&gt;Some text here &lt;/b&gt;&lt;b&gt;This is bold&lt;/b&gt;',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_fixes_improper_closing_tag_sequence() {
+                $inputs = array(
+                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;bold &lt;em&gt;and emphasis&lt;/p&gt;&lt;/em&gt;&lt;/strong&gt;',
+                        '&lt;ul&gt;&lt;li&gt;Aaa&lt;/li&gt;&lt;li&gt;Bbb&lt;/ul&gt;&lt;/li&gt;',
+                );
+                $expected = array(
+                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;bold &lt;em&gt;and emphasis&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;',
+                        '&lt;ul&gt;&lt;li&gt;Aaa&lt;/li&gt;&lt;li&gt;Bbb&lt;/li&gt;&lt;/ul&gt;',
+                );
+
+                foreach ($inputs as $key =&gt; $input) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_adds_missing_closing_tags() {
+                $inputs = array(
+                        '&lt;b&gt;&lt;i&gt;Test&lt;/b&gt;',
+                        '&lt;p&gt;Test',
+                        '&lt;p&gt;Test test&lt;/em&gt; test&lt;/p&gt;',
+                        '&lt;/p&gt;Test',
+                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;Test&lt;/p&gt;',
+                );
+                $expected = array(
+                        '&lt;b&gt;&lt;i&gt;Test&lt;/i&gt;&lt;/b&gt;',
+                        '&lt;p&gt;Test&lt;/p&gt;',
+                        '&lt;p&gt;Test test test&lt;/p&gt;',
+                        'Test',
+                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;Test&lt;/strong&gt;&lt;/p&gt;',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_removes_extraneous_closing_tags() {
+                $inputs = array(
+                        '&lt;b&gt;Test&lt;/b&gt;&lt;/b&gt;',
+                        '&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Test',
+                        '&lt;p&gt;Test test&lt;/em&gt; test&lt;/p&gt;',
+                        '&lt;/p&gt;Test',
+                );
+                $expected = array(
+                        '&lt;b&gt;Test&lt;/b&gt;',
+                        '&lt;div&gt;Test&lt;/div&gt;&lt;div&gt;Test&lt;/div&gt;',
+                        '&lt;p&gt;Test test test&lt;/p&gt;',
+                        'Test',
+                );
+
+                foreach ( $inputs as $key =&gt; $input ) {
+                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestshttpbasephpfromrev903trunkteststest_httpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/http/base.php (from rev 903, trunk/tests/test_http.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/http/base.php                                (rev 0)
+++ trunk/tests/http/base.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,181 @@
</span><ins>+&lt;?php
+/**
+ * Note, When running these tests, remember that some things are done differently
+ * based on safe_mode. You can run the test in safe_mode like such:
+ *
+ *   phpunit -d safe_mode=on --group http
+ *
+ * You may also need `-d safe_mode_gid=1` to relax the safe_mode checks to allow
+ * inclusion of PEAR.
+ *
+ * The WP_HTTP tests require a class-http.php file of r17550 or later.
+ */
+abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
+        // You can use your own version of data/WPHTTP-testcase-redirection-script.php here.
+        var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
+
+        function setUp() {
+
+                if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
+                        $this-&gt;markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
+                        return;
+                }
+
+                $class = &quot;WP_HTTP_&quot; . $this-&gt;transport;
+                if ( !call_user_func( array($class, 'test') ) ) {
+                        $this-&gt;markTestSkipped( sprintf('The transport %s is not supported on this system', $this-&gt;transport) );
+                }
+
+                // Disable all transports aside from this one.
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( &quot;use_{$t}_transport&quot;, '__return_false' ); // Just strip them all
+                        if ( $t != $this-&gt;transport )
+                                add_filter( &quot;use_{$t}_transport&quot;, '__return_false' ); // and add it back if need be..
+                }
+        }
+
+        function tearDown() {
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( &quot;use_{$t}_transport&quot;, '__return_false' );
+                }
+        }
+
+        function test_redirect_on_301() {
+                // 5 : 5 &amp; 301
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=301&amp;rt=' . 5, array('redirection' =&gt; 5) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        function test_redirect_on_302() {
+                // 5 : 5 &amp; 302
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 5) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_301_no_redirect() {
+                // 5 &gt; 0 &amp; 301
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=301&amp;rt=' . 5, array('redirection' =&gt; 0) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals(301, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_302_no_redirect() {
+                // 5 &gt; 0 &amp; 302
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 0) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals(302, (int)$res['response']['code'] );
+        }
+
+        function test_redirections_equal() {
+                // 5 - 5
+                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 5, array('redirection' =&gt; 5) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        function test_no_head_redirections() {
+                // No redirections on HEAD request:
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 1, array('method' =&gt; 'HEAD') );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals( 302, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_head() {
+                // Redirections on HEAD request when Requested
+                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 5, array('redirection' =&gt; 5, 'method' =&gt; 'HEAD') );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals( 200, (int)$res['response']['code'] );
+        }
+
+        function test_redirections_greater() {
+                // 10 &gt; 5
+                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 10, array('redirection' =&gt; 5) );
+                $this-&gt;assertTrue( is_wp_error($res), print_r($res, true) );
+        }
+
+        function test_redirections_greater_edgecase() {
+                // 6 &gt; 5 (close edgecase)
+                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 6, array('redirection' =&gt; 5) );
+                $this-&gt;assertTrue( is_wp_error($res) );
+        }
+
+        function test_redirections_less_edgecase() {
+                // 4 &lt; 5 (close edgecase)
+                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 4, array('redirection' =&gt; 5) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirections_zero_redirections_specified() {
+                // 0 redirections asked for, Should return the document?
+                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 0) );
+                $this-&gt;assertFalse( is_wp_error($res) );
+                $this-&gt;assertEquals( 302, (int)$res['response']['code'] );
+        }
+
+        /**
+         * Do not redirect on non 3xx status codes
+         *
+         * @ticket 16889
+         *
+         * Is this valid? Streams, cURL and therefore PHP Extension (ie. all PHP Internal) follow redirects
+         * on all status codes, currently all of WP_HTTP follows this template.
+         */
+        function test_location_header_on_200() {
+                // Prints PASS on initial load, FAIL if the client follows the specified redirection
+                $res = wp_remote_request( $this-&gt;redirection_script . '?200-location=true' );
+                $this-&gt;assertEquals( 'PASS', $res['body']);
+        }
+
+        /**
+         * @ticket 11888
+         */
+        function test_send_headers() {
+                // Test that the headers sent are recieved by the server
+                $headers = array('test1' =&gt; 'test', 'test2' =&gt; 0, 'test3' =&gt; '');
+                $res = wp_remote_request( $this-&gt;redirection_script . '?header-check', array('headers' =&gt; $headers) );
+
+                $this-&gt;assertFalse( is_wp_error($res) );
+
+                $headers = array();
+                foreach ( explode(&quot;\n&quot;, $res['body']) as $key =&gt; $value ) {
+                        if ( empty($value) )
+                                continue;
+                        $parts = explode(':', $value,2);
+                        unset($heaers[$key]);
+                        $headers[ $parts[0] ] = $parts[1];
+                }
+
+                $this-&gt;assertTrue( isset($headers['test1']) &amp;&amp; 'test' == $headers['test1'] );
+                $this-&gt;assertTrue( isset($headers['test2']) &amp;&amp; '0' === $headers['test2'] );
+                // cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value.
+                // Should it be that empty headers with empty values are NOT sent?
+                //$this-&gt;assertTrue( isset($headers['test3']) &amp;&amp; '' === $headers['test3'] );
+        }
+
+        function test_file_stream() {
+                $url = 'http://unit-tests.svn.wordpress.org/trunk/data/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
+                $size = 87348;
+                $res = wp_remote_request( $url, array( 'stream' =&gt; true, 'timeout' =&gt; 30 ) ); //Auto generate the filename.
+
+                $this-&gt;assertFalse( is_wp_error( $res ) );
+                $this-&gt;assertEquals( '', $res['body'] ); // The body should be empty.
+                $this-&gt;assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
+                $this-&gt;assertEquals( $size, filesize($res['filename']) ); // Check that the file is written to disk correctly without any extra characters
+
+                unlink($res['filename']); // Remove the temporary file
+        }
+}
</ins></span></pre></div>
<a id="trunktestshttphttpphpfromrev903trunkteststest_httpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/http/http.php (from rev 903, trunk/tests/test_http.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/http/http.php                                (rev 0)
+++ trunk/tests/http/http.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;?php
+/**
+ * Non-transport-specific WP_HTTP Tests
+ *
+ * @group http
+ */
+class Tests_HTTP_HTTP extends WP_UnitTestCase {
+
+        /**
+         * @dataProvider make_absolute_url_testcases
+         */
+        function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
+                if ( ! is_callable( array( 'WP_HTTP', 'make_absolute_url' ) ) ) {
+                        $this-&gt;markTestSkipped( &quot;This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()&quot; );
+                        return;
+                }
+
+                $actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
+                $this-&gt;assertEquals( $expected, $actual );
+        }
+
+        function make_absolute_url_testcases() {
+                // 0: The Location header, 1: The current url, 3: The expected url
+                return array(
+                        array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ), // Absolute URL provided
+                        array( '/location', '', '/location' ), // No current url provided
+
+                        array( '', 'http://example.com', 'http://example.com/' ), // No location provided
+
+                        // Location provided relative to site root
+                        array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ),
+                        array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ),
+
+                        // Location provided relative to current file/directory
+                        array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ),
+                        array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ),
+                        array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ),
+
+                        // Location provided relative to current file/directory but in a parent directory
+                        array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ),
+                        array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ),
+                        array( '../file-in-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-parent.ext' ),
+                        array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ),
+
+                        // Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT)
+                        array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ),
+                        array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ),
+                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-grand-parent.ext' ),
+                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory/filename/', 'http://example.com/file-in-grand-parent.ext' ),
+                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory1/directory2/filename', 'http://example.com/file-in-grand-parent.ext' ),
+
+                        // Query strings should attach, or replace existing query string.
+                        array( '?query=string', 'http://example.com', 'http://example.com/?query=string' ),
+                        array( '?query=string', 'http://example.com/file.ext', 'http://example.com/file.ext?query=string' ),
+                        array( '?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/file.ext?query=string' ),
+                        array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ),
+
+                        // A file with a leading dot
+                        array( '.ext', 'http://example.com/', 'http://example.com/.ext' )
+                );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsksesphpfromrev903trunkteststest_includes_ksesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/kses.php (from rev 903, trunk/tests/test_includes_kses.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/kses.php                                (rev 0)
+++ trunk/tests/kses.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+&lt;?php
+/**
+ * Some simple test cases for KSES post content filtering
+ *
+ * @group formatting
+ * @group kses
+ */
+class Tests_Kses extends WP_UnitTestCase {
+
+        /**
+         * @ticket 20210
+         */
+        function test_wp_filter_post_kses_address() {
+                global $allowedposttags;
+
+                $attributes = array(
+                        'class' =&gt; 'classname',
+                        'id' =&gt; 'id',
+                        'style' =&gt; 'color: red;',
+                        'title' =&gt; 'title',
+                );
+
+                foreach ( $attributes as $name =&gt; $value ) {
+                        $string = &quot;&lt;address $name='$value'&gt;1 WordPress Avenue, The Internet.&lt;/address&gt;&quot;;
+                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        /**
+         * @ticket 20210
+         */
+        function test_wp_filter_post_kses_a() {
+                global $allowedposttags;
+
+                $attributes = array(
+                        'class' =&gt; 'classname',
+                        'id' =&gt; 'id',
+                        'style' =&gt; 'color: red;',
+                        'title' =&gt; 'title',
+                        'href' =&gt; 'http://example.com',
+                        'rel' =&gt; 'related',
+                        'rev' =&gt; 'revision',
+                        'name' =&gt; 'name',
+                        'target' =&gt; '_blank',
+                );
+
+                foreach ( $attributes as $name =&gt; $value ) {
+                        $string = &quot;&lt;a $name='$value'&gt;I link this&lt;/a&gt;&quot;;
+                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        /**
+         * @ticket 20210
+         */
+        function test_wp_filter_post_kses_abbr() {
+                global $allowedposttags;
+
+                $attributes = array(
+                        'class' =&gt; 'classname',
+                        'id' =&gt; 'id',
+                        'style' =&gt; 'color: red;',
+                        'title' =&gt; 'title',
+                );
+
+                foreach ( $attributes as $name =&gt; $value ) {
+                        $string = &quot;&lt;abbr $name='$value'&gt;WP&lt;/abbr&gt;&quot;;
+                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        function test_feed_links() {
+                global $allowedposttags;
+
+                $content = &lt;&lt;&lt;EOF
+&lt;a href=&quot;feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:javascript:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;javascript:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:javascript:feed:javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:feed:http:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
+EOF;
+
+        $this-&gt;assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsmediaphpfromrev903trunkteststest_includes_mediaphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/media.php (from rev 903, trunk/tests/test_includes_media.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/media.php                                (rev 0)
+++ trunk/tests/media.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,106 @@
</span><ins>+&lt;?php
+
+/**
+ * @group media
+ * @group shortcode
+ */
+class Tests_Media extends WP_UnitTestCase {
+
+  function setUp() {
+    $this-&gt;caption = 'A simple caption.';
+    $this-&gt;html_content = &lt;&lt;&lt;CAP
+A &lt;strong class='classy'&gt;bolded&lt;/strong&gt; &lt;em&gt;caption&lt;/em&gt; with a &lt;a href=&quot;#&quot;&gt;link&lt;/a&gt;.
+CAP;
+    $this-&gt;img_content = &lt;&lt;&lt;CAP
+&lt;img src=&quot;pic.jpg&quot; id='anId' alt=&quot;pic&quot;/&gt;
+CAP;
+  }
+
+  function test_img_caption_shortcode_added() {
+    global $shortcode_tags;
+    $this-&gt;assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
+    $this-&gt;assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
+  }
+
+  function test_img_caption_shortcode_with_empty_params() {
+    $result = img_caption_shortcode( array() );
+    $this-&gt;assertNull( $result );
+  }
+
+  function test_img_caption_shortcode_with_bad_attr() {
+    $result = img_caption_shortcode( array(), 'content' );
+    $this-&gt;assertEquals( 'content', 'content' );
+  }
+
+  function test_img_caption_shortcode_with_old_format() {
+    $result = img_caption_shortcode(
+      array( 'width' =&gt; 20, 'caption' =&gt; $this-&gt;caption )
+    );
+    $this-&gt;assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;/{$this-&gt;caption}/&quot;, $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;/width: 30/&quot;, $result, $_r ) );
+  }
+
+  function test_img_caption_shortcode_with_old_format_id_and_align() {
+    $result = img_caption_shortcode(
+      array(
+        'width' =&gt; 20,
+        'caption' =&gt; $this-&gt;caption,
+        'id' =&gt; '&quot;myId',
+        'align' =&gt; '&amp;myAlignment'
+      )
+    );
+    $this-&gt;assertEquals( 1, preg_match_all( '/wp-caption &amp;amp;myAlignment/', $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( '/id=&quot;&amp;quot;myId&quot;/', $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;/{$this-&gt;caption}/&quot;, $result, $_r ) );
+  }
+
+  function test_new_img_caption_shortcode_with_html_caption() {
+    $result = img_caption_shortcode(
+      array( 'width' =&gt; 20, 'caption' =&gt; $this-&gt;html_content )
+    );
+    $our_preg = preg_quote( $this-&gt;html_content );
+
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$our_preg}~&quot;, $result, $_r ) );
+  }
+
+  function test_new_img_caption_shortcode_new_format() {
+    $result = img_caption_shortcode(
+      array( 'width' =&gt; 20 ),
+      $this-&gt;img_content . $this-&gt;html_content
+    );
+    $img_preg = preg_quote( $this-&gt;img_content );
+    $content_preg = preg_quote( $this-&gt;html_content );
+
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
+  }
+
+  function test_new_img_caption_shortcode_new_format_and_linked_image() {
+    $linked_image = &quot;&lt;a href='#'&gt;{$this-&gt;img_content}&lt;/a&gt;&quot;;
+    $result = img_caption_shortcode(
+      array( 'width' =&gt; 20 ),
+      $linked_image . $this-&gt;html_content
+    );
+    $img_preg = preg_quote( $linked_image );
+    $content_preg = preg_quote( $this-&gt;html_content );
+
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
+  }
+
+  function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
+    $linked_image = &quot;&lt;a href='#'&gt;{$this-&gt;img_content}&lt;/a&gt;&quot;;
+    $result = img_caption_shortcode(
+      array( 'width' =&gt; 20 ),
+      $linked_image . &quot;\n\n&quot; . $this-&gt;html_content
+    );
+    $img_preg = preg_quote( $linked_image );
+    $content_preg = preg_quote( $this-&gt;html_content );
+
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
+    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
+  }
+
+}
</ins></span></pre></div>
<a id="trunktestsmetaphpfromrev903trunkteststest_includes_metaphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/meta.php (from rev 903, trunk/tests/test_includes_meta.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/meta.php                                (rev 0)
+++ trunk/tests/meta.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+&lt;?php
+
+/**
+ * @group meta
+ */
+class Tests_Meta extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
+                $this-&gt;meta_id = add_metadata( 'user', $this-&gt;author-&gt;ID, 'meta_key', 'meta_value' );
+                $this-&gt;delete_meta_id = add_metadata( 'user', $this-&gt;author-&gt;ID, 'delete_meta_key', 'delete_meta_value' );
+        }
+
+        function _meta_sanitize_cb ( $meta_value, $meta_key, $meta_type ) {
+                return 'sanitized';
+        }
+
+        function test_sanitize_meta() {
+                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
+                $this-&gt;assertEquals( 'unsanitized', $meta );
+
+                register_meta( 'post', 'some_meta', array( &amp;$this, '_meta_sanitize_cb' ) );
+                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
+                $this-&gt;assertEquals( 'sanitized', $meta );
+        }
+
+        function test_delete_metadata_by_mid() {
+                // Let's try and delete a non-existing ID, non existing meta
+                $this-&gt;assertFalse( delete_metadata_by_mid( 'user', 0 ) );
+                $this-&gt;assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this-&gt;delete_meta_id ) );
+
+                // Now let's delete the real meta data
+                $this-&gt;assertTrue( delete_metadata_by_mid( 'user', $this-&gt;delete_meta_id ) );
+
+                // And make sure it's been deleted
+                $this-&gt;assertFalse( get_metadata_by_mid( 'user', $this-&gt;delete_meta_id ) );
+
+                // Make sure the caches are cleared
+                $this-&gt;assertFalse( (bool) get_user_meta( $this-&gt;author-&gt;ID, 'delete_meta_key' ) );
+        }
+
+        function test_update_metadata_by_mid() {
+                // Setup
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+
+                // Update the meta value
+                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_new_value' ) );
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+                $this-&gt;assertEquals( 'meta_new_value', $meta-&gt;meta_value );
+
+                // Update the meta value
+                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_new_value', 'meta_new_key' ) );
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+                $this-&gt;assertEquals( 'meta_new_key', $meta-&gt;meta_key );
+
+                // Update the key and value
+                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_value', 'meta_key' ) );
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+                $this-&gt;assertEquals( 'meta_key', $meta-&gt;meta_key );
+                $this-&gt;assertEquals( 'meta_value', $meta-&gt;meta_value );
+
+                // Update the value that has to be serialized
+                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, array( 'first', 'second' ) ) );
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+                $this-&gt;assertEquals( array( 'first', 'second' ), $meta-&gt;meta_value );
+
+                // Let's try some invalid meta data
+                $this-&gt;assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
+                $this-&gt;assertFalse( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_value', array('invalid', 'key' ) ) );
+
+                // Let's see if caches get cleared after updates.
+                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
+                $first = get_user_meta( $meta-&gt;user_id, $meta-&gt;meta_key );
+                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'other_meta_value' ) );
+                $second = get_user_meta( $meta-&gt;user_id, $meta-&gt;meta_key );
+                $this-&gt;assertFalse( $first === $second );
+        }
+
+        function test_metadata_exists() {
+                $this-&gt;assertFalse( metadata_exists( 'user',  $this-&gt;author-&gt;ID, 'foobarbaz' ) );
+                $this-&gt;assertTrue( metadata_exists( 'user',  $this-&gt;author-&gt;ID, 'meta_key' ) );
+                $this-&gt;assertFalse( metadata_exists( 'user',  1234567890, 'foobarbaz' ) );
+                $this-&gt;assertFalse( metadata_exists( 'user',  1234567890, 'meta_key' ) );
+        }
+
+        function test_metadata_slashes() {
+                $key = rand_str();
+                $value = 'Test\\singleslash';
+                $expected = 'Testsingleslash';
+                $value2 = 'Test\\\\doubleslash';
+                $expected2 = 'Test\\doubleslash';
+                $this-&gt;assertFalse( metadata_exists( 'user', $this-&gt;author-&gt;ID, $key ) );
+                $this-&gt;assertFalse( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
+                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertInternalType( 'int', add_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value ) );
+                $this-&gt;assertEquals( $expected, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
+                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertInternalType( 'int', update_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value ) );
+                $this-&gt;assertEquals( $expected, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertTrue( update_metadata( 'user', $this-&gt;author-&gt;ID, $key, 'blah' ) );
+                $this-&gt;assertEquals( 'blah', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
+                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertFalse( metadata_exists( 'user', $this-&gt;author-&gt;ID, $key ) );
+
+                // Test overslashing
+                $this-&gt;assertInternalType( 'int', add_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value2 ) );
+                $this-&gt;assertEquals( $expected2, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
+                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+                $this-&gt;assertInternalType( 'int', update_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value2 ) );
+                $this-&gt;assertEquals( $expected2, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsmsphpfromrev903trunkteststest_msphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/ms.php (from rev 903, trunk/tests/test_ms.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ms.php                                (rev 0)
+++ trunk/tests/ms.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,354 @@
</span><ins>+&lt;?php
+
+if ( is_multisite() ) :
+
+/**
+ * A set of unit tests for WordPress Multisite
+ *
+ * @group multisite
+ */
+class Tests_MS extends WP_UnitTestCase {
+
+        protected $plugin_hook_count = 0;
+
+        function test_create_and_delete_blog() {
+                global $wpdb, $current_site;
+
+                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 4 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this-&gt;assertInternalType( 'int', $blog_id );
+                        $prefix = $wpdb-&gt;get_blog_prefix( $blog_id );
+
+                        foreach ( $wpdb-&gt;tables( 'blog', false ) as $table ) {
+                                $table_fields = $wpdb-&gt;get_results( &quot;DESCRIBE $prefix$table;&quot; );
+                                $this-&gt;assertNotEmpty( $table_fields );
+                                $result = $wpdb-&gt;get_results( &quot;SELECT * FROM $prefix$table LIMIT 1&quot; );
+                                if ( 'commentmeta' == $table )
+                                        $this-&gt;assertEmpty( $result );
+                                else
+                                        $this-&gt;assertNotEmpty( $result );
+                        }
+                }
+
+                // update the blog count cache to use get_blog_count()
+                wp_update_network_counts();
+                $this-&gt;assertEquals( 4 + 1, (int) get_blog_count() );
+
+                $drop_tables = false;
+                // delete all blogs
+                foreach ( $blog_ids as $blog_id ) {
+                        // drop tables for every second blog
+                        $drop_tables = ! $drop_tables;
+                        wpmu_delete_blog( $blog_id, $drop_tables );
+
+                        $prefix = $wpdb-&gt;get_blog_prefix( $blog_id );
+                        foreach ( $wpdb-&gt;tables( 'blog', false ) as $table ) {
+                                $table_fields = $wpdb-&gt;get_results( &quot;DESCRIBE $prefix$table;&quot; );
+                                if ( $drop_tables )
+                                        $this-&gt;assertEmpty( $table_fields );
+                                else
+                                        $this-&gt;assertNotEmpty( $table_fields, $prefix . $table );
+                        }
+                }
+
+                // update the blog count cache to use get_blog_count()
+                wp_update_network_counts();
+                $this-&gt;assertEquals( 1, get_blog_count() );
+        }
+
+        function test_get_blogs_of_user() {
+                global $current_site;
+
+                // Logged out users don't have blogs.
+                $this-&gt;assertEquals( array(), get_blogs_of_user( 0 ) );
+
+                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 10, array( 'user_id' =&gt; $user1_id ) );
+
+                foreach ( $blog_ids as $blog_id )
+                        $this-&gt;assertInternalType( 'int', $blog_id );
+
+                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
+                sort( $blogs_of_user );
+                $this-&gt;assertEquals ( array_merge( array( 1 ), $blog_ids), $blogs_of_user );
+
+                $this-&gt;assertTrue( remove_user_from_blog( $user1_id, 1 ) );
+
+                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
+                sort( $blogs_of_user );
+                $this-&gt;assertEquals ( $blog_ids, $blogs_of_user );
+
+                // Non-existent users don't have blogs.
+                wpmu_delete_user( $user1_id );
+                $user = new WP_User( $user1_id );
+                $this-&gt;assertFalse( $user-&gt;exists(), 'WP_User-&gt;exists' );
+                $this-&gt;assertEquals( array(), get_blogs_of_user( $user1_id ) );
+        }
+
+        function test_is_blog_user() {
+                global $current_site, $wpdb;
+
+                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+
+                $old_current = get_current_user_id();
+                wp_set_current_user( $user1_id );
+
+                $this-&gt;assertTrue( is_blog_user() );
+                $this-&gt;assertTrue( is_blog_user( $wpdb-&gt;blogid ) );
+
+                $blog_ids = array();
+
+                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 5 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this-&gt;assertInternalType( 'int', $blog_id );
+                        $this-&gt;assertTrue( is_blog_user( $blog_id ) );
+                        $this-&gt;assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+                        $this-&gt;assertFalse( is_blog_user( $blog_id ) );
+                }
+
+                wp_set_current_user( $old_current );
+        }
+
+        function test_is_user_member_of_blog() {
+                global $current_site, $wpdb;
+
+                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+
+                $old_current = get_current_user_id();
+                wp_set_current_user( $user1_id );
+
+                $this-&gt;assertTrue( is_user_member_of_blog() );
+                $this-&gt;assertTrue( is_user_member_of_blog( 0, 0 ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( 0, $wpdb-&gt;blogid ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( $user1_id ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( $user1_id, $wpdb-&gt;blogid ) );
+
+                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 5 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this-&gt;assertInternalType( 'int', $blog_id );
+                        $this-&gt;assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) );
+                        $this-&gt;assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+                        $this-&gt;assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) );
+                }
+
+                wpmu_delete_user( $user1_id );
+                $user = new WP_User( $user1_id );
+                $this-&gt;assertFalse( $user-&gt;exists(), 'WP_User-&gt;exists' );
+                $this-&gt;assertFalse( is_user_member_of_blog( $user1_id ), 'is_user_member_of_blog' );
+
+                wp_set_current_user( $old_current );
+        }
+
+        function test_active_network_plugins() {
+                $path = &quot;hello.php&quot;;
+
+                // local activate, should be invisible for the network
+                activate_plugin($path); // $network_wide = false
+                $active_plugins = wp_get_active_network_plugins();
+                $this-&gt;assertEquals( Array(), $active_plugins );
+
+                add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) );
+
+                // activate the plugin sitewide
+                activate_plugin($path, '', $network_wide = true);
+                $active_plugins = wp_get_active_network_plugins();
+                $this-&gt;assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins );
+
+                //deactivate the plugin
+                deactivate_plugins($path);
+                $active_plugins = wp_get_active_network_plugins();
+                $this-&gt;assertEquals( Array(), $active_plugins );
+
+                $this-&gt;assertEquals( 1, $this-&gt;plugin_hook_count ); // testing actions and silent mode
+
+                activate_plugin($path, '', $network_wide = true);
+                deactivate_plugins($path, true); // silent
+
+                $this-&gt;assertEquals( 1, $this-&gt;plugin_hook_count ); // testing actions and silent mode
+        }
+
+        function _helper_deactivate_hook() {
+                $this-&gt;plugin_hook_count++;
+        }
+
+        function test_get_user_count() {
+                // Refresh the cache
+                wp_update_network_counts();
+                $start_count = get_user_count();
+
+                $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+
+                $count = get_user_count(); // No change, cache not refreshed
+                $this-&gt;assertEquals( $start_count, $count );
+
+                wp_update_network_counts(); // Magic happens here
+
+                $count = get_user_count();
+                $this-&gt;assertEquals( $start_count + 1, $count );
+        }
+
+        function test_wp_schedule_update_network_counts() {
+                $this-&gt;assertFalse(wp_next_scheduled('update_network_counts'));
+
+                // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set
+                wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
+
+                $this-&gt;assertInternalType('int', wp_next_scheduled('update_network_counts'));
+        }
+
+        function test_users_can_register_signup_filter() {
+
+                $registration = get_site_option('registration');
+                $this-&gt;assertFalse( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'all');
+                $this-&gt;assertTrue( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'user');
+                $this-&gt;assertTrue( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'none');
+                $this-&gt;assertFalse( users_can_register_signup_filter() );
+        }
+
+        function test_get_dashboard_blog() {
+                global $current_site;
+
+                // if there is no dashboard blog set, current blog is used
+                $dashboard_blog = get_dashboard_blog();
+                $this-&gt;assertEquals( 1, $dashboard_blog-&gt;blog_id );
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id ) );
+                $this-&gt;assertInternalType( 'int', $blog_id );
+
+                // set the dashboard blog to another one
+                update_site_option( 'dashboard_blog', $blog_id );
+                $dashboard_blog = get_dashboard_blog();
+                $this-&gt;assertEquals( $blog_id, $dashboard_blog-&gt;blog_id );
+        }
+
+        function test_wpmu_log_new_registrations() {
+                global $wpdb;
+
+                $user = new WP_User( 1 );
+                $ip = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
+
+                wpmu_log_new_registrations(1,1);
+
+                // currently there is no wrapper function for the registration_log
+                $reg_blog = $wpdb-&gt;get_col( &quot;SELECT email FROM {$wpdb-&gt;registration_log} WHERE {$wpdb-&gt;registration_log}.blog_id = 1 AND IP LIKE '&quot; . $ip . &quot;'&quot; );
+                $this-&gt;assertEquals( $user-&gt;user_email, $reg_blog[ count( $reg_blog )-1 ] );
+        }
+
+        /**
+         * @ticket 18119
+         */
+        function test_upload_is_user_over_quota() {
+                $default_space_allowed = 50;
+                $echo = false;
+
+                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertTrue( is_upload_space_available() );
+
+                update_site_option('upload_space_check_disabled', true);
+                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertTrue( is_upload_space_available() );
+
+                update_site_option( 'blog_upload_space', 0 );
+                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertEquals( $default_space_allowed, get_space_allowed() );
+                $this-&gt;assertTrue( is_upload_space_available() );
+
+                update_site_option('upload_space_check_disabled', false);
+                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertTrue( is_upload_space_available() );
+
+                if ( ! file_exists( BLOGSUPLOADDIR ) )
+                        $this-&gt;markTestSkipped( 'This test is broken when blogs.dir does not exist. ');
+
+                /*
+                This is broken when blogs.dir does not exist, as get_upload_space_available()
+                simply returns the value of blog_upload_space (converted to bytes), which would
+                be negative but still not false. When blogs.dir does exist, &lt; 0 is returned as 0.
+                */
+
+                update_site_option( 'blog_upload_space', -1 );
+                $this-&gt;assertTrue( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertEquals( -1, get_space_allowed() );
+                $this-&gt;assertFalse( is_upload_space_available() );
+
+                update_option( 'blog_upload_space', 0 );
+                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertEquals( $default_space_allowed, get_space_allowed() );
+                $this-&gt;assertTrue( is_upload_space_available() );
+
+                update_option( 'blog_upload_space', -1 );
+                $this-&gt;assertTrue( upload_is_user_over_quota( $echo ) );
+                $this-&gt;assertEquals( -1, get_space_allowed() );
+                $this-&gt;assertFalse( is_upload_space_available() );
+        }
+
+        function test_wpmu_update_blogs_date() {
+                global $wpdb;
+
+                wpmu_update_blogs_date();
+
+                // compare the update time with the current time, allow delta &lt; 2
+                $blog = get_blog_details( $wpdb-&gt;blogid );
+                $current_time = time();
+                $time_difference = $current_time - strtotime( $blog-&gt;last_updated );
+                $this-&gt;assertLessThan( 2, $time_difference );
+        }
+
+        function test_getters(){
+                global $current_site;
+
+                $blog_id = get_current_blog_id();
+                $blog = get_blog_details( $blog_id );
+                $this-&gt;assertEquals( $blog_id, $blog-&gt;blog_id );
+                $this-&gt;assertEquals( $current_site-&gt;domain, $blog-&gt;domain );
+                $this-&gt;assertEquals( '/', $blog-&gt;path );
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id, 'path' =&gt; '/test_blogname', 'title' =&gt; 'Test Title' ) );
+                $this-&gt;assertInternalType( 'int', $blog_id );
+
+                $this-&gt;assertEquals( 'http://' . DOMAIN_CURRENT_SITE . PATH_CURRENT_SITE . 'test_blogname/', get_blogaddress_by_name('test_blogname') );
+
+                $this-&gt;assertEquals( $blog_id, get_id_from_blogname('test_blogname') );
+        }
+
+        function test_update_blog_details() {
+                global $current_site;
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id, 'path' =&gt; '/test_blogpath', 'title' =&gt; 'Test Title' ) );
+                $this-&gt;assertInternalType( 'int', $blog_id );
+
+                $result = update_blog_details( $blog_id, array('domain' =&gt; 'example.com', 'path' =&gt; 'my_path/') );
+                $this-&gt;assertTrue( $result );
+
+                $blog = get_blog_details( $blog_id );
+                $this-&gt;assertEquals( 'example.com', $blog-&gt;domain );
+                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
+                $this-&gt;assertEquals( '0', $blog-&gt;spam );
+
+                $result = update_blog_details( $blog_id, array('domain' =&gt; 'example2.com','spam' =&gt; 1) );
+                $this-&gt;assertTrue( $result );
+                $blog = get_blog_details( $blog_id );
+                $this-&gt;assertEquals( 'example2.com', $blog-&gt;domain );
+                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
+                $this-&gt;assertEquals( '1', $blog-&gt;spam );
+
+                $result = update_blog_details( $blog_id );
+                $this-&gt;assertFalse( $result );
+                $blog = get_blog_details( $blog_id );
+                $this-&gt;assertEquals( 'example2.com', $blog-&gt;domain );
+                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
+                $this-&gt;assertEquals( '1', $blog-&gt;spam );
+                $this-&gt;assertFalse( $result );
+        }
+}
+
+endif;
</ins></span></pre></div>
<a id="trunktestsoptionblogOptionphpfromrev903trunkteststest_optionphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/option/blogOption.php (from rev 903, trunk/tests/test_option.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/option/blogOption.php                                (rev 0)
+++ trunk/tests/option/blogOption.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;?php
+
+if ( is_multisite() ) :
+/**
+ * @group option
+ */
+class Tests_Option_BlogOption extends WP_UnitTestCase {
+        function test_from_same_site() {
+                $key = rand_str();
+                $key2 = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this-&gt;assertFalse( get_blog_option( 1, 'doesnotexist' ) );
+                $this-&gt;assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
+
+                $this-&gt;assertTrue( add_blog_option( 1, $key, $value ) );
+                // Assert all values of $blog_id that means the current or main blog (the same here).
+                $this-&gt;assertEquals( $value, get_blog_option( 1, $key ) );
+                $this-&gt;assertEquals( $value, get_blog_option( null, $key ) );
+                $this-&gt;assertEquals( $value, get_blog_option( '1', $key ) );
+                $this-&gt;assertEquals( $value, get_option( $key ) ); // check get_option()
+
+                $this-&gt;assertFalse( add_blog_option( 1, $key, $value ) );  // Already exists
+                $this-&gt;assertFalse( update_blog_option( 1, $key, $value ) );  // Value is the same
+                $this-&gt;assertTrue( update_blog_option( 1, $key, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key ) );
+                $this-&gt;assertEquals( $value2, get_option( $key ) ); // check get_option()
+                $this-&gt;assertFalse( add_blog_option( 1, $key, $value ) );
+                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key ) );
+                $this-&gt;assertEquals( $value2, get_option( $key ) ); // check get_option()
+
+                $this-&gt;assertTrue( delete_blog_option( 1, $key ) );
+                $this-&gt;assertFalse( get_blog_option( 1, $key ) );
+                $this-&gt;assertFalse( get_option( $key ) ); // check get_option()
+                $this-&gt;assertFalse( delete_blog_option( 1, $key ) );
+                $this-&gt;assertTrue( update_blog_option( 1, $key2, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key2 ) );
+                $this-&gt;assertEquals( $value2, get_option( $key2 ) ); // check get_option()
+                $this-&gt;assertTrue( delete_blog_option( 1, $key2 ) );
+                $this-&gt;assertFalse( get_blog_option( 1, $key2 ) );
+                $this-&gt;assertFalse( get_option( $key2 ) ); // check get_option()
+        }
+}
+endif;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsoptionoptionphpfromrev903trunkteststest_optionphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/option/option.php (from rev 903, trunk/tests/test_option.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/option/option.php                                (rev 0)
+++ trunk/tests/option/option.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+&lt;?php
+
+/**
+ * @group option
+ */
+class Tests_Option_Option extends WP_UnitTestCase {
+
+        function __return_foo() {
+                return 'foo';
+        }
+
+        function test_the_basics() {
+                $key = rand_str();
+                $key2 = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
+                $this-&gt;assertTrue( add_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_option( $key ) );
+                $this-&gt;assertFalse( add_option( $key, $value ) );  // Already exists
+                $this-&gt;assertFalse( update_option( $key, $value ) );  // Value is the same
+                $this-&gt;assertTrue( update_option( $key, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_option( $key ) );
+                $this-&gt;assertFalse( add_option( $key, $value ) );
+                $this-&gt;assertEquals( $value2, get_option( $key ) );
+                $this-&gt;assertTrue( delete_option( $key ) );
+                $this-&gt;assertFalse( get_option( $key ) );
+                $this-&gt;assertFalse( delete_option( $key ) );
+
+                $this-&gt;assertTrue( update_option( $key2, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_option( $key2 ) );
+                $this-&gt;assertTrue( delete_option( $key2 ) );
+                $this-&gt;assertFalse( get_option( $key2 ) );
+        }
+
+        function test_default_filter() {
+                $random = rand_str();
+
+                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
+
+                // Default filter overrides $default arg.
+                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( 'foo', get_option( 'doesnotexist', 'bar' ) );
+
+                // Remove the filter and the $default arg is honored.
+                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
+
+                // Once the option exists, the $default arg and the default filter are ignored.
+                add_option( 'doesnotexist', $random );
+                $this-&gt;assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+
+                // Cleanup
+                $this-&gt;assertTrue( delete_option( 'doesnotexist' ) );
+                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
+
+                $this-&gt;assertTrue( add_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_option( $key ) );
+
+                $value = (object) $value;
+                $this-&gt;assertTrue( update_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_option( $key ) );
+                $this-&gt;assertTrue( delete_option( $key ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsoptionsiteOptionphpfromrev903trunkteststest_optionphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/option/siteOption.php (from rev 903, trunk/tests/test_option.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/option/siteOption.php                                (rev 0)
+++ trunk/tests/option/siteOption.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+&lt;?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SiteOption extends WP_UnitTestCase {
+        function __return_foo() {
+                return 'foo';
+        }
+
+        function test_the_basics() {
+                $key = rand_str();
+                $key2 = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
+                $this-&gt;assertTrue( add_site_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_option( $key ) );
+                $this-&gt;assertFalse( add_site_option( $key, $value ) );  // Already exists
+                $this-&gt;assertFalse( update_site_option( $key, $value ) );  // Value is the same
+                $this-&gt;assertTrue( update_site_option( $key, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_site_option( $key ) );
+                $this-&gt;assertFalse( add_site_option( $key, $value ) );
+                $this-&gt;assertEquals( $value2, get_site_option( $key ) );
+                $this-&gt;assertTrue( delete_site_option( $key ) );
+                $this-&gt;assertFalse( get_site_option( $key ) );
+                $this-&gt;assertFalse( delete_site_option( $key ) );
+
+                $this-&gt;assertTrue( update_site_option( $key2, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_site_option( $key2 ) );
+                $this-&gt;assertTrue( delete_site_option( $key2 ) );
+                $this-&gt;assertFalse( get_site_option( $key2 ) );
+        }
+
+        function test_default_filter() {
+                $random = rand_str();
+
+                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
+
+                // Default filter overrides $default arg.
+                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( 'foo', get_site_option( 'doesnotexist', 'bar' ) );
+
+                // Remove the filter and the $default arg is honored.
+                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( 'bar', get_site_option( 'doesnotexist', 'bar' ) );
+
+                // Once the option exists, the $default arg and the default filter are ignored.
+                add_site_option( 'doesnotexist', $random );
+                $this-&gt;assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this-&gt;assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+
+                // Cleanup
+                $this-&gt;assertTrue( delete_site_option( 'doesnotexist' ) );
+                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
+
+                $this-&gt;assertTrue( add_site_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_option( $key ) );
+
+                $value = (object) $value;
+                $this-&gt;assertTrue( update_site_option( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_option( $key ) );
+                $this-&gt;assertTrue( delete_site_option( $key ) );
+        }
+
+        // #15497 - ensure update_site_option will add options with false-y values
+        function test_update_adds_falsey_value() {
+                $key = rand_str();
+                $value = 0;
+
+                delete_site_option( $key );
+                $this-&gt;assertTrue( update_site_option( $key, $value ) );
+                wp_cache_flush(); // ensure we're getting the value from the DB
+                $this-&gt;assertEquals( $value, get_site_option( $key ) );
+        }
+
+        // #18955 - ensure get_site_option doesn't cache the default value for non-existent options
+        function test_get_doesnt_cache_default_value() {
+                $option = rand_str();
+                $default = 'a default';
+
+                $this-&gt;assertEquals( get_site_option( $option, $default ), $default );
+                $this-&gt;assertFalse( get_site_option( $option ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsoptionsiteTransientphpfromrev903trunkteststest_optionphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/option/siteTransient.php (from rev 903, trunk/tests/test_option.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/option/siteTransient.php                                (rev 0)
+++ trunk/tests/option/siteTransient.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SiteTransient extends WP_UnitTestCase {
+
+        function test_the_basics() {
+                $key = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this-&gt;assertFalse( get_site_transient( 'doesnotexist' ) );
+                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
+                $this-&gt;assertFalse( set_site_transient( $key, $value ) );
+                $this-&gt;assertTrue( set_site_transient( $key, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_site_transient( $key ) );
+                $this-&gt;assertTrue( delete_site_transient( $key ) );
+                $this-&gt;assertFalse( get_site_transient( $key ) );
+                $this-&gt;assertFalse( delete_site_transient( $key ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
+
+                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
+
+                $value = (object) $value;
+                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
+                $this-&gt;assertTrue( delete_site_transient( $key ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsoptiontransientphpfromrev903trunkteststest_optionphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/option/transient.php (from rev 903, trunk/tests/test_option.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/option/transient.php                                (rev 0)
+++ trunk/tests/option/transient.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;?php
+
+/**
+ * @group option
+ */
+class Tests_Option_Transient extends WP_UnitTestCase {
+
+        function test_the_basics() {
+                $key = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this-&gt;assertFalse( get_transient( 'doesnotexist' ) );
+                $this-&gt;assertTrue( set_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_transient( $key ) );
+                $this-&gt;assertFalse( set_transient( $key, $value ) );
+                $this-&gt;assertTrue( set_transient( $key, $value2 ) );
+                $this-&gt;assertEquals( $value2, get_transient( $key ) );
+                $this-&gt;assertTrue( delete_transient( $key ) );
+                $this-&gt;assertFalse( get_transient( $key ) );
+                $this-&gt;assertFalse( delete_transient( $key ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
+
+                $this-&gt;assertTrue( set_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_transient( $key ) );
+
+                $value = (object) $value;
+                $this-&gt;assertTrue( set_transient( $key, $value ) );
+                $this-&gt;assertEquals( $value, get_transient( $key ) );
+                $this-&gt;assertTrue( delete_transient( $key ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestspostfilteringphpfromrev903trunkteststest_post_filteringphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/filtering.php (from rev 903, trunk/tests/test_post_filtering.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/filtering.php                                (rev 0)
+++ trunk/tests/post/filtering.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,212 @@
</span><ins>+&lt;?php
+
+// save and fetch posts to make sure content is properly filtered.
+// these tests don't care what code is responsible for filtering or how it is called, just that it happens when a post is saved.
+
+/**
+ * @group post
+ * @group formatting
+ */
+class Tests_Post_Filtering extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                update_option('use_balanceTags', 1);
+                kses_init_filters();
+
+        }
+
+        function tearDown() {
+                kses_remove_filters();
+                parent::tearDown();
+        }
+
+        // a simple test to make sure unclosed tags are fixed
+        function test_post_content_unknown_tag() {
+
+                $content = &lt;&lt;&lt;EOF
+&lt;foobar&gt;no such tag&lt;/foobar&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+no such tag
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        // a simple test to make sure unbalanced tags are fixed
+        function test_post_content_unbalanced_tag() {
+
+                $content = &lt;&lt;&lt;EOF
+&lt;i&gt;italics
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;i&gt;italics&lt;/i&gt;
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        // test kses filtering of disallowed attribute
+        function test_post_content_disallowed_attr() {
+
+                $content = &lt;&lt;&lt;EOF
+&lt;img src='foo' width='500' href='shlorp' /&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;img src='foo' width='500' /&gt;
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        /**
+         * test kses bug. xhtml does not require space before closing empty element
+         * @ticket 12394
+         */
+        function test_post_content_xhtml_empty_elem() {
+                $content = &lt;&lt;&lt;EOF
+&lt;img src='foo' width='500' height='300'/&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;img src='foo' width='500' height='300' /&gt;
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span a --more-- tag
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_more() {
+                $content = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;!--more--&gt;
+that's continued after the jump&lt;/em&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;/em&gt;&lt;!--more--&gt;
+that's continued after the jump
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span a --nextpage-- tag
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_nextpage() {
+                $content = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;!--nextpage--&gt;
+that's continued after the jump&lt;/em&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;/em&gt;&lt;!--nextpage--&gt;
+that's continued after the jump
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order)
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_more_nextpage() {
+                $content = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;!--more--&gt;
+that's continued after the jump&lt;/em&gt;
+&lt;!--nextpage--&gt;
+&lt;p&gt;and the next page
+&lt;!--nextpage--&gt;
+breaks the graf&lt;/p&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;/em&gt;&lt;!--more--&gt;
+that's continued after the jump
+&lt;!--nextpage--&gt;
+&lt;p&gt;and the next page
+&lt;/p&gt;&lt;!--nextpage--&gt;
+breaks the graf
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order)
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_nextpage_more() {
+                $content = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;!--nextpage--&gt;
+that's continued after the jump&lt;/em&gt;
+&lt;!--more--&gt;
+&lt;p&gt;and the next page
+&lt;!--nextpage--&gt;
+breaks the graf&lt;/p&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;/em&gt;&lt;!--nextpage--&gt;
+that's continued after the jump
+&lt;!--more--&gt;
+&lt;p&gt;and the next page
+&lt;/p&gt;&lt;!--nextpage--&gt;
+breaks the graf
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
+        }
+
+        // make sure unbalanced tags are untouched when the balance option is off
+        function test_post_content_nobalance_nextpage_more() {
+
+                update_option('use_balanceTags', 0);
+
+                $content = &lt;&lt;&lt;EOF
+&lt;em&gt;some text&lt;!--nextpage--&gt;
+that's continued after the jump&lt;/em&gt;
+&lt;!--more--&gt;
+&lt;p&gt;and the next page
+&lt;!--nextpage--&gt;
+breaks the graf&lt;/p&gt;
+EOF;
+
+                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
+                $post = get_post($id);
+
+                $this-&gt;assertEquals( $content, $post-&gt;post_content );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsqueryresultsphpfromrev903trunkteststest_query_resultsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/query/results.php (from rev 903, trunk/tests/test_query_results.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query/results.php                                (rev 0)
+++ trunk/tests/query/results.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,285 @@
</span><ins>+&lt;?php
+
+/**
+ *
+ * Test various query vars and make sure the WP_Query class selects the correct posts.
+ * We're testing against a known data set, so we can check that specific posts are included in the output.
+ *
+ * @group query
+ */
+class Tests_Query_Results extends WP_UnitTestCase {
+        protected $q;
+
+        function setUp() {
+                parent::setUp();
+
+                $cat_a = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-a' ) );
+                $cat_b = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-b' ) );
+                $cat_c = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-c' ) );
+
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-b-c', 'post_date' =&gt; '2008-12-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_b, $cat_c ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-and-b', 'post_date' =&gt; '2009-01-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_b ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-b-and-c', 'post_date' =&gt; '2009-02-01 00:00:00', 'post_category' =&gt; array( $cat_b, $cat_c ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-and-c', 'post_date' =&gt; '2009-03-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_c ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-a', 'post_date' =&gt; '2009-04-01 00:00:00', 'post_category' =&gt; array( $cat_a ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-b', 'post_date' =&gt; '2009-05-01 00:00:00', 'post_category' =&gt; array( $cat_b ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-c', 'post_date' =&gt; '2009-06-01 00:00:00', 'post_category' =&gt; array( $cat_c ) ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'lorem-ipsum', 'post_date' =&gt; '2009-07-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'comment-test', 'post_date' =&gt; '2009-08-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'one-trackback', 'post_date' =&gt; '2009-09-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'many-trackbacks', 'post_date' =&gt; '2009-10-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'no-comments', 'post_date' =&gt; '2009-10-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'one-comment', 'post_date' =&gt; '2009-11-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'contributor-post-approved', 'post_date' =&gt; '2009-12-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'embedded-video', 'post_date' =&gt; '2010-01-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'simple-markup-test', 'post_date' =&gt; '2010-02-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'raw-html-code', 'post_date' =&gt; '2010-03-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-b-c', 'tags_input' =&gt; array( 'tag-a', 'tag-b', 'tag-c' ), 'post_date' =&gt; '2010-04-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-a', 'tags_input' =&gt; array( 'tag-a' ), 'post_date' =&gt; '2010-05-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-b', 'tags_input' =&gt; array( 'tag-b' ), 'post_date' =&gt; '2010-06-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-c', 'tags_input' =&gt; array( 'tag-c' ), 'post_date' =&gt; '2010-07-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-and-b', 'tags_input' =&gt; array( 'tag-a', 'tag-b' ), 'post_date' =&gt; '2010-08-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-b-and-c', 'tags_input' =&gt; array( 'tag-b', 'tag-c' ), 'post_date' =&gt; '2010-09-01 00:00:00' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-and-c', 'tags_input' =&gt; array( 'tag-a', 'tag-c' ), 'post_date' =&gt; '2010-10-01 00:00:00' ) );
+
+                unset( $this-&gt;q );
+                $this-&gt;q = new WP_Query();
+        }
+
+        function test_query_default() {
+                $posts = $this-&gt;q-&gt;query('');
+
+                // the output should be the most recent 10 posts as listed here
+                $expected = array(
+                        0 =&gt; 'tags-a-and-c',
+                        1 =&gt; 'tags-b-and-c',
+                        2 =&gt; 'tags-a-and-b',
+                        3 =&gt; 'tag-c',
+                        4 =&gt; 'tag-b',
+                        5 =&gt; 'tag-a',
+                        6 =&gt; 'tags-a-b-c',
+                        7 =&gt; 'raw-html-code',
+                        8 =&gt; 'simple-markup-test',
+                        9 =&gt; 'embedded-video',
+                );
+
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_tag_a() {
+                $posts = $this-&gt;q-&gt;query('tag=tag-a');
+
+                // there are 4 posts with Tag A
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-a', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
+        }
+
+        function test_query_tag_b() {
+                $posts = $this-&gt;q-&gt;query('tag=tag-b');
+
+                // there are 4 posts with Tag A
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertEquals( 'tags-b-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-b', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
+        }
+
+        function test_query_tag_id() {
+                $tag = tag_exists('tag-a');
+                $posts = $this-&gt;q-&gt;query(&quot;tag_id={$tag[term_id]}&quot;);
+
+                // there are 4 posts with Tag A
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-a', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
+        }
+
+        function test_query_tag_slug__in() {
+                $posts = $this-&gt;q-&gt;query(&quot;tag_slug__in[]=tag-b&amp;tag_slug__in[]=tag-c&quot;);
+
+                // there are 4 posts with either Tag B or Tag C
+                $this-&gt;assertCount( 6, $posts );
+                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-b-and-c', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-and-b', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-c', $posts[3]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-b', $posts[4]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-b-c', $posts[5]-&gt;post_name );
+        }
+
+
+        function test_query_tag__in() {
+                $tag_a = tag_exists('tag-a');
+                $tag_b = tag_exists('tag-b');
+                $posts = $this-&gt;q-&gt;query(&quot;tag__in[]={$tag_a[term_id]}&amp;tag__in[]={$tag_b[term_id]}&quot;);
+
+                // there are 6 posts with either Tag A or Tag B
+                $this-&gt;assertCount( 6, $posts );
+                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-b-and-c', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-and-b', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-b', $posts[3]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-a', $posts[4]-&gt;post_name );
+                $this-&gt;assertEquals( 'tags-a-b-c', $posts[5]-&gt;post_name );
+        }
+
+        function test_query_tag__not_in() {
+                $tag_a = tag_exists('tag-a');
+                $posts = $this-&gt;q-&gt;query(&quot;tag__not_in[]={$tag_a[term_id]}&quot;);
+
+                // the most recent 10 posts with Tag A excluded
+                // (note the different between this and test_query_default)
+                $expected = array (
+                        0 =&gt; 'tags-b-and-c',
+                        1 =&gt; 'tag-c',
+                        2 =&gt; 'tag-b',
+                        3 =&gt; 'raw-html-code',
+                        4 =&gt; 'simple-markup-test',
+                        5 =&gt; 'embedded-video',
+                        6 =&gt; 'contributor-post-approved',
+                        7 =&gt; 'one-comment',
+                        8 =&gt; 'no-comments',
+                        9 =&gt; 'many-trackbacks',
+                );
+
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_tag__in_but__not_in() {
+                $tag_a = tag_exists('tag-a');
+                $tag_b = tag_exists('tag-b');
+                $posts = $this-&gt;q-&gt;query(&quot;tag__in[]={$tag_a[term_id]}&amp;tag__not_in[]={$tag_b[term_id]}&quot;);
+
+                // there are 4 posts with Tag A, only 2 when we exclude Tag B
+                $this-&gt;assertCount( 2, $posts );
+                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'tag-a', $posts[1]-&gt;post_name );
+        }
+
+
+
+        function test_query_category_name() {
+                $posts = $this-&gt;q-&gt;query('category_name=cat-a');
+
+                // there are 4 posts with Cat A, we'll check for them by name
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertEquals( 'cat-a', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-a-and-c', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-a-and-b', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-a-b-c', $posts[3]-&gt;post_name );
+        }
+
+        function test_query_cat() {
+                $cat = category_exists('cat-b');
+                $posts = $this-&gt;q-&gt;query(&quot;cat=$cat&quot;);
+
+                // there are 4 posts with Cat B
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertEquals( 'cat-b', $posts[0]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-b-and-c', $posts[1]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-a-and-b', $posts[2]-&gt;post_name );
+                $this-&gt;assertEquals( 'cats-a-b-c', $posts[3]-&gt;post_name );
+        }
+
+        function test_query_posts_per_page() {
+                $posts = $this-&gt;q-&gt;query('posts_per_page=5');
+
+                $expected = array (
+                        0 =&gt; 'tags-a-and-c',
+                        1 =&gt; 'tags-b-and-c',
+                        2 =&gt; 'tags-a-and-b',
+                        3 =&gt; 'tag-c',
+                        4 =&gt; 'tag-b',
+                );
+
+                $this-&gt;assertCount( 5, $posts );
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_offset() {
+                $posts = $this-&gt;q-&gt;query('offset=2');
+
+                $expected = array (
+                        0 =&gt; 'tags-a-and-b',
+                        1 =&gt; 'tag-c',
+                        2 =&gt; 'tag-b',
+                        3 =&gt; 'tag-a',
+                        4 =&gt; 'tags-a-b-c',
+                        5 =&gt; 'raw-html-code',
+                        6 =&gt; 'simple-markup-test',
+                        7 =&gt; 'embedded-video',
+                        8 =&gt; 'contributor-post-approved',
+                        9 =&gt; 'one-comment',
+                );
+
+                $this-&gt;assertCount( 10, $posts );
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_paged() {
+                $posts = $this-&gt;q-&gt;query('paged=2');
+
+                $expected = array (
+                        0 =&gt; 'contributor-post-approved',
+                        1 =&gt; 'one-comment',
+                        2 =&gt; 'no-comments',
+                        3 =&gt; 'many-trackbacks',
+                        4 =&gt; 'one-trackback',
+                        5 =&gt; 'comment-test',
+                        6 =&gt; 'lorem-ipsum',
+                        7 =&gt; 'cat-c',
+                        8 =&gt; 'cat-b',
+                        9 =&gt; 'cat-a',
+                );
+
+                $this-&gt;assertCount( 10, $posts );
+                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_paged_and_posts_per_page() {
+                $posts = $this-&gt;q-&gt;query('paged=4&amp;posts_per_page=4');
+
+                $expected = array (
+                        0 =&gt; 'no-comments',
+                        1 =&gt; 'many-trackbacks',
+                        2 =&gt; 'one-trackback',
+                        3 =&gt; 'comment-test',
+                );
+
+                $this-&gt;assertCount( 4, $posts );
+                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        /**
+         * @ticket 18897
+         */
+        function test_query_offset_and_paged() {
+                $posts = $this-&gt;q-&gt;query('paged=2&amp;offset=3');
+
+                $expected = array (
+                        0 =&gt; 'many-trackbacks',
+                        1 =&gt; 'one-trackback',
+                        2 =&gt; 'comment-test',
+                        3 =&gt; 'lorem-ipsum',
+                        4 =&gt; 'cat-c',
+                        5 =&gt; 'cat-b',
+                        6 =&gt; 'cat-a',
+                        7 =&gt; 'cats-a-and-c',
+                        8 =&gt; 'cats-b-and-c',
+                        9 =&gt; 'cats-a-and-b',
+                );
+
+                $this-&gt;assertCount( 10, $posts );
+                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
+                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsqueryphpfromrev903trunkteststest_queryphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/query.php (from rev 903, trunk/tests/test_query.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/query.php                                (rev 0)
+++ trunk/tests/query.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,632 @@
</span><ins>+&lt;?php
+
+/**
+ * Test the is_*() functions in query.php across the URL structure
+ *
+ * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
+ * then we test the effects of each url on the wp_query object.
+ *
+ * @group query
+ * @group rewrite
+ */
+class Tests_Query extends WP_UnitTestCase {
+
+        protected $page_ids;
+        protected $post_ids;
+
+        function setUp() {
+                parent::setUp();
+
+                update_option( 'comments_per_page', 5 );
+                update_option( 'posts_per_page', 5 );
+
+                global $wp_rewrite;
+                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
+                create_initial_taxonomies();
+                $GLOBALS['wp_rewrite']-&gt;init();
+                flush_rewrite_rules();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $GLOBALS['wp_rewrite']-&gt;init();
+        }
+
+        /**
+         * Check each of the WP_Query is_* functions/properties against expected boolean value.
+         *
+         * Any properties that are listed by name as parameters will be expected to be true; any others are
+         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
+         * and is_feed() must be true and everything else must be false to pass.
+         *
+         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
+         */
+        function assertQueryTrue(/* ... */) {
+                global $wp_query;
+                $all = array(
+                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
+                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
+                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
+                        'is_posts_page', 'is_post_type_archive',
+                );
+                $true = func_get_args();
+
+                $passed = true;
+                $not_false = $not_true = array(); // properties that were not set to expected values
+
+                foreach ( $all as $query_thing ) {
+                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query-&gt;$query_thing;
+
+                        if ( in_array( $query_thing, $true ) ) {
+                                if ( ! $result ) {
+                                        array_push( $not_true, $query_thing );
+                                        $passed = false;
+                                }
+                        } else if ( $result ) {
+                                array_push( $not_false, $query_thing );
+                                $passed = false;
+                        }
+                }
+
+                $message = '';
+                if ( count($not_true) )
+                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
+                if ( count($not_false) )
+                        $message .= implode( $not_false, ', ' ) . ' should be false.';
+                $this-&gt;assertTrue( $passed, $message );
+        }
+
+        function test_home() {
+                $this-&gt;go_to('/');
+                $this-&gt;assertQueryTrue('is_home');
+        }
+
+        function test_404() {
+                $this-&gt;go_to('/'.rand_str());
+                $this-&gt;assertQueryTrue('is_404');
+        }
+
+        function test_permalink() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertQueryTrue('is_single', 'is_singular');
+        }
+
+        function test_post_comments_feed() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+
+        function test_post_comments_feed_with_no_comments() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+        function test_page() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about' ) );
+                $this-&gt;go_to( get_permalink( $page_id ) );
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_parent_page() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $this-&gt;go_to( get_permalink( $page_id ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_1() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $this-&gt;go_to( get_permalink( $page_id ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_2() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                $this-&gt;go_to( get_permalink( $page_id ) );
+
+                $this-&gt;assertQueryTrue('is_page','is_singular');
+        }
+
+        // '(about)/trackback/?$' =&gt; 'index.php?pagename=$matches[1]&amp;tb=1'
+        function test_page_trackback() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}trackback/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page','is_singular','is_trackback');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
+        function test_page_feed() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        function test_page_feed_with_no_comments() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
+        function test_page_feed_atom() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
+                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
+
+                        $url = get_permalink( $page_id );
+                        $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
+
+                        // make sure the correct wp_query flags are set
+                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+                }
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
+        function test_page_page_2() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
+                $this-&gt;go_to(&quot;/about/page/2/&quot;);
+
+                // make sure the correct wp_query flags are set
+                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
+        function test_page_page_2_no_slash() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
+                $this-&gt;go_to(&quot;/about/page2/&quot;);
+
+                // make sure the correct wp_query flags are set
+                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+        }
+
+        // FIXME: what is this for?
+        // '(about)(/[0-9]+)?/?$' =&gt; 'index.php?pagename=$matches[1]&amp;page=$matches[2]'
+        function test_pagination_of_posts_page() {
+                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
+                update_option( 'show_on_front', 'page' );
+                update_option( 'page_for_posts', $page_id );
+
+                $this-&gt;go_to('/about/2/');
+
+                $this-&gt;assertQueryTrue( 'is_home', 'is_posts_page' );
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
+        }
+
+        // FIXME: no tests for these yet
+        // 'about/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        // 'about/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+
+        // 'feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
+        // '(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
+        function test_main_feed_2() {
+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
+                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+
+                // long version
+                foreach ($feeds as $feed) {
+                        $this-&gt;go_to(&quot;/feed/{$feed}/&quot;);
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+
+                // short version
+                foreach ($feeds as $feed) {
+                        $this-&gt;go_to(&quot;/{$feed}/&quot;);
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+
+        }
+
+        function test_main_feed() {
+                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
+                $types = array('rss2', 'rss', 'atom');
+                foreach ($types as $type) {
+                        $this-&gt;go_to(get_feed_link($type));
+                        $this-&gt;assertQueryTrue('is_feed');
+                }
+        }
+
+        // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
+        function test_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 15 );
+                for ( $i = 2; $i &lt;= 3; $i++ ) {
+                        $this-&gt;go_to(&quot;/page/{$i}/&quot;);
+                        $this-&gt;assertQueryTrue('is_home', 'is_paged');
+                }
+        }
+
+        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
+        // 'comments/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
+        function test_main_comments_feed() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
+                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
+
+                // check the url as generated by get_post_comments_feed_link()
+                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
+                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/comments/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/comments/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+        }
+
+        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
+        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
+        function test_search_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/search/test/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/search/test/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
+                }
+        }
+
+        // 'search/(.+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?s=$matches[1]&amp;paged=$matches[2]',
+        function test_search_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_title' =&gt; 'test' ) );
+                $this-&gt;go_to('/search/test/page/2/');
+                $this-&gt;assertQueryTrue('is_search', 'is_paged');
+        }
+
+        // 'search/(.+)/?$' =&gt; 'index.php?s=$matches[1]',
+        function test_search() {
+                $this-&gt;go_to('/search/test/');
+                $this-&gt;assertQueryTrue('is_search');
+        }
+
+        /**
+         * @ticket 13961
+         */
+        function test_search_encoded_chars() {
+                $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
+                $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
+        }
+
+        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
+        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
+        function test_category_feed() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/category/cat-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/category/cat-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+        }
+
+        // 'category/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?category_name=$matches[1]&amp;paged=$matches[2]',
+        function test_category_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10 );
+                $this-&gt;go_to('/category/uncategorized/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_category', 'is_paged');
+        }
+
+        // 'category/(.+?)/?$' =&gt; 'index.php?category_name=$matches[1]',
+        function test_category() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
+                $this-&gt;go_to('/category/cat-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_category');
+        }
+
+        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
+        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
+        function test_tag_feed() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/tag/tag-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/tag/tag-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+        }
+
+        // 'tag/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?tag=$matches[1]&amp;paged=$matches[2]',
+        function test_tag_paged() {
+                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( 10 );
+                foreach ( $post_ids as $post_id )
+                        $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, 'tag-a', 'post_tag' );
+                $this-&gt;go_to('/tag/tag-a/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_tag', 'is_paged');
+        }
+
+        // 'tag/(.+?)/?$' =&gt; 'index.php?tag=$matches[1]',
+        function test_tag() {
+                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
+                $this-&gt;go_to('/tag/tag-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_tag');
+        }
+
+        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
+        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
+        function test_author_feed() {
+                $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/author/user-a/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/author/user-a/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+        }
+
+        // 'author/([^/]+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?author_name=$matches[1]&amp;paged=$matches[2]',
+        function test_author_paged() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_author' =&gt; $user_id ) );
+                $this-&gt;go_to('/author/user-a/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author', 'is_paged');
+        }
+
+        // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
+        function test_author() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
+                $this-&gt;go_to('/author/user-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author');
+        }
+
+        function test_author_with_no_posts() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
+                $this-&gt;go_to('/author/user-a/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_author');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;feed=$matches[4]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;feed=$matches[4]',
+        function test_ymd_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/04/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/04/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;paged=$matches[4]',
+        function test_ymd_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/04/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]',
+        function test_ymd() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/04/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
+        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
+        function test_ym_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/09/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;paged=$matches[3]',
+        function test_ym_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]',
+        function test_ym() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/09/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
+        }
+
+        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
+        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
+        function test_y_feed() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;/2007/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;paged=$matches[2]',
+        function test_y_paged() {
+                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/page/2/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
+        }
+
+        // '([0-9]{4})/?$' =&gt; 'index.php?year=$matches[1]',
+        function test_y() {
+                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
+                $this-&gt;go_to('/2007/');
+                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;tb=1',
+        function test_post_trackback() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $permalink = get_permalink( $post_id );
+                $this-&gt;go_to(&quot;{$permalink}trackback/&quot;);
+                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_trackback');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
+        function test_post_comment_feed() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+                $permalink = get_permalink( $post_id );
+
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;{$permalink}feed/{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this-&gt;go_to(&quot;{$permalink}{$type}&quot;);
+                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;page=$matches[5]',
+        function test_post_paged_short() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array(
+                        'post_date' =&gt; '2007-09-04 00:00:00',
+                        'post_title' =&gt; 'a-post-with-multiple-pages',
+                        'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2'
+                ) );
+                $this-&gt;go_to( get_permalink( $post_id ) . '2/' );
+                // should is_paged be true also?
+                $this-&gt;assertQueryTrue('is_single', 'is_singular');
+
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        function test_post_attachment() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'attachment' ) );
+                $permalink = get_attachment_link( $post_id );
+                $this-&gt;go_to($permalink);
+                $this-&gt;assertQueryTrue('is_single', 'is_attachment', 'is_singular');
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
+}
</ins></span></pre></div>
<a id="trunktestsshortcodephpfromrev903trunkteststest_shortcodephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/shortcode.php (from rev 903, trunk/tests/test_shortcode.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/shortcode.php                                (rev 0)
+++ trunk/tests/shortcode.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,294 @@
</span><ins>+&lt;?php
+/**
+ * @group shortcode
+ */
+class Tests_Shortcode extends WP_UnitTestCase {
+
+        protected $shortcodes = array( 'footag', 'bartag', 'baztag', 'dumptag' );
+
+        function setUp() {
+                parent::setUp();
+                add_shortcode('test-shortcode-tag', array(&amp;$this, '_shortcode_tag'));
+
+                foreach ( $this-&gt;shortcodes as $shortcode )
+                        add_shortcode( $shortcode, array( $this, '_shortcode_' . $shortcode ) );
+
+                $this-&gt;atts = null;
+                $this-&gt;content = null;
+                $this-&gt;tagname = null;
+
+        }
+
+        function tearDown() {
+                global $shortcode_tags;
+                parent::tearDown();
+                foreach ( $this-&gt;shortcodes as $shortcode )
+                        unset( $shortcode_tags[ $shortcode ] );
+                unset( $shortcode_tags['test-shortcode-tag'] );
+        }
+
+        // [footag foo=&quot;bar&quot;]
+        function _shortcode_footag( $atts ) {
+                return @&quot;foo = {$atts['foo']}&quot;;
+        }
+
+        // [bartag foo=&quot;bar&quot;]
+        function _shortcode_bartag( $atts ) {
+                extract(shortcode_atts(array(
+                        'foo' =&gt; 'no foo',
+                        'baz' =&gt; 'default baz',
+                ), $atts));
+
+                return &quot;foo = {$foo}&quot;;
+        }
+
+        // [baztag]content[/baztag]
+        function _shortcode_baztag( $atts, $content = '' ) {
+                return 'content = '.do_shortcode($content);
+        }
+
+        function _shortcode_dumptag( $atts ) {
+                $out = '';
+                foreach ($atts as $k=&gt;$v)
+                        $out .= &quot;$k = $v\n&quot;;
+                return $out;
+        }
+
+        function _shortcode_tag($atts, $content=NULL, $tagname=NULL) {
+                $this-&gt;atts = $atts;
+                $this-&gt;content = $content;
+                $this-&gt;tagname = $tagname;
+        }
+
+        function test_noatts() {
+                do_shortcode('[test-shortcode-tag /]');
+                $this-&gt;assertEquals( '', $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_one_att() {
+                do_shortcode('[test-shortcode-tag foo=&quot;asdf&quot; /]');
+                $this-&gt;assertEquals( array('foo' =&gt; 'asdf'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_not_a_tag() {
+                $out = do_shortcode('[not-a-shortcode-tag]');
+                $this-&gt;assertEquals( '[not-a-shortcode-tag]', $out );
+        }
+
+        function test_two_atts() {
+                do_shortcode('[test-shortcode-tag foo=&quot;asdf&quot; bar=&quot;bing&quot; /]');
+                $this-&gt;assertEquals( array('foo' =&gt; 'asdf', 'bar' =&gt; 'bing'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_noatts_enclosing() {
+                do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]');
+                $this-&gt;assertEquals( '', $this-&gt;atts );
+                $this-&gt;assertEquals( 'content', $this-&gt;content );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_one_att_enclosing() {
+                do_shortcode('[test-shortcode-tag foo=&quot;bar&quot;]content[/test-shortcode-tag]');
+                $this-&gt;assertEquals( array('foo' =&gt; 'bar'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'content', $this-&gt;content );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_two_atts_enclosing() {
+                do_shortcode('[test-shortcode-tag foo=&quot;bar&quot; baz=&quot;bing&quot;]content[/test-shortcode-tag]');
+                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'baz' =&gt; 'bing'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'content', $this-&gt;content );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_unclosed() {
+                $out = do_shortcode('[test-shortcode-tag]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( '', $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_positional_atts_num() {
+                $out = do_shortcode('[test-shortcode-tag 123]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( array(0=&gt;'123'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_positional_atts_url() {
+                $out = do_shortcode('[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( array(0=&gt;'http://www.youtube.com/watch?v=eBGIQ7ZuuiU'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_positional_atts_quotes() {
+                $out = do_shortcode('[test-shortcode-tag &quot;something in quotes&quot; &quot;something else&quot;]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( array(0=&gt;'something in quotes', 1=&gt;'something else'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_positional_atts_mixed() {
+                $out = do_shortcode('[test-shortcode-tag 123 http://wordpress.com/ 0 &quot;foo&quot; bar]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( array(0=&gt;'123', 1=&gt;'http://wordpress.com/', 2=&gt;'0', 3=&gt;'foo', 4=&gt;'bar'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_positional_and_named_atts() {
+                $out = do_shortcode('[test-shortcode-tag 123 url=http://wordpress.com/ foo bar=&quot;baz&quot;]');
+                $this-&gt;assertEquals( '', $out );
+                $this-&gt;assertEquals( array(0=&gt;'123', 'url' =&gt; 'http://wordpress.com/', 1=&gt;'foo', 'bar' =&gt; 'baz'), $this-&gt;atts );
+                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
+        }
+
+        function test_footag_default() {
+                $out = do_shortcode('[footag]');
+                $this-&gt;assertEquals('foo = ', $out);
+        }
+
+        function test_footag_val() {
+                $val = rand_str();
+                $out = do_shortcode('[footag foo=&quot;'.$val.'&quot;]');
+                $this-&gt;assertEquals('foo = '.$val, $out);
+        }
+
+        function test_nested_tags() {
+                $out = do_shortcode('[baztag][dumptag abc=&quot;foo&quot; def=123 http://wordpress.com/][/baztag]');
+                $expected = &quot;content = abc = foo\ndef = 123\n0 = http://wordpress.com\n&quot;;
+                $this-&gt;assertEquals($expected, $out);
+        }
+
+        /**
+         * @ticket 6518
+         */
+        function test_tag_escaped() {
+                $out = do_shortcode('[[footag]] [[bartag foo=&quot;bar&quot;]]');
+                $this-&gt;assertEquals('[footag] [bartag foo=&quot;bar&quot;]', $out);
+
+                $out = do_shortcode('[[footag /]] [[bartag foo=&quot;bar&quot; /]]');
+                $this-&gt;assertEquals('[footag /] [bartag foo=&quot;bar&quot; /]', $out);
+
+                $out = do_shortcode('[[baztag foo=&quot;bar&quot;]the content[/baztag]]');
+                $this-&gt;assertEquals('[baztag foo=&quot;bar&quot;]the content[/baztag]', $out);
+
+                // double escaped
+                $out = do_shortcode('[[[footag]]] [[[bartag foo=&quot;bar&quot;]]]');
+                $this-&gt;assertEquals('[[footag]] [[bartag foo=&quot;bar&quot;]]', $out);
+        }
+
+        function test_tag_not_escaped() {
+                // these have square brackets on either end but aren't actually escaped
+                $out = do_shortcode('[[footag] [bartag foo=&quot;bar&quot;]]');
+                $this-&gt;assertEquals('[foo =  foo = bar]', $out);
+
+                $out = do_shortcode('[[footag /] [bartag foo=&quot;bar&quot; /]]');
+                $this-&gt;assertEquals('[foo =  foo = bar]', $out);
+
+                $out = do_shortcode('[[baztag foo=&quot;bar&quot;]the content[/baztag]');
+                $this-&gt;assertEquals('[content = the content', $out);
+
+                $out = do_shortcode('[[not-a-tag]]');
+                $this-&gt;assertEquals('[[not-a-tag]]', $out);
+
+                $out = do_shortcode('[[[footag] [bartag foo=&quot;bar&quot;]]]');
+                $this-&gt;assertEquals('[[foo =  foo = bar]]', $out);
+        }
+
+        function test_mixed_tags() {
+                $in = &lt;&lt;&lt;EOF
+So this is a post with [footag foo=&quot;some stuff&quot;] and a bunch of tags.
+
+[bartag]
+
+[baztag]
+Here's some content
+on more than one line
+[/baztag]
+
+[bartag foo=1] [baztag] [footag foo=&quot;2&quot;] [baztag]
+
+[baztag]
+more content
+[/baztag]
+
+EOF;
+                $expected = &lt;&lt;&lt;EOF
+So this is a post with foo = some stuff and a bunch of tags.
+
+foo = no foo
+
+content =
+Here's some content
+on more than one line
+
+
+foo = 1 content =  foo = 2 content =
+content =
+more content
+
+EOF;
+                $out = do_shortcode($in);
+                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
+        }
+
+        /**
+         * @ticket 6562
+         *
+         * @TODO Review this test as it may be incorrect
+         */
+        function test_utf8_whitespace_1() {
+                do_shortcode(&quot;[test-shortcode-tag foo=\&quot;bar\&quot; \x00\xA0baz=\&quot;123\&quot;]&quot;);
+                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'baz' =&gt; '123'), $this-&gt;atts );
+                $this-&gt;assertEquals( '', $this-&gt;content );
+        }
+
+        /**
+         * @ticket 6562
+         *
+         * @TODO Review this test as it may be incorrect
+         */
+        function test_utf8_whitespace_2() {
+                do_shortcode(&quot;[test-shortcode-tag foo=\&quot;bar\&quot; \x20\x0babc=\&quot;def\&quot;]&quot;);
+                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'abc' =&gt; 'def'), $this-&gt;atts );
+                $this-&gt;assertEquals( '', $this-&gt;content );
+        }
+
+        function test_shortcode_unautop() {
+                // a blank line is added at the end, so test with it already there
+                $test_string = &lt;&lt;&lt;EOF
+[footag]
+
+EOF;
+
+                $this-&gt;assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
+        }
+
+        /**
+         * @ticket 14050
+         */
+        function test_multiple_shortcode_unautop() {
+                // a blank line is added at the end, so test with it already there
+                $test_string = &lt;&lt;&lt;EOF
+[footag]
+[footag]
+
+EOF;
+
+                $actual = shortcode_unautop( wpautop( $test_string ) );
+                $this-&gt;assertEquals( $test_string, $actual );
+        }
+
+        /**
+         * @ticket 10326
+         */
+        function test_strip_shortcodes() {
+                $this-&gt;assertEquals('before', strip_shortcodes('before[gallery]'));
+                $this-&gt;assertEquals('after', strip_shortcodes('[gallery]after'));
+                $this-&gt;assertEquals('beforeafter', strip_shortcodes('before[gallery]after'));
+        }
+}
</ins></span></pre></div>
<a id="trunkteststestxmlrpcapitest_mt_getRecentPostTitlesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_mt_getRecentPostTitles.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_mt_getRecentPostTitles.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_mt_getRecentPostTitles.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,51 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_no_posts() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-        }
-
-        function test_no_editable_posts() {
-                $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 ) );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 0, count( $result ) );
-        }
-
-        function test_date() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $this-&gt;factory-&gt;post-&gt;create();
-
-                $results = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $post = get_post( $result['postid'] );
-                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
-
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-
-                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['dateCreated']-&gt;getTimestamp() );
-                        $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
-                }
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_mw_editPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_mw_editPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_mw_editPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_mw_editPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,199 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_editPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $post = array();
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( 1, 'username', 'password', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_edit_own_post() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
-        }
-
-        function test_capable_edit_others_post() {
-                $this-&gt;make_user_by_role( 'editor' );
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
-        }
-
-        function test_incapable_edit_others_post() {
-                $this-&gt;make_user_by_role( 'contributor' );
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $original_title = 'Post test';
-                $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $original_title, $out-&gt;post_title );
-        }
-
-        function test_capable_reassign_author() {
-                $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' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'wp_author_id' =&gt; $author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $author_id, $out-&gt;post_author );
-        }
-
-        function test_incapable_reassign_author() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'wp_author_id' =&gt; $author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $contributor_id, $out-&gt;post_author );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
-
-                // add post thumbnail to post that does not have one
-                $post2 = array( 'wp_post_thumbnail' =&gt; $attachment_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // edit the post without supplying a post_thumbnail and check that it didn't change
-                $post3 = array( 'post_content' =&gt; 'Updated post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create another attachment
-                $attachment2 = array_merge( $attachment, array( 'title' =&gt; 'Post Thumbnail 2' ) );
-                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
-
-                // change the post's post_thumbnail
-                $post4 = array( 'wp_post_thumbnail' =&gt; $attachment2_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // unset the post's post_thumbnail
-                $post5 = array( 'wp_post_thumbnail' =&gt; '' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array($post_id, 'author', 'author', $post5 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_edit_basic_post_info() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Title', 'post_content' =&gt; 'Content', 'post_excerpt' =&gt; 'Excerpt', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'title' =&gt; 'New Title', 'post_author' =&gt; $contributor_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
-
-                $post3 = array( 'description' =&gt; 'New Content', 'post_author' =&gt; $contributor_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
-                $this-&gt;assertEquals( $post3['description'], $out-&gt;post_content );
-
-                $post4 = array( 'mt_excerpt' =&gt; 'New Excerpt', 'post_author' =&gt; $contributor_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
-                $this-&gt;assertEquals( $post3['description'], $out-&gt;post_content );
-                $this-&gt;assertEquals( $post4['mt_excerpt'], $out-&gt;post_excerpt );
-        }
-
-        // Not allowed since [19914]
-        function test_change_post_type() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Title', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_type' =&gt; 'page' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $result-&gt;code, 401 );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_mw_getPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_mw_getPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_mw_getPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_mw_getPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,142 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_getPost extends WP_XMLRPC_UnitTestCase {
-        var $post_data;
-        var $post_id;
-        var $post_date_ts;
-
-        function setUp() {
-                parent::setUp();
-
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-                $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; $author_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 test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'subscriber', 'subscriber' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        /**
-         * @ticket 20336
-         */
-        function test_invalid_postid() {
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( 9999, 'author', 'author' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this-&gt;assertInternalType( 'string', $result['userid'] );
-                $this-&gt;assertInternalType( 'int', $result['postid'] );
-                $this-&gt;assertInternalType( 'string', $result['description'] );
-                $this-&gt;assertInternalType( 'string', $result['title'] );
-                $this-&gt;assertInternalType( 'string', $result['link'] );
-                $this-&gt;assertInternalType( 'string', $result['permaLink'] );
-                $this-&gt;assertInternalType( 'array',  $result['categories'] );
-                $this-&gt;assertInternalType( 'string', $result['mt_excerpt'] );
-                $this-&gt;assertInternalType( 'string', $result['mt_text_more'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_more_text'] );
-                $this-&gt;assertInternalType( 'int', $result['mt_allow_comments'] );
-                $this-&gt;assertInternalType( 'int', $result['mt_allow_pings'] );
-                $this-&gt;assertInternalType( 'string', $result['mt_keywords'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_password'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
-                $this-&gt;assertInternalType( 'string', $result['post_status'] );
-                $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_post_format'] );
-                $this-&gt;assertInternalType( 'bool',   $result['sticky'] );
-
-
-                // Check expected values
-                $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['title'] );
-                $this-&gt;assertEquals( 'draft', $result['post_status'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['mt_excerpt'] );
-                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
-
-                $this-&gt;assertEquals( '', $result['wp_post_thumbnail'] );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this-&gt;post_id );
-
-                set_post_thumbnail( $this-&gt;post_id, $attachment_id );
-
-                $fields = array( 'post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertInternalType( 'string', $result['wp_post_thumbnail'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
-                $this-&gt;assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_date() {
-                $fields = array( 'post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
-
-                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['dateCreated']-&gt;getTimestamp() );
-                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['date_modified']-&gt;getTimestamp() );
-
-                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-                $post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this-&gt;assertEquals( $post_date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
-                $this-&gt;assertEquals( $post_modified_gmt, $result['date_modified_gmt']-&gt;getTimestamp() );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_mw_getRecentPostsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_mw_getRecentPosts.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_mw_getRecentPosts.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_mw_getRecentPosts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,144 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_getRecentPosts extends WP_XMLRPC_UnitTestCase {
-        var $post_data;
-        var $post_id;
-        var $post_date_ts;
-
-        function setUp() {
-                parent::setUp();
-
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-                $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; $author_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 test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_no_editable_posts() {
-                wp_delete_post( $this-&gt;post_id );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 0, count( $result ) );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post' );
-                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $post = get_post( $result['postid'] );
-
-                        // Check data types
-                        $this-&gt;assertInternalType( 'string', $result['userid'] );
-                        $this-&gt;assertInternalType( 'string', $result['postid'] );
-                        $this-&gt;assertInternalType( 'string', $result['description'] );
-                        $this-&gt;assertInternalType( 'string', $result['title'] );
-                        $this-&gt;assertInternalType( 'string', $result['link'] );
-                        $this-&gt;assertInternalType( 'string', $result['permaLink'] );
-                        $this-&gt;assertInternalType( 'array',  $result['categories'] );
-                        $this-&gt;assertInternalType( 'string', $result['mt_excerpt'] );
-                        $this-&gt;assertInternalType( 'string', $result['mt_text_more'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_more_text'] );
-                        $this-&gt;assertInternalType( 'int', $result['mt_allow_comments'] );
-                        $this-&gt;assertInternalType( 'int', $result['mt_allow_pings'] );
-                        $this-&gt;assertInternalType( 'string', $result['mt_keywords'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_password'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
-                        $this-&gt;assertInternalType( 'string', $result['post_status'] );
-                        $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
-                        $this-&gt;assertInternalType( 'string', $result['wp_post_format'] );
-
-                        // Check expected values
-                        $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
-                        $this-&gt;assertStringMatchesFormat( '%d', $result['postid'] );
-                        $this-&gt;assertEquals( $post-&gt;post_title, $result['title'] );
-                        $this-&gt;assertEquals( 'draft', $result['post_status'] );
-                        $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-                        $this-&gt;assertEquals( $post-&gt;post_excerpt, $result['mt_excerpt'] );
-                        $this-&gt;assertEquals( url_to_postid( $result['link'] ), $post-&gt;ID );
-
-                        $this-&gt;assertEquals( '', $result['wp_post_thumbnail'] );
-                }
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this-&gt;post_id );
-                set_post_thumbnail( $this-&gt;post_id, $attachment_id );
-
-                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( $this-&gt;post_id, 'author', 'author' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $this-&gt;assertInternalType( 'string', $result['wp_post_thumbnail'] );
-                        $this-&gt;assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
-
-                        if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this-&gt;post_id ) {
-                                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
-
-                                $this-&gt;assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
-                        }
-                }
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_date() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $post = get_post( $result['postid'] );
-                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
-                        $date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_modified, false ), 'Ymd\TH:i:s' ) );
-
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified'] );
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
-
-                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['dateCreated']-&gt;getTimestamp() );
-                        $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
-                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['date_modified']-&gt;getTimestamp() );
-                        $this-&gt;assertEquals( $date_modified_gmt, $result['date_modified_gmt']-&gt;getTimestamp() );
-                }
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_mw_newPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_mw_newPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_mw_newPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_mw_newPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,162 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_newPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $post = array();
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'username', 'password', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $post = array();
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_no_content() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array();
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( 'Content, title, and excerpt are empty.', $result-&gt;message );
-        }
-
-        function test_basic_content() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_ignore_id() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test', 'ID' =&gt; 103948 );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertNotEquals( '103948', $result );
-        }
-
-        function test_capable_publish() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_publish() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_other_author() {
-                $this-&gt;make_user_by_role( 'editor' );
-                $other_author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_other_author() {
-                $this-&gt;make_user_by_role( 'contributor' );
-                $other_author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        /**
-         * @ticket 20356
-         */
-        function test_invalid_author() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; 99999999 );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-
-        function test_empty_author() {
-                $my_author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this-&gt;assertEquals( $my_author_id, $out-&gt;post_author );
-                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $this-&gt;make_user_by_role( 'author' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
-
-                $post = array( 'title' =&gt; 'Post Thumbnail Test', 'wp_post_thumbnail' =&gt; $attachment_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_incapable_set_post_type_as_page() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_set_post_type_as_page() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
-                $this-&gt;assertEquals( 'page', $out-&gt;post_type );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_deletePostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_deletePost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_deletePost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_deletePost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_deletePost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'username', 'password', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_invalid_post() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_post_deleted() {
-                $this-&gt;make_user_by_role( 'editor' );
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue( $result );
-
-                $post = get_post( $post_id );
-                $this-&gt;assertEquals( 'trash', $post-&gt;post_status );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_deleteTermphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_deleteTerm.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_deleteTerm.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_deleteTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-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 );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_editPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_editPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_editPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_editPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,224 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_editPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'username', 'password', 0, array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_edit_own_post() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
-        }
-
-        function test_capable_edit_others_post() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
-        }
-
-        function test_incapable_edit_others_post() {
-                $this-&gt;make_user_by_role( 'contributor' );
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $original_title = 'Post test';
-                $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' =&gt; $new_title );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $original_title, $out-&gt;post_title );
-        }
-
-        function test_capable_reassign_author() {
-                $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' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_author' =&gt; $author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $author_id, $out-&gt;post_author );
-        }
-
-        function test_incapable_reassign_author() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_author' =&gt; $author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $contributor_id, $out-&gt;post_author );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
-
-                // add post thumbnail to post that does not have one
-                $post2 = array( 'post_thumbnail' =&gt; $attachment_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // fetch the post to verify that it appears
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $post_id ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertArrayHasKey( 'post_thumbnail', $result );
-                $this-&gt;assertInternalType( 'array', $result['post_thumbnail'] );
-                $this-&gt;assertEquals( $attachment_id, $result['post_thumbnail']['attachment_id'] );
-
-                // edit the post without supplying a post_thumbnail and check that it didn't change
-                $post3 = array( 'post_content' =&gt; 'Updated post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create another attachment
-                $attachment2 = array_merge( $attachment, array( 'post_title' =&gt; 'Post Thumbnail 2' ) );
-                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
-
-                // change the post's post_thumbnail
-                $post4 = array( 'post_thumbnail' =&gt; $attachment2_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // unset the post's post_thumbnail
-                $post5 = array( 'post_thumbnail' =&gt; '' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // use invalid ID
-                $post6 = array( 'post_thumbnail' =&gt; 398420983409 );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_edit_custom_fields() {
-                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
-                $post_id = wp_insert_post( $post );
-                $mid_edit   = add_post_meta( $post_id, 'custom_field_key', '12345678' );
-                $mid_delete = add_post_meta( $post_id, 'custom_field_to_delete', '12345678' );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array(
-                        'post_title' =&gt; $new_title,
-                        'custom_fields' =&gt;
-                                array(
-                                        array( 'id' =&gt; $mid_delete ),
-                                        array( 'id' =&gt; $mid_edit, 'key' =&gt; 'custom_field_key', 'value' =&gt; '87654321' ),
-                                        array( 'key' =&gt; 'custom_field_to_create', 'value' =&gt; '12345678' )
-                                )
-                );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
-
-                $edited_object = get_metadata_by_mid( 'post', $mid_edit );
-                $this-&gt;assertEquals( '87654321', $edited_object-&gt;meta_value );
-                $this-&gt;assertFalse( get_metadata_by_mid( 'post', $mid_delete ) );
-
-                $created_object = get_post_meta( $post_id, 'custom_field_to_create', true );
-                $this-&gt;assertEquals( $created_object, '12345678' );
-        }
-
-        function test_capable_unsticky() {
-                $editor_id = $this-&gt;make_user_by_role( 'editor' );
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
-                stick_post( $post_id );
-
-                $post2 = array( 'sticky' =&gt; false );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertFalse( is_sticky( $post_id ) );
-        }
-
-        function test_password_transition_unsticky() {
-                // when transitioning to private status or adding a post password, post should be un-stuck
-                $editor_id = $this-&gt;make_user_by_role( 'editor' );
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
-                stick_post( $post_id );
-
-                $post2 = array( 'post_password' =&gt; 'foobar',  'sticky' =&gt; false );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertFalse( is_sticky( $post_id ) );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_editTermphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_editTerm.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_editTerm.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_editTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,133 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_editTerm extends WP_XMLRPC_UnitTestCase {
-        var $parent_term;
-        var $child_term;
-        var $post_tag;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;parent_term = wp_insert_term( 'parent' . rand_str() , 'category' );
-                $this-&gt;child_term = wp_insert_term( 'child' . rand_str() , 'category' );
-                $this-&gt;post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( 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( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' =&gt; '' ) ) );
-                $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_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; '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_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to edit terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-        function test_term_not_exists() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' =&gt; 'category' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-                $this-&gt;assertEquals(  __( 'Invalid term ID' ), $result-&gt;message );
-        }
-
-        function test_empty_term() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' =&gt; 'category' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
-        }
-
-        function test_empty_term_name() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'The term name cannot be empty.' ), $result-&gt;message );
-        }
-
-        function test_parent_for_nonhierarchical() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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'] ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( &quot;This taxonomy is not hierarchical so you can't set a parent.&quot; ), $result-&gt;message );
-        }
-
-        function test_parent_empty() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
-        }
-
-        function test_parent_invalid() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-        }
-
-        function test_parent_not_existing() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Parent term does not exist.' ), $result-&gt;message );
-        }
-
-        function test_parent_duplicate_slug() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $parent_term = get_term_by( 'id', $this-&gt;parent_term['term_id'], 'category' );
-                $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 ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( htmlspecialchars( sprintf( __('The slug &amp;#8220;%s&amp;#8221; is already in use by another term'), $parent_term-&gt;slug ) ), $result-&gt;message );
-        }
-
-        function test_edit_all_fields() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], $fields ) );
-
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertInternalType( 'boolean', $result );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getCommentphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getComment.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getComment.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,105 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getComment extends WP_XMLRPC_UnitTestCase {
-        var $post_id;
-        var $parent_comment_id;
-        var $parent_comment_data;
-        var $child_comment_id;
-        var $child_comment_data;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                $this-&gt;parent_comment_data = array(
-                        'comment_post_ID' =&gt; $this-&gt;post_id,
-                        'comment_author' =&gt; 'Test commenter',
-                        'comment_author_url' =&gt; 'http://example.com/',
-                        'comment_author_email' =&gt; 'example@example.com',
-                        'comment_content' =&gt; rand_str( 100 ),
-                );
-                $this-&gt;parent_comment_id = wp_insert_comment( $this-&gt;parent_comment_data );
-
-                $this-&gt;child_comment_data = array(
-                        'comment_post_ID' =&gt; $this-&gt;post_id,
-                        'comment_author' =&gt; 'Test commenter 2',
-                        'comment_author_url' =&gt; 'http://example.org/',
-                        'comment_author_email' =&gt; 'example@example.org',
-                        'comment_parent' =&gt; $this-&gt;parent_comment_id,
-                        'comment_content' =&gt; rand_str( 100 )
-                );
-                $this-&gt;child_comment_id = wp_insert_comment( $this-&gt;child_comment_data );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'username', 'password', $this-&gt;parent_comment_id ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'contributor', 'contributor', $this-&gt;parent_comment_id ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_valid_comment() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;parent_comment_id ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this-&gt;assertInternalType( 'string', $result['user_id'] );
-                $this-&gt;assertInternalType( 'string', $result['comment_id'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this-&gt;assertInternalType( 'string', $result['parent'] );
-                $this-&gt;assertInternalType( 'string', $result['status'] );
-                $this-&gt;assertInternalType( 'string', $result['content'] );
-                $this-&gt;assertInternalType( 'string', $result['link'] );
-                $this-&gt;assertInternalType( 'string', $result['post_id'] );
-                $this-&gt;assertInternalType( 'string', $result['post_title'] );
-                $this-&gt;assertInternalType( 'string', $result['author'] );
-                $this-&gt;assertInternalType( 'string', $result['author_url'] );
-                $this-&gt;assertInternalType( 'string', $result['author_email'] );
-                $this-&gt;assertInternalType( 'string', $result['author_ip'] );
-                $this-&gt;assertInternalType( 'string', $result['type'] );
-
-                // Check expected values
-                $this-&gt;assertStringMatchesFormat( '%d', $result['user_id'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['comment_id'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['parent'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['post_id'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_id, $result['comment_id'] );
-                $this-&gt;assertEquals( 0, $result['parent'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_content'], $result['content'] );
-                $this-&gt;assertEquals( $this-&gt;post_id, $result['post_id'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author'], $result['author'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author_url'], $result['author_url'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author_email'], $result['author_email'] );
-        }
-
-        function test_valid_child_comment() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;child_comment_id ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertEquals( $this-&gt;child_comment_id, $result['comment_id'] );
-                $this-&gt;assertEquals( $this-&gt;parent_comment_id, $result['parent'] );
-        }
-
-        function test_invalid_id() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getCommentsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getComments.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getComments.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getComments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,74 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getComments extends WP_XMLRPC_UnitTestCase {
-        var $post_id;
-
-        function setUp() {
-                parent::setUp();
-
-                $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 );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'username', 'password', array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_user() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', array() ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $comment = get_comment( $result['comment_id'], ARRAY_A );
-                        $this-&gt;assertEquals( $comment['comment_post_ID'], $result['post_id'] );
-                }
-        }
-
-        function test_post_filter() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $filter = array(
-                        'post_id' =&gt; $this-&gt;post_id
-                );
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $this-&gt;assertEquals( $this-&gt;post_id, $result['post_id'] );
-                }
-        }
-
-        function test_number_filter() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $filter = array(
-                        'post_id' =&gt; $this-&gt;post_id,
-                );
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                // if no 'number' filter is specified, default should be 10
-                $this-&gt;assertEquals( 10, count( $results ) );
-
-                // explicitly set a 'number' filter and verify that only that many are returned
-                $filter['number'] = 5;
-                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
-                $this-&gt;assertEquals( 5, count( $results2 ) );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getMediaItemphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getMediaItem.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getMediaItem.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getMediaItem.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getMediaItem extends WP_XMLRPC_UnitTestCase {
-        var $post_id;
-        var $attachment_data;
-        var $attachment_id;
-
-        function setUp() {
-                parent::setUp();
-
-                add_theme_support( 'post-thumbnails' );
-
-                $this-&gt;post_id = wp_insert_post( array(
-                        'post_title' =&gt; rand_str(),
-                        'post_content' =&gt; rand_str(),
-                        'post_status' =&gt; 'publish'
-                ));
-
-                $filename = ( DIR_TESTDATA.'/images/waffles.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits(basename($filename), null, $contents);
-                $mime = wp_check_filetype( $filename );
-                $this-&gt;attachment_data = array(
-                        'post_title' =&gt; basename( $upload['file'] ),
-                        'post_content' =&gt; '',
-                        'post_type' =&gt; 'attachment',
-                        'post_parent' =&gt; $this-&gt;post_id,
-                        'post_mime_type' =&gt; $mime['type'],
-                        'guid' =&gt; $upload[ 'url' ]
-                );
-
-                $id = wp_insert_attachment( $this-&gt;attachment_data, $upload[ 'file' ], $this-&gt;post_id );
-                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
-                $this-&gt;attachment_id = $id;
-
-                set_post_thumbnail( $this-&gt;post_id, $this-&gt;attachment_id );
-        }
-
-        function tearDown() {
-                remove_theme_support( 'post-thumbnails' );
-
-                parent::tearDown();
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_valid_media_item() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $fields = array( 'post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getMediaItem( array( 1, 'author', 'author', $this-&gt;attachment_id, $fields ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this-&gt;assertInternalType( 'string', $result['attachment_id'] );
-                $this-&gt;assertInternalType( 'int', $result['parent'] );
-                $this-&gt;assertInternalType( 'string', $result['title'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this-&gt;assertInternalType( 'string', $result['caption'] );
-                $this-&gt;assertInternalType( 'string', $result['description'] );
-                $this-&gt;assertInternalType( 'string', $result['link'] );
-                $this-&gt;assertInternalType( 'string', $result['thumbnail'] );
-                $this-&gt;assertInternalType( 'array', $result['metadata'] );
-
-                // Check expected values
-                $this-&gt;assertStringMatchesFormat( '%d', $result['attachment_id'] );
-                $this-&gt;assertEquals( $this-&gt;attachment_data['post_title'], $result['title'] );
-                $this-&gt;assertEquals( wp_get_attachment_url( $this-&gt;attachment_id ), $result['link'] );
-                $this-&gt;assertEquals( wp_get_attachment_thumb_url( $this-&gt;attachment_id ), $result['thumbnail'] );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getOptionsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getOptions.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getOptions.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getOptions.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,203 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getOptions extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_valid_username_password() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
-                $this-&gt;assertInternalType( 'array', $result );
-                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
-        }
-
-        function test_option_value() {
-                $this-&gt;make_user_by_role( 'administrator' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
-                $this-&gt;assertInternalType( 'array', $result );
-
-                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this-&gt;assertFalse( $result['default_comment_status']['readonly'] );
-        }
-
-        /**
-         * @ticket 20201
-         */
-        function test_option_values_subscriber() {
-                global $wp_version;
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
-                $this-&gt;assertInternalType( 'array', $result );
-
-                // Read Only options
-                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
-                $this-&gt;assertTrue( $result['software_name']['readonly'] );
-
-                $this-&gt;assertEquals( $wp_version, $result['software_version']['value'] );
-                $this-&gt;assertTrue( $result['software_version']['readonly'] );
-
-                /* TODO: Gives junk data in Test Environment
-                $this-&gt;assertEquals( get_site_url(), $result['site-url']['value'] );
-                $this-&gt;assertTrue( $result['site-url']['readonly'] );
-                */
-
-                $this-&gt;assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
-                $this-&gt;assertTrue( $result['image_default_link_type']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
-                $this-&gt;assertTrue( $result['image_default_size']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
-                $this-&gt;assertTrue( $result['image_default_align']['readonly'] );
-
-                $this-&gt;assertEquals( get_template(), $result['template']['value'] );
-                $this-&gt;assertTrue( $result['template']['readonly'] );
-
-                $this-&gt;assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
-                $this-&gt;assertTrue( $result['stylesheet']['readonly'] );
-
-                $this-&gt;assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
-                $this-&gt;assertTrue( $result['post_thumbnail']['readonly'] );
-
-                // Updatable options
-                $this-&gt;assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
-                $this-&gt;assertTrue( $result['time_zone']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
-                $this-&gt;assertTrue( $result['blog_title']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
-                $this-&gt;assertTrue( $result['blog_tagline']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
-                $this-&gt;assertTrue( $result['date_format']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
-                $this-&gt;assertTrue( $result['time_format']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
-                $this-&gt;assertTrue( $result['users_can_register']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
-                $this-&gt;assertTrue( $result['thumbnail_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
-                $this-&gt;assertTrue( $result['thumbnail_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
-                $this-&gt;assertTrue( $result['thumbnail_crop']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
-                $this-&gt;assertTrue( $result['medium_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
-                $this-&gt;assertTrue( $result['medium_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
-                $this-&gt;assertTrue( $result['large_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
-                $this-&gt;assertTrue( $result['large_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this-&gt;assertTrue( $result['default_comment_status']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
-                $this-&gt;assertTrue( $result['default_ping_status']['readonly'] );
-        }
-
-        function test_option_values_admin() {
-                global $wp_version;
-
-                $this-&gt;make_user_by_role( 'administrator' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator' ) );
-                $this-&gt;assertInternalType( 'array', $result );
-
-                // Read Only options
-                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
-                $this-&gt;assertTrue( $result['software_name']['readonly'] );
-
-                $this-&gt;assertEquals( $wp_version, $result['software_version']['value'] );
-                $this-&gt;assertTrue( $result['software_version']['readonly'] );
-
-                /* TODO: Gives junk data in Test Environment
-                $this-&gt;assertEquals( get_site_url(), $result['site-url']['value'] );
-                $this-&gt;assertTrue( $result['site-url']['readonly'] );
-                */
-
-                $this-&gt;assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
-                $this-&gt;assertTrue( $result['image_default_link_type']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
-                $this-&gt;assertTrue( $result['image_default_size']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
-                $this-&gt;assertTrue( $result['image_default_align']['readonly'] );
-
-                $this-&gt;assertEquals( get_template(), $result['template']['value'] );
-                $this-&gt;assertTrue( $result['template']['readonly'] );
-
-                $this-&gt;assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
-                $this-&gt;assertTrue( $result['stylesheet']['readonly'] );
-
-                $this-&gt;assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
-                $this-&gt;assertTrue( $result['post_thumbnail']['readonly'] );
-
-                // Updatable options
-                $this-&gt;assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
-                $this-&gt;assertFalse( $result['time_zone']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
-                $this-&gt;assertFalse( $result['blog_title']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
-                $this-&gt;assertFalse( $result['blog_tagline']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
-                $this-&gt;assertFalse( $result['date_format']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
-                $this-&gt;assertFalse( $result['time_format']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
-                $this-&gt;assertFalse( $result['users_can_register']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
-                $this-&gt;assertFalse( $result['thumbnail_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
-                $this-&gt;assertFalse( $result['thumbnail_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
-                $this-&gt;assertFalse( $result['thumbnail_crop']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
-                $this-&gt;assertFalse( $result['medium_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
-                $this-&gt;assertFalse( $result['medium_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
-                $this-&gt;assertFalse( $result['large_size_w']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
-                $this-&gt;assertFalse( $result['large_size_h']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this-&gt;assertFalse( $result['default_comment_status']['readonly'] );
-
-                $this-&gt;assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
-                $this-&gt;assertFalse( $result['default_ping_status']['readonly'] );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPagephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPage.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPage.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPage.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,102 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPage extends WP_XMLRPC_UnitTestCase {
-        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_type' =&gt; 'page',
-                        'post_title' =&gt; rand_str(),
-                        'post_content' =&gt; rand_str( 2000 ),
-                        'post_excerpt' =&gt; rand_str( 100 ),
-                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
-                        '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 );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        /**
-         * @ticket 20336
-         */
-        function test_invalid_pageid() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-
-        function test_valid_page() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this-&gt;assertInternalType( 'string', $result['userid'] );
-                $this-&gt;assertInternalType( 'int',    $result['page_id'] );
-                $this-&gt;assertInternalType( 'string', $result['page_status'] );
-                $this-&gt;assertInternalType( 'string', $result['description'] );
-                $this-&gt;assertInternalType( 'string', $result['title'] );
-                $this-&gt;assertInternalType( 'string', $result['link'] );
-                $this-&gt;assertInternalType( 'string', $result['permaLink'] );
-                $this-&gt;assertInternalType( 'array',  $result['categories'] );
-                $this-&gt;assertInternalType( 'string', $result['excerpt'] );
-                $this-&gt;assertInternalType( 'string', $result['text_more'] );
-                $this-&gt;assertInternalType( 'int',    $result['mt_allow_comments'] );
-                $this-&gt;assertInternalType( 'int',    $result['mt_allow_pings'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_password'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_author'] );
-                $this-&gt;assertInternalType( 'int',    $result['wp_page_parent_id'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_page_parent_title'] );
-                $this-&gt;assertInternalType( 'int',    $result['wp_page_order'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
-                $this-&gt;assertInternalType( 'array',  $result['custom_fields'] );
-                $this-&gt;assertInternalType( 'string', $result['wp_page_template'] );
-
-                // Check expected values
-                $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
-                $this-&gt;assertEquals( 'draft', $result['page_status'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['title'] );
-                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['excerpt'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-        }
-
-        function test_date() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-
-                $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['dateCreated']-&gt;getTimestamp() );
-                $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPageListphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPageList.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPageList.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPageList.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPageList extends WP_XMLRPC_UnitTestCase {
-        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_type' =&gt; 'page',
-                        'post_title' =&gt; rand_str(),
-                        'post_content' =&gt; rand_str( 2000 ),
-                        'post_excerpt' =&gt; rand_str( 100 ),
-                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
-                        '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 test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'contributor', 'contributor' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_date() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $page = get_post( $result-&gt;page_id );
-                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
-
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result-&gt;dateCreated );
-                        $this-&gt;assertInstanceOf( 'IXR_Date', $result-&gt;date_created_gmt );
-
-                        $this-&gt;assertEquals( strtotime( $page-&gt;post_date ), $result-&gt;dateCreated-&gt;getTimestamp() );
-                        $this-&gt;assertEquals( $date_gmt, $result-&gt;date_created_gmt-&gt;getTimestamp() );
-                }
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPagesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPages.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPages.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPages.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,86 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPages extends WP_XMLRPC_UnitTestCase {
-    var $post_data;
-    var $post_id;
-    var $post_date_ts;
-    var $editor_id;
-
-    function setUp() {
-        parent::setUp();
-
-        $this-&gt;post_date_ts = strtotime( '+1 day' );
-        $this-&gt;post_data = array(
-            'post_type' =&gt; 'page',
-            'post_title' =&gt; rand_str(),
-            'post_content' =&gt; rand_str( 2000 ),
-            'post_excerpt' =&gt; rand_str( 100 ),
-            'post_author' =&gt; $this-&gt;make_user_by_role( 'administrator' ),
-            '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 );
-        $this-&gt;editor_id = $this-&gt;make_user_by_role( 'editor' );
-    }
-
-    function test_invalid_username_password() {
-        $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'username', 'password' ) );
-        $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-        $this-&gt;assertEquals( 403, $result-&gt;code );
-    }
-
-    function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-        $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'contributor', 'contributor' ) );
-        $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-        $this-&gt;assertEquals( 401, $result-&gt;code );
-    }
-
-    function test_capable_user() {
-        $results = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'administrator', 'administrator' ) );
-        $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-        foreach( $results as $result ) {
-            $page = get_post( $result['page_id'] );
-            $this-&gt;assertEquals( $page-&gt;post_type, 'page' );
-        }
-    }
-
-    function remove_editor_edit_page_cap( $caps, $cap, $user_id, $args ) {
-        if ( in_array( $cap, array( 'edit_page', 'edit_others_pages' ) ) ) {
-            if ( $user_id == $this-&gt;editor_id &amp;&amp; $args[0] == $this-&gt;post_id ) {
-                return array( false );
-            }
-        }
-
-        return $caps;
-    }
-
-        /**
-         * @ticket 20629
-         */
-        function test_semi_capable_user() {
-        add_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap') , 10, 4 );
-
-        $results = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'editor', 'editor' ) );
-        $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-
-        $found_incapable = false;
-        foreach( $results as $result ) {
-            // WP#20629
-            $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-            if ( $result['page_id'] == $this-&gt;post_id ) {
-                $found_incapable = true;
-                break;
-            }
-        }
-        $this-&gt;assertFalse( $found_incapable );
-
-        remove_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap' ), 10, 4 );
-    }
-
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,118 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPost extends WP_XMLRPC_UnitTestCase {
-        var $post_data;
-        var $post_id;
-        var $post_date_ts;
-        var $post_custom_field;
-
-        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; $this-&gt;make_user_by_role( 'author' ),
-                        '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 );
-                $this-&gt;post_custom_field = array( 'key' =&gt; 'test_custom_field', 'value' =&gt; 12345678);
-                $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'] );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'username', 'password', 1 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post', 'custom_fields' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this-&gt;assertInternalType( 'string', $result['post_id'] );
-                $this-&gt;assertInternalType( 'string', $result['post_title'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
-                $this-&gt;assertInternalType( 'string', $result['post_status'] );
-                $this-&gt;assertInternalType( 'string', $result['post_type'] );
-                $this-&gt;assertInternalType( 'string', $result['post_name'] );
-                $this-&gt;assertInternalType( 'string', $result['post_author'] );
-                $this-&gt;assertInternalType( 'string', $result['post_password'] );
-                $this-&gt;assertInternalType( 'string', $result['post_excerpt'] );
-                $this-&gt;assertInternalType( 'string', $result['post_content'] );
-                $this-&gt;assertInternalType( 'string', $result['link'] );
-                $this-&gt;assertInternalType( 'string', $result['comment_status'] );
-                $this-&gt;assertInternalType( 'string', $result['ping_status'] );
-                $this-&gt;assertInternalType( 'bool', $result['sticky'] );
-                $this-&gt;assertInternalType( 'string', $result['post_format'] );
-                $this-&gt;assertInternalType( 'array', $result['post_thumbnail'] );
-                $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
-
-                // Check expected values
-                $this-&gt;assertStringMatchesFormat( '%d', $result['post_id'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['post_title'] );
-                $this-&gt;assertEquals( 'draft', $result['post_status'] );
-                $this-&gt;assertEquals( 'post', $result['post_type'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['post_author'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['post_excerpt'] );
-                $this-&gt;assertEquals( $this-&gt;post_data['post_content'], $result['post_content'] );
-                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
-                $this-&gt;assertEquals( $this-&gt;post_custom_field['id'], $result['custom_fields'][0]['id'] );
-                $this-&gt;assertEquals( $this-&gt;post_custom_field['key'], $result['custom_fields'][0]['key'] );
-                $this-&gt;assertEquals( $this-&gt;post_custom_field['value'], $result['custom_fields'][0]['value'] );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_no_fields() {
-                $fields = array();
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // when no fields are requested, only the IDs should be returned
-                $this-&gt;assertEquals( 1, count( $result ) );
-                $this-&gt;assertEquals( array( 'post_id' ), array_keys( $result ) );
-        }
-
-        function test_default_fields() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertArrayHasKey( 'post_id', $result );
-                $this-&gt;assertArrayHasKey( 'link', $result ); // random field from 'posts' group
-                $this-&gt;assertArrayHasKey( 'terms', $result );
-                $this-&gt;assertArrayHasKey( 'custom_fields', $result );
-        }
-
-        function test_date() {
-                $fields = array( 'post' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified'] );
-                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
-
-                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['post_date']-&gt;getTimestamp() );
-                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['post_modified']-&gt;getTimestamp() );
-
-                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-                $post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this-&gt;assertEquals( $post_date_gmt, $result['post_date_gmt']-&gt;getTimestamp() );
-                $this-&gt;assertEquals( $post_modified_gmt, $result['post_modified_gmt']-&gt;getTimestamp() );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPostTypephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPostType.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPostType.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPostType.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,132 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPostType extends WP_XMLRPC_UnitTestCase {
-        var $cpt_name;
-        var $cpt_args;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;cpt_name = 'post_type_test';
-                $this-&gt;cpt_args = array(
-                        'public' =&gt; false,
-                        'show_ui' =&gt; true,
-                        'show_in_menu' =&gt; true,
-                        'menu_position' =&gt; 7,
-                        'menu_icon' =&gt; 'cpt_icon.png',
-                        'taxonomies' =&gt; array( 'category', 'post_tag' ),
-                        'hierarchical' =&gt; true
-                );
-                register_post_type( $this-&gt;cpt_name, $this-&gt;cpt_args );
-        }
-
-        function tearDown() {
-                _unregister_post_type( $this-&gt;cpt_name );
-
-                parent::tearDown();
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'username', 'password', 'post' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_invalid_post_type_name() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_valid_post_type_name() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_valid_type() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', $this-&gt;cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // check data types
-                $this-&gt;assertInternalType( 'string', $result['name'] );
-                $this-&gt;assertInternalType( 'string', $result['label'] );
-                $this-&gt;assertInternalType( 'bool', $result['hierarchical'] );
-                $this-&gt;assertInternalType( 'bool', $result['public'] );
-                $this-&gt;assertInternalType( 'bool', $result['_builtin'] );
-                $this-&gt;assertInternalType( 'bool', $result['map_meta_cap'] );
-                $this-&gt;assertInternalType( 'bool', $result['has_archive'] );
-                $this-&gt;assertInternalType( 'bool', $result['show_ui'] );
-                $this-&gt;assertInternalType( 'int', $result['menu_position'] );
-                $this-&gt;assertInternalType( 'string', $result['menu_icon'] );
-                $this-&gt;assertInternalType( 'array', $result['labels'] );
-                $this-&gt;assertInternalType( 'array', $result['cap'] );
-                $this-&gt;assertInternalType( 'array', $result['taxonomies'] );
-                $this-&gt;assertInternalType( 'array', $result['supports'] );
-
-                // check label data types
-                $this-&gt;assertInternalType( 'string', $result['labels']['name'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['singular_name'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['add_new'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['add_new_item'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['edit_item'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['new_item'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['view_item'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['search_items'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['not_found'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['not_found_in_trash'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['parent_item_colon'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['all_items'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['menu_name'] );
-                $this-&gt;assertInternalType( 'string', $result['labels']['name_admin_bar'] );
-
-                // check cap data types
-                $this-&gt;assertInternalType( 'string', $result['cap']['edit_post'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['read_post'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['delete_post'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['edit_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['edit_others_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['publish_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['read_private_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['read'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['delete_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['delete_private_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['delete_published_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['delete_others_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['edit_private_posts'] );
-                $this-&gt;assertInternalType( 'string', $result['cap']['edit_published_posts'] );
-
-                // check taxonomy data types
-                foreach ( $result['taxonomies'] as $taxonomy ) {
-                        $this-&gt;assertInternalType( 'string', $taxonomy );
-                }
-
-                // check taxonomy data types
-                foreach ( $result['supports'] as $key =&gt; $value ) {
-                        $this-&gt;assertInternalType( 'string', $key );
-                        $this-&gt;assertInternalType( 'bool', $value );
-                }
-
-                // Check expected values
-                $this-&gt;assertEquals( $this-&gt;cpt_name, $result['name'] );
-                foreach ( $this-&gt;cpt_args as $key =&gt; $value ) {
-                        $this-&gt;assertEquals( $value, $result[$key] );
-                }
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPostTypesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPostTypes.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPostTypes.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPostTypes.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertInternalType( 'array', $result );
-                $this-&gt;assertEquals( 0, count( $result ) );
-        }
-
-        function test_capable_user() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertInternalType( 'array', $result );
-                $this-&gt;assertGreaterThan( 0, count( $result ) );
-        }
-
-        function test_simple_filter() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' =&gt; true ) ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertInternalType( 'array', $result );
-
-                // verify that pages is in the result, and post is not
-                $result_names = wp_list_pluck( $result, 'name' );
-                $this-&gt;assertContains( 'page', $result_names );
-                $this-&gt;assertNotContains( 'post', $result_names );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getPostsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getPosts.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getPosts.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getPosts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,130 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPosts extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'username', 'password' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        /**
-         * @ticket 20991
-         */
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $filter = array( 'post_type' =&gt; 'page' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_user() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_invalid_post_type() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $filter = array( 'post_type' =&gt; 'invalid_post_type_name' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_filters() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $cpt_name = 'test_wp_getposts_cpt';
-                register_post_type( $cpt_name, array(
-                        'taxonomies' =&gt; array( 'post_tag', 'category' ),
-                        'public' =&gt; true
-                ));
-
-                $num_posts = 17;
-                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( $num_posts, array( 'post_type' =&gt; $cpt_name ) );
-
-                // get them all
-                $filter = array( 'post_type' =&gt; $cpt_name, 'number' =&gt; $num_posts + 10 );
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-                $this-&gt;assertEquals( $num_posts, count( $results ) );
-
-                // page through results
-                $posts_found = array();
-                $filter['number'] = 5;
-                $filter['offset'] = 0;
-                do {
-                        $presults = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                        foreach( $presults as $post ) {
-                                $posts_found[] = $post['post_id'];
-                        }
-                        $filter['offset'] += $filter['number'];
-                } while ( count( $presults ) &gt; 0 );
-                // verify that $post_ids matches $posts_found
-                $this-&gt;assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) );
-
-                // add comments to some of the posts
-                $random_posts = array_rand( $post_ids, $num_posts / 2 );
-                foreach ( $random_posts as $i ) {
-                        $post = $post_ids[$i];
-                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post, rand( 1, 20 ) );
-                }
-
-                // get results ordered by comment count
-                $filter2 = array( 'post_type' =&gt; $cpt_name, 'number' =&gt; $num_posts, 'orderby' =&gt; 'comment_count', 'order' =&gt; 'DESC' );
-                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
-                $last_comment_count = 100;
-                foreach ( $results2 as $post ) {
-                        $comment_count = intval( get_comments_number( $post['post_id'] ) );
-                        $this-&gt;assertLessThanOrEqual( $last_comment_count, $comment_count );
-                        $last_comment_count = $comment_count;
-                }
-
-                // set one of the posts to draft and get drafts
-                $post = get_post( $post_ids[$random_posts[0]] );
-                $post-&gt;post_status = 'draft';
-                wp_update_post( $post );
-                $filter3 = array( 'post_type' =&gt; $cpt_name, 'post_status' =&gt; 'draft' );
-                $results3 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results3 );
-                $this-&gt;assertEquals( 1, count( $results3 ) );
-                $this-&gt;assertEquals( $post-&gt;ID, $results3[0]['post_id'] );
-
-                _unregister_post_type( $cpt_name );
-        }
-
-        function test_fields() {
-                $this-&gt;make_user_by_role( 'editor' );
-                $this-&gt;factory-&gt;post-&gt;create();
-
-                // check default fields
-                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor' ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
-                $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields
-                foreach( $expected_fields as $field ) {
-                        $this-&gt;assertArrayHasKey( $field, $results[0] );
-                }
-
-                // request specific fields and verify that only those are returned
-                $filter = array();
-                $fields = array( 'post_name', 'post_author', 'enclosure' );
-                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
-                $expected_fields = array_merge( $fields, array( 'post_id' ) );
-                foreach ( array_keys( $results2[0] ) as $field ) {
-                        $this-&gt;assertContains( $field, $expected_fields );
-                }
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getTaxonomiesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getTaxonomies.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getTaxonomies.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getTaxonomies.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,20 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-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 );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getTaxonomyphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getTaxonomy.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getTaxonomy.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getTaxonomy.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,62 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-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' );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getTermphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getTerm.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getTerm.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-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'] );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_getTermsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_getTerms.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_getTerms.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_getTerms.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,149 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-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'] );
-        }
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_newPostphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_newPost.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_newPost.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_newPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,305 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_newPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'username', 'password', array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_incapable_user() {
-                $this-&gt;make_user_by_role( 'subscriber' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_no_content() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', array() ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-                $this-&gt;assertEquals( 'Content, title, and excerpt are empty.', $result-&gt;message );
-        }
-
-        function test_basic_content() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Test' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_ignore_id() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'ID' =&gt; 103948 );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertNotEquals( '103948', $result );
-        }
-
-        function test_capable_publish() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_publish() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_private() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_private() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_other_author() {
-                $other_author_id = $this-&gt;make_user_by_role( 'author' );
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_other_author() {
-                $other_author_id = $this-&gt;make_user_by_role( 'author' );
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_invalid_author() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; 99999999 );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 404, $result-&gt;code );
-        }
-
-        function test_empty_author() {
-                $my_author_id = $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Test' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this-&gt;assertEquals( $my_author_id, $out-&gt;post_author );
-                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $this-&gt;make_user_by_role( 'author' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $upload = wp_upload_bits( $filename, null, $contents );
-                $this-&gt;assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' =&gt; 'Post Thumbnail',
-                        'post_type' =&gt; 'attachment',
-                        'post_mime_type' =&gt; 'image/jpeg',
-                        'guid' =&gt; $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
-
-                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_thumbnail' =&gt; $attachment_id );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_invalid_post_status() {
-                $this-&gt;make_user_by_role( 'author' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'foobar_status' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 'draft', get_post_status( $result ) );
-        }
-
-        function test_incapable_sticky() {
-                $this-&gt;make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_capable_sticky() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertTrue( is_sticky( $result ) );
-        }
-
-        function test_private_sticky() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private', 'sticky' =&gt; true );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-        }
-
-        function test_post_format() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'quote' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 'quote', get_post_format( $result ) );
-        }
-
-        function test_invalid_post_format() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'tumblr' );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( '', get_post_format( $result ) );
-        }
-
-        function test_invalid_taxonomy() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array(
-                        'post_title' =&gt; 'Test',
-                        'terms' =&gt; array(
-                                'foobar_nonexistant' =&gt; array( 1 )
-                        )
-                );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-
-                $post2 = array(
-                        'post_title' =&gt; 'Test',
-                        'terms_names' =&gt; array(
-                                'foobar_nonexistant' =&gt; array( 1 )
-                        )
-                );
-                $result2 = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result2 );
-                $this-&gt;assertEquals( 401, $result2-&gt;code );
-        }
-
-        function test_invalid_term_id() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $post = array(
-                        'post_title' =&gt; 'Test',
-                        'terms' =&gt; array(
-                                'post_tag' =&gt; array( 1390490823409 )
-                        )
-                );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-        }
-
-        function test_terms() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $tag1 = wp_create_tag ( rand_str( 30 ) );
-                $tag2 = wp_create_tag ( rand_str( 30 ) );
-                $tag3 = wp_create_tag ( rand_str( 30 ) );
-
-                $post = array(
-                        'post_title' =&gt; 'Test',
-                        'terms' =&gt; array(
-                                'post_tag' =&gt; array( $tag2['term_id'], $tag3['term_id'] )
-                        )
-                );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' =&gt; 'ids' ) );
-                $this-&gt;assertNotContains( $tag1['term_id'], $post_tags );
-                $this-&gt;assertContains( $tag2['term_id'], $post_tags );
-                $this-&gt;assertContains( $tag3['term_id'], $post_tags );
-        }
-
-        function test_terms_names() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $ambiguous_name = rand_str( 30 );
-                $parent_cat = wp_create_category( $ambiguous_name );
-                $child_cat = wp_create_category( $ambiguous_name, $parent_cat );
-
-                $cat1_name = rand_str( 30 );
-                $cat1 = wp_create_category( $cat1_name, $parent_cat );
-                $cat2_name = rand_str( 30 );
-
-                // first a post with valid categories; one that already exists and one to be created
-                $post = array(
-                        'post_title' =&gt; 'Test',
-                        'terms_names' =&gt; array(
-                                'category' =&gt; array( $cat1_name, $cat2_name )
-                        )
-                );
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                // verify that cat2 was created
-                $cat2 = get_term_by( 'name', $cat2_name, 'category' );
-                $this-&gt;assertNotEmpty( $cat2 );
-                // check that both categories were set on the post
-                $post_cats = wp_get_object_terms( $result, 'category', array( 'fields' =&gt; 'ids' ) );
-                $this-&gt;assertContains( $cat1, $post_cats );
-                $this-&gt;assertContains( $cat2-&gt;term_id, $post_cats );
-
-                // create a second post attempting to use the ambiguous name
-                $post2 = array(
-                        'post_title' =&gt; 'Test',
-                        'terms_names' =&gt; array(
-                                'category' =&gt; array( $cat1_name, $ambiguous_name )
-                        )
-                );
-                $result2 = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result2 );
-                $this-&gt;assertEquals( 401, $result2-&gt;code );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_newTermphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_newTerm.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_newTerm.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_newTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,109 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_newTerm extends WP_XMLRPC_UnitTestCase {
-        var $parent_term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
-                $this-&gt;parent_term = $this-&gt;parent_term['term_id'];
-        }
-
-        function test_invalid_username_password() {
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'username', 'password', array() ) );
-                $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_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; '' ) ) );
-                $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_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; '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_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' =&gt; 'category' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 401, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result-&gt;message );
-        }
-
-        function test_empty_term() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'The term name cannot be empty.' ), $result-&gt;message );
-        }
-
-        function test_parent_for_nonhierarchical() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $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' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'This taxonomy is not hierarchical.' ), $result-&gt;message );
-        }
-
-        function test_parent_invalid() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 'dasda', 'name' =&gt; 'test' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 500, $result-&gt;code );
-        }
-
-        function test_parent_not_existing() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 9999, 'name' =&gt; 'test' ) ) );
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 403, $result-&gt;code );
-                $this-&gt;assertEquals( __( 'Parent term does not exist.' ), $result-&gt;message );
-        }
-
-
-        function test_add_term() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'test' ) ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_add_term_with_parent() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test' ) ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_add_term_with_all() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                $taxonomy = array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test_all', 'description' =&gt; 'Test all', 'slug' =&gt; 'test_all' );
-                $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertStringMatchesFormat( '%d', $result );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststestxmlrpcapitest_wp_uploadFilephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test-xmlrpc-api/test_wp_uploadFile.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test-xmlrpc-api/test_wp_uploadFile.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test-xmlrpc-api/test_wp_uploadFile.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,30 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
-        function test_valid_attachment() {
-                $this-&gt;make_user_by_role( 'editor' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $data = array(
-                        'name' =&gt; 'a2-small.jpg',
-                        'type' =&gt; 'image/jpeg',
-                        'bits' =&gt; base64_encode( $contents )
-                );
-
-
-                $result = $this-&gt;myxmlrpcserver-&gt;mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
-                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
-
-                // check data types
-                $this-&gt;assertInternalType( 'string', $result['id'] );
-                $this-&gt;assertStringMatchesFormat( '%d', $result['id'] );
-                $this-&gt;assertInternalType( 'string', $result['file'] );
-                $this-&gt;assertInternalType( 'string', $result['url'] );
-                $this-&gt;assertInternalType( 'string', $result['type'] );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_actionsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_actions.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_actions.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_actions.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,244 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test do_action() and related functions
- *
- * @group hooks
- */
-class WPTestActions extends WP_UnitTestCase {
-
-        function test_simple_action() {
-                $a = new MockAction();
-                $tag = 'test_action';
-
-                add_action($tag, array(&amp;$a, 'action'));
-                do_action($tag);
-
-                // only one event occurred for the hook, with empty args
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                // only our hook was called
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                $args = array_pop($a-&gt;get_args());
-                $this-&gt;assertEquals(array(''), $args);
-        }
-
-        function test_remove_action() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'action'));
-                do_action($tag);
-
-                // make sure our hook was called correctly
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                // now remove the action, do it again, and make sure it's not called this time
-                remove_action($tag, array(&amp;$a, 'action'));
-                do_action($tag);
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-        }
-
-        function test_has_action() {
-                        $tag = rand_str();
-                        $func = rand_str();
-
-                        $this-&gt;assertFalse( has_action($tag, $func) );
-                        $this-&gt;assertFalse( has_action($tag) );
-                        add_action($tag, $func);
-                        $this-&gt;assertEquals( 10, has_action($tag, $func) );
-                        $this-&gt;assertTrue( has_action($tag) );
-                        remove_action($tag, $func);
-                        $this-&gt;assertFalse( has_action($tag, $func) );
-                        $this-&gt;assertFalse( has_action($tag) );
-        }
-
-        // one tag with multiple actions
-        function test_multiple_actions() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-
-                // add both actions to the hook
-                add_action($tag, array(&amp;$a1, 'action'));
-                add_action($tag, array(&amp;$a2, 'action'));
-
-                do_action($tag);
-
-                // both actions called once each
-                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
-                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
-        }
-
-        function test_action_args_1() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_action($tag, array(&amp;$a, 'action'));
-                // call the action with a single argument
-                do_action($tag, $val);
-
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val), array_pop($a-&gt;get_args()));
-        }
-
-        function test_action_args_2() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-                $val1 = rand_str();
-                $val2 = rand_str();
-
-                // a1 accepts two arguments, a2 doesn't
-                add_action($tag, array(&amp;$a1, 'action'), 10, 2);
-                add_action($tag, array(&amp;$a2, 'action'));
-                // call the action with two arguments
-                do_action($tag, $val1, $val2);
-
-                // a1 should be called with both args
-                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val1, $val2), array_pop($a1-&gt;get_args()));
-
-                // a2 should be called with one only
-                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val1), array_pop($a2-&gt;get_args()));
-        }
-
-        function test_action_priority() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'action'), 10);
-                add_action($tag, array(&amp;$a, 'action2'), 9);
-                do_action($tag);
-
-                // two events, one per action
-                $this-&gt;assertEquals(2, $a-&gt;get_call_count());
-
-                $expected = array (
-                        // action2 is called first because it has priority 9
-                        array (
-                                'action' =&gt; 'action2',
-                                'tag' =&gt; $tag,
-                                'args' =&gt; array('')
-                        ),
-                        // action 1 is called second
-                        array (
-                                'action' =&gt; 'action',
-                                'tag' =&gt; $tag,
-                                'args' =&gt; array('')
-                        ),
-                );
-
-                $this-&gt;assertEquals($expected, $a-&gt;get_events());
-        }
-
-        function test_did_action() {
-                $tag1 = rand_str();
-                $tag2 = rand_str();
-
-                // do action tag1 but not tag2
-                do_action($tag1);
-                $this-&gt;assertEquals(1, did_action($tag1));
-                $this-&gt;assertEquals(0, did_action($tag2));
-
-                // do action tag2 a random number of times
-                $count = rand(0, 10);
-                for ($i=0; $i&lt;$count; $i++)
-                        do_action($tag2);
-
-                // tag1's count hasn't changed, tag2 should be correct
-                $this-&gt;assertEquals(1, did_action($tag1));
-                $this-&gt;assertEquals($count, did_action($tag2));
-
-        }
-
-        function test_all_action() {
-                $a = new MockAction();
-                $tag1 = rand_str();
-                $tag2 = rand_str();
-
-                // add an 'all' action
-                add_action('all', array(&amp;$a, 'action'));
-                $this-&gt;assertEquals(10, has_filter('all', array(&amp;$a, 'action')));
-                // do some actions
-                do_action($tag1);
-                do_action($tag2);
-                do_action($tag1);
-                do_action($tag1);
-
-                // our action should have been called once for each tag
-                $this-&gt;assertEquals(4, $a-&gt;get_call_count());
-                // only our hook was called
-                $this-&gt;assertEquals(array($tag1, $tag2, $tag1, $tag1), $a-&gt;get_tags());
-
-                remove_action('all', array(&amp;$a, 'action'));
-                $this-&gt;assertFalse(has_filter('all', array(&amp;$a, 'action')));
-
-        }
-
-        function test_remove_all_action() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action('all', array(&amp;$a, 'action'));
-                $this-&gt;assertEquals(10, has_filter('all', array(&amp;$a, 'action')));
-                do_action($tag);
-
-                // make sure our hook was called correctly
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                // now remove the action, do it again, and make sure it's not called this time
-                remove_action('all', array(&amp;$a, 'action'));
-                $this-&gt;assertFalse(has_filter('all', array(&amp;$a, 'action')));
-                do_action($tag);
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-        }
-
-        function test_action_ref_array() {
-                $obj = new stdClass();
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'action'));
-
-                do_action_ref_array($tag, array(&amp;$obj));
-
-                $args = $a-&gt;get_args();
-                $this-&gt;assertSame($args[0][0], $obj);
-                // just in case we don't trust assertSame
-                $obj-&gt;foo = true;
-                $this-&gt;assertFalse( empty($args[0][0]-&gt;foo) );
-        }
-
-        /**
-         * @ticket 11241
-         */
-        function test_action_keyed_array() {
-                $a = new MockAction();
-
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'action'));
-
-                $context = array( rand_str() =&gt; rand_str() );
-                do_action($tag, $context);
-
-                $args = $a-&gt;get_args();
-                $this-&gt;assertSame($args[0][0], $context);
-
-                $context2 = array( rand_str() =&gt; rand_str(), rand_str() =&gt; rand_str() );
-                do_action($tag, $context2);
-
-                $args = $a-&gt;get_args();
-                $this-&gt;assertSame($args[1][0], $context2);
-
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_actions_closuresphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_actions_closures.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_actions_closures.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_actions_closures.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,35 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test do_action() and related functions
- *
- * @group hooks
- */
-class WP_Test_Actions_Closures extends WP_UnitTestCase {
-
-        /**
-         * @ticket 10493
-         */
-        function test_action_closure() {
-                $tag = rand_str();
-                $closure = function($a, $b) { $GLOBALS[$a] = $b;};
-                add_action($tag, $closure, 10, 2);
-
-                $this-&gt;assertSame( 10, has_action($tag, $closure) );
-
-                $context = array( rand_str(), rand_str() );
-                do_action($tag, $context[0], $context[1]);
-
-                $this-&gt;assertSame($GLOBALS[$context[0]], $context[1]);
-
-                $tag2 = rand_str();
-                $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
-                add_action($tag2, $closure2);
-
-                $this-&gt;assertSame( 10, has_action($tag2, $closure2) );
-
-                do_action($tag2);
-
-                $this-&gt;assertTrue($GLOBALS['closure_no_args']);
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_admin_includes_miscphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_admin_includes_misc.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_admin_includes_misc.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_admin_includes_misc.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,24 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group admin
- */
-class TestShortenUrl extends WP_UnitTestCase {
-        function test_shorten_url() {
-                $tests = array(
-                        // strip slashes
-                        'wordpress\.org/about/philosophy'
-                                =&gt; 'wordpress.org/about/philosophy', // strip slashes
-                        'http://wordpress.org/about/philosophy/'
-                                =&gt; 'wordpress.org/about/philosophy', // remove http, trailing slash
-                        'http://www.wordpress.org/about/philosophy/'
-                                =&gt; 'wordpress.org/about/philosophy', // remove http, www
-                        'http://wordpress.org/about/philosophy/#box'
-                                =&gt; 'wordpress.org/about/philosophy/#box', // don't shorten 35 characters
-                        'http://wordpress.org/about/philosophy/#decisions'
-                                =&gt; 'wordpress.org/about/philosophy/#...', // shorten to 32 if &gt; 35 after cleaning
-                );
-                foreach ( $tests as $k =&gt; $v )
-                        $this-&gt;assertEquals( $v, url_shorten( $k ) );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_admin_includes_pluginphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_admin_includes_plugin.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_admin_includes_plugin.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_admin_includes_plugin.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,76 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group plugins
- * @group admin
- */
-class TestPluginData extends WP_UnitTestCase {
-        function test_get_plugin_data() {
-                $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
-
-                $default_headers = array(
-                        'Name' =&gt; 'Hello Dolly',
-                        'Title' =&gt; '&lt;a href=&quot;http://wordpress.org/#&quot; title=&quot;Visit plugin homepage&quot;&gt;Hello Dolly&lt;/a&gt;',
-                        'PluginURI' =&gt; 'http://wordpress.org/#',
-                        'Description' =&gt; 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. &lt;cite&gt;By &lt;a href=&quot;http://ma.tt/&quot; title=&quot;Visit author homepage&quot;&gt;Matt Mullenweg&lt;/a&gt;.&lt;/cite&gt;',
-                        'Author' =&gt; '&lt;a href=&quot;http://ma.tt/&quot; title=&quot;Visit author homepage&quot;&gt;Matt Mullenweg&lt;/a&gt;',
-                        'AuthorURI' =&gt; 'http://ma.tt/',
-                        'Version' =&gt; '1.5.1',
-                        'TextDomain' =&gt; 'hello-dolly',
-                        'DomainPath' =&gt; ''
-                );
-
-                $this-&gt;assertTrue( is_array($data) );
-
-                foreach ($default_headers as $name =&gt; $value) {
-                        $this-&gt;assertTrue(isset($data[$name]));
-                        $this-&gt;assertEquals($value, $data[$name]);
-                }
-        }
-}
-
-/**
- * @group plugins
- * @group admin
- */
-class TestPluginMenus extends WP_UnitTestCase {
-
-        protected $current_user;
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;current_user = get_current_user_id();
-                // pages require manage_options, ensure we're an administrator
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                wp_set_current_user( $user_id );
-                update_option( 'siteurl', 'http://example.com' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                wp_set_current_user( $this-&gt;current_user );
-        }
-
-        function test_menu_page_url() {
-                // add some pages
-                add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
-                add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
-                add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
-                add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
-                add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
-                add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
-                add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
-
-                $expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
-                $expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
-                $expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
-                $expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
-                $expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
-                $expected['not_registered'] = '';
-                $expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
-                $expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&amp;#038;page=testpages';
-
-                foreach ($expected as $name =&gt; $value) {
-                        $this-&gt;assertEquals( $value, menu_page_url( $name, false ) );
-                }
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_admin_includes_screenphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_admin_includes_screen.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_admin_includes_screen.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_admin_includes_screen.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,166 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group admin
- */
-class WPTestScreen extends WP_UnitTestCase {
-        var $core_screens = array(
-                'index.php' =&gt; array( 'base' =&gt; 'dashboard', 'id' =&gt; 'dashboard' ),
-                'edit.php' =&gt; array( 'base' =&gt; 'edit', 'id' =&gt; 'edit-post', 'post_type' =&gt; 'post' ),
-                'post-new.php'=&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'post', 'id' =&gt; 'post', 'post_type' =&gt; 'post' ),
-                'edit-tags.php' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-post_tag', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'post_tag' ),
-                'edit-tags.php?taxonomy=post_tag' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-post_tag', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'post_tag' ),
-                'edit-tags.php?taxonomy=category' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-category', 'post_type' =&gt; 'post', 'taxonomy' =&gt; 'category' ),
-                'upload.php' =&gt; array( 'base' =&gt; 'upload', 'id' =&gt; 'upload' ),
-                'media-new.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'media', 'id' =&gt; 'media' ),
-                'edit.php?post_type=page' =&gt; array( 'base' =&gt; 'edit', 'id' =&gt; 'edit-page', 'post_type' =&gt; 'page' ),
-                'link-manager.php' =&gt; array( 'base' =&gt; 'link-manager', 'id' =&gt; 'link-manager' ),
-                'link-add.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'link', 'id' =&gt; 'link' ),
-                'edit-tags.php?taxonomy=link_category' =&gt; array( 'base' =&gt; 'edit-tags', 'id' =&gt; 'edit-link_category', 'taxonomy' =&gt; 'link_category' ),
-                'edit-comments.php' =&gt; array( 'base' =&gt; 'edit-comments', 'id' =&gt; 'edit-comments' ),
-                'themes.php' =&gt; array( 'base' =&gt; 'themes', 'id' =&gt; 'themes' ),
-                'widgets.php' =&gt; array( 'base' =&gt; 'widgets', 'id' =&gt; 'widgets' ),
-                'nav-menus.php' =&gt; array( 'base' =&gt; 'nav-menus', 'id' =&gt; 'nav-menus' ),
-                'plugins.php' =&gt; array( 'base' =&gt; 'plugins', 'id' =&gt; 'plugins' ),
-                'users.php' =&gt; array( 'base' =&gt; 'users', 'id' =&gt; 'users' ),
-                'user-new.php' =&gt; array( 'action' =&gt; 'add', 'base' =&gt; 'user', 'id' =&gt; 'user' ),
-                'profile.php' =&gt; array( 'base' =&gt; 'profile', 'id' =&gt; 'profile' ),
-                'tools.php' =&gt; array( 'base' =&gt; 'tools', 'id' =&gt; 'tools' ),
-                'import.php' =&gt; array( 'base' =&gt; 'import', 'id' =&gt; 'import' ),
-                'export.php' =&gt; array( 'base' =&gt; 'export', 'id' =&gt; 'export' ),
-                'options-general.php' =&gt; array( 'base' =&gt; 'options-general', 'id' =&gt; 'options-general' ),
-                'options-writing.php' =&gt; array( 'base' =&gt; 'options-writing', 'id' =&gt; 'options-writing' ),
-        );
-
-        function tearDown() {
-                parent::tearDown();
-                unset( $GLOBALS['wp_taxonomies']['old-or-new'] );
-        }
-
-        function test_set_current_screen_with_hook_suffix() {
-                global $current_screen;
-
-                foreach ( $this-&gt;core_screens as $hook_name =&gt; $screen ) {
-                        $_GET = $_POST = $_REQUEST = array();
-                        $GLOBALS['taxnow'] = $GLOBALS['typenow'] = '';
-                        $screen = (object) $screen;
-                        $hook = parse_url( $hook_name );
-
-                        if ( ! empty( $hook['query'] ) ) {
-                                $args = wp_parse_args( $hook['query'] );
-                                if ( isset( $args['taxonomy'] ) )
-                                        $GLOBALS['taxnow'] = $_GET['taxonomy'] = $_POST['taxonomy'] = $_REQUEST['taxonomy'] = $args['taxonomy'];
-                                if ( isset( $args['post_type'] ) )
-                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $args['post_type'];
-                                else if ( isset( $screen-&gt;post_type ) )
-                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen-&gt;post_type;
-                        }
-
-                        $GLOBALS['hook_suffix'] = $hook['path'];
-                        set_current_screen();
-
-                        $this-&gt;assertEquals( $screen-&gt;id, $current_screen-&gt;id, $hook_name );
-                        $this-&gt;assertEquals( $screen-&gt;base, $current_screen-&gt;base, $hook_name );
-                        if ( isset( $screen-&gt;action ) )
-                                $this-&gt;assertEquals( $screen-&gt;action, $current_screen-&gt;action, $hook_name );
-                        if ( isset( $screen-&gt;post_type ) )
-                                $this-&gt;assertEquals( $screen-&gt;post_type, $current_screen-&gt;post_type, $hook_name );
-                        else
-                                $this-&gt;assertEmpty( $current_screen-&gt;post_type, $hook_name );
-                        if ( isset( $screen-&gt;taxonomy ) )
-                                $this-&gt;assertEquals( $screen-&gt;taxonomy, $current_screen-&gt;taxonomy, $hook_name );
-
-                        // With convert_to_screen(), the same ID should return the exact $current_screen.
-                        $this-&gt;assertSame( $current_screen, convert_to_screen( $screen-&gt;id ), $hook_name );
-
-                        // With convert_to_screen(), the hook_suffix should return the exact $current_screen.
-                        // But, convert_to_screen() cannot figure out ?taxonomy and ?post_type.
-                        if ( empty( $hook['query'] ) )
-                                $this-&gt;assertSame( $current_screen, convert_to_screen( $GLOBALS['hook_suffix'] ), $hook_name );
-                }
-        }
-
-        function test_post_type_as_hookname() {
-                $screen = convert_to_screen( 'page' );
-                $this-&gt;assertEquals( $screen-&gt;post_type, 'page' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'page' );
-        }
-
-        function test_post_type_with_special_suffix_as_hookname() {
-                register_post_type( 'value-add' );
-                $screen = convert_to_screen( 'value-add' ); // the -add part is key.
-                $this-&gt;assertEquals( $screen-&gt;post_type, 'value-add' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'value-add' );
-
-                $screen = convert_to_screen( 'edit-value-add' ); // the -add part is key.
-                $this-&gt;assertEquals( $screen-&gt;post_type, 'value-add' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'edit' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'edit-value-add' );
-        }
-
-        function test_taxonomy_with_special_suffix_as_hookname() {
-                register_taxonomy( 'old-or-new', 'post' );
-                $screen = convert_to_screen( 'edit-old-or-new' ); // the -new part is key.
-                $this-&gt;assertEquals( $screen-&gt;taxonomy, 'old-or-new' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'edit-tags' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'edit-old-or-new' );
-        }
-
-        function test_post_type_with_edit_prefix() {
-                register_post_type( 'edit-some-thing' );
-                $screen = convert_to_screen( 'edit-some-thing' );
-                $this-&gt;assertEquals( $screen-&gt;post_type, 'edit-some-thing' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'edit-some-thing' );
-
-                $screen = convert_to_screen( 'edit-edit-some-thing' );
-                $this-&gt;assertEquals( $screen-&gt;post_type, 'edit-some-thing' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'edit' );
-                $this-&gt;assertEquals( $screen-&gt;id, 'edit-edit-some-thing' );
-        }
-
-        function test_post_type_edit_collisions() {
-                register_post_type( 'comments' );
-                register_post_type( 'tags' );
-
-                // Sorry, core wins here.
-                $screen = convert_to_screen( 'edit-comments' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'edit-comments' );
-
-                // The post type wins here. convert_to_screen( $post_type ) is only relevant for meta boxes anyway.
-                $screen = convert_to_screen( 'comments' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
-
-                // Core wins.
-                $screen = convert_to_screen( 'edit-tags' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'edit-tags' );
-
-                $screen = convert_to_screen( 'tags' );
-                $this-&gt;assertEquals( $screen-&gt;base, 'post' );
-        }
-
-        function test_help_tabs() {
-                $tab = rand_str();
-                $tab_args = array(
-                        'id' =&gt; $tab,
-                        'title' =&gt; 'Help!',
-                        'content' =&gt; 'Some content',
-                        'callback' =&gt; false,
-                );
-
-                $screen = get_current_screen();
-                $screen-&gt;add_help_tab( $tab_args );
-                $this-&gt;assertEquals( $screen-&gt;get_help_tab( $tab ), $tab_args );
-
-                $tabs = $screen-&gt;get_help_tabs();
-                $this-&gt;assertArrayHasKey( $tab, $tabs );
-
-                $screen-&gt;remove_help_tab( $tab );
-                $this-&gt;assertNull( $screen-&gt;get_help_tab( $tab ) );
-
-                $screen-&gt;remove_help_tabs();
-                $this-&gt;assertEquals( $screen-&gt;get_help_tabs(), array() );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_admin_includes_templatephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_admin_includes_template.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_admin_includes_template.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_admin_includes_template.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group admin
- */
-class WPTestCheckedSelected extends WP_UnitTestCase {
-        function test_equal() {
-                $this-&gt;assertEquals(' selected=\'selected\'', selected('foo','foo',false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked('foo','foo',false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected('1',1,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked('1',1,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected('1',true,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked('1',true,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected(1,1,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked(1,1,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected(1,true,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked(1,true,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected(true,true,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked(true,true,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected('0',0,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked('0',0,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected(0,0,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked(0,0,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected('',false,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked('',false,false));
-
-                $this-&gt;assertEquals(' selected=\'selected\'', selected(false,false,false));
-                $this-&gt;assertEquals(' checked=\'checked\'', checked(false,false,false));
-        }
-
-        function test_notequal() {
-                $this-&gt;assertEquals('', selected('0','',false));
-                $this-&gt;assertEquals('', checked('0','',false));
-
-                $this-&gt;assertEquals('', selected(0,'',false));
-                $this-&gt;assertEquals('', checked(0,'',false));
-
-                $this-&gt;assertEquals('', selected(0,false,false));
-                $this-&gt;assertEquals('', checked(0,false,false));
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_admin_includes_themephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_admin_includes_theme.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_admin_includes_theme.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_admin_includes_theme.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group themes
- */
-class TestPageTemplates extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;theme_root = DIR_TESTDATA . '/themedir1';
-
-                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
-                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
-
-                add_filter('theme_root', array(&amp;$this, '_theme_root'));
-                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
-
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
-                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
-                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
-
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-                parent::tearDown();
-        }
-
-        // replace the normal theme root dir with our premade test dir
-        function _theme_root($dir) {
-                return $this-&gt;theme_root;
-        }
-
-        /**
-         * @ticket 10959
-         * @ticket 11216
-         */
-        function test_page_templates() {
-                $theme = get_theme('Page Template Theme');
-                $this-&gt;assertFalse( empty($theme) );
-
-                switch_theme($theme['Template'], $theme['Stylesheet']);
-
-                $templates = get_page_templates();
-                $this-&gt;assertEquals(3, count($templates));
-                $this-&gt;assertEquals(&quot;template-top-level.php&quot;, $templates['Top Level']);
-                $this-&gt;assertEquals(&quot;subdir/template-sub-dir.php&quot;, $templates['Sub Dir']);
-                $this-&gt;assertEquals(&quot;template-header.php&quot;, $templates['This Template Header Is On One Line']);
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_cronphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_cron.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_cron.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_cron.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,310 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test the cron scheduling functions
- *
- * @group cron
- */
-class WPTestCronScheduling extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-
-        function test_wp_get_schedule_empty() {
-                // nothing scheduled
-                $hook = rand_str();
-                $this-&gt;assertFalse(wp_get_schedule($hook));
-        }
-
-        function test_schedule_event_single() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_single_event( $timestamp, $hook );
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // it's a non recurring event
-                $this-&gt;assertEquals( '', wp_get_schedule($hook) );
-
-        }
-
-        function test_schedule_event_single_args() {
-                // schedule an event with arguments and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-                $args = array(rand_str());
-
-                wp_schedule_single_event( $timestamp, $hook, $args );
-                // this returns the timestamp only if we provide matching args
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
-                $this-&gt;assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                // it's a non recurring event
-                $this-&gt;assertEquals( '', wp_get_schedule($hook, $args) );
-        }
-
-        function test_schedule_event() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $recur = 'hourly';
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_event( $timestamp, $recur, $hook );
-                // it's scheduled for the right time
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
-                // it's a recurring event
-                $this-&gt;assertEquals( $recur, wp_get_schedule($hook) );
-        }
-
-        function test_schedule_event_args() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-                $recur = 'hourly';
-                $args = array(rand_str());
-
-                wp_schedule_event( $timestamp, 'hourly', $hook, $args );
-                // this returns the timestamp only if we provide matching args
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
-                $this-&gt;assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                $this-&gt;assertEquals( $recur, wp_get_schedule($hook, $args) );
-
-        }
-
-        function test_unschedule_event() {
-                // schedule an event and make sure it's returned by wp_next_scheduled
-                $hook = rand_str();
-                $timestamp = strtotime('+1 hour');
-
-                wp_schedule_single_event( $timestamp, $hook );
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // now unschedule it and make sure it's gone
-                wp_unschedule_event( $timestamp, $hook );
-                $this-&gt;assertEquals( false, wp_next_scheduled($hook) );
-        }
-
-        function test_clear_schedule() {
-                $hook = rand_str();
-                $args = array(rand_str());
-
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-
-                // make sure they're returned by wp_next_scheduled()
-                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this-&gt;assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array
-                wp_clear_scheduled_hook($hook, $args[0]);
-                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
-        }
-
-        function test_clear_schedule_multiple_args() {
-                $hook = rand_str();
-                $args = array(rand_str(), rand_str());
-
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-
-                // make sure they're returned by wp_next_scheduled()
-                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this-&gt;assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // note: wp_clear_scheduled_hook() used to expect args passed directly, rather than as an array pre WP 3.0
-                wp_clear_scheduled_hook($hook, $args[0], $args[1]);
-                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
-        }
-
-        /**
-         * @ticket 10468
-         */
-        function test_clear_schedule_new_args() {
-                $hook = rand_str();
-                $args = array(rand_str());
-                $multi_hook = rand_str();
-                $multi_args = array(rand_str(), rand_str());
-
-                // schedule several events with and without arguments
-                wp_schedule_single_event( strtotime('+1 hour'), $hook );
-                wp_schedule_single_event( strtotime('+2 hour'), $hook );
-                wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
-                wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
-                wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
-
-                // make sure they're returned by wp_next_scheduled()
-                $this-&gt;assertTrue( wp_next_scheduled($hook) &gt; 0 );
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this-&gt;assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this-&gt;assertTrue( wp_next_scheduled($hook, $args) &gt; 0 );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // wp_clear_scheduled_hook() should take args as an array like the other functions.
-                wp_clear_scheduled_hook($hook, $args);
-                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
-
-                // clear the schedule for the args events and make sure they're gone too
-                // wp_clear_scheduled_hook() should take args as an array like the other functions and does from WP 3.0
-                wp_clear_scheduled_hook($multi_hook, $multi_args);
-                $this-&gt;assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
-
-        }
-
-        /**
-         * @ticket 6966
-         */
-        function test_duplicate_event() {
-                // duplicate events close together should be skipped
-                $hook = rand_str();
-                $args = array(rand_str());
-                $ts1 = strtotime('+5 minutes');
-                $ts2 = strtotime('+3 minutes');
-
-                // first one works
-                wp_schedule_single_event( $ts1, $hook, $args );
-                // second one is ignored
-                wp_schedule_single_event( $ts2, $hook, $args );
-
-                // the next event should be at +5 minutes, not +3
-                $this-&gt;assertEquals( $ts1, wp_next_scheduled($hook, $args) );
-        }
-
-        /**
-         * @ticket 6966
-         */
-        function test_not_duplicate_event() {
-                // duplicate events far apart should work normally
-                $hook = rand_str();
-                $args = array(rand_str());
-                $ts1 = strtotime('+30 minutes');
-                $ts2 = strtotime('+3 minutes');
-
-                // first one works
-                wp_schedule_single_event( $ts1, $hook, $args );
-                // second works too
-                wp_schedule_single_event( $ts2, $hook, $args );
-
-                // the next event should be at +5 minutes, not +3
-                $this-&gt;assertEquals( $ts2, wp_next_scheduled($hook, $args) );
-                wp_unschedule_event( $ts2, $hook, $args );
-                // following event should be there too
-                $this-&gt;assertEquals( $ts1, wp_next_scheduled($hook, $args) );
-        }
-}
-
-/*
- * Disable the WP Cron running test for the moment as it kills the whole test suite.
- * TODO - Fix it to work with the new cron implementation in trunk
- *
-class WPTestCronRunning extends _WPEmptyBlog {
-        function setUp() {
-                parent::setUp();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                // make sure the schedule is clear
-                _set_cron_array(array());
-        }
-        function _do_cron() {
-                // FIXME: wp-cron.php is difficult to test, could be wrapped in a function
-                $_GET['check'] = wp_hash('187425');
-                require(ABSPATH.'/wp-cron.php');
-        }
-
-        function test_run_schedule_single() {
-                // schedule an event, run it, and make sure the hook is called
-                $hook = rand_str();
-                $args = array(rand_str());
-                $timestamp = strtotime('-1 second');
-
-                // register a test action
-                $a = new MockAction();
-                add_action($hook, array(&amp;$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_single_event( $timestamp, $hook, $args );
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-
-                // run cron jobs
-                $this-&gt;_do_cron();
-
-                // our action should have been called once with the correct args
-                $this-&gt;assertEquals( 1, $a-&gt;get_call_count() );
-                $this-&gt;assertEquals( array($args), $a-&gt;get_args() );
-
-                // it shouldn't appear in the schedule anymore
-                $this-&gt;assertFalse( wp_next_scheduled($hook, $args) );
-
-        }
-
-        function test_run_schedule_recurring() {
-                // schedule a recurring event, run it, and make sure the hook is called
-                $hook = rand_str();
-                $args = array(rand_str());
-                $timestamp = strtotime('-1 second');
-                $recur = 'hourly';
-
-                // register a test action
-                $a = new MockAction();
-                add_action($hook, array(&amp;$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_event( $timestamp, $recur, $hook, $args );
-                $this-&gt;assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                $this-&gt;assertEquals( $recur, wp_get_schedule($hook, $args) );
-
-                // run cron jobs
-                $this-&gt;_do_cron();
-
-                // our action should have been called once with the correct args
-                $this-&gt;assertEquals( 1, $a-&gt;get_call_count() );
-                $this-&gt;assertEquals( array($args), $a-&gt;get_args() );
-
-                // it should appear in the schedule to run again in an hour's time
-                $this-&gt;assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
-
-        }
-}
-*/
</del></span></pre></div>
<a id="trunkteststest_dbphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_db.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_db.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_db.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,81 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test WPDB methods
- *
- * @group wpdb
- */
-class TestWPDB extends WP_UnitTestCase {
-
-        /**
-         * Query log
-         * @var array
-         */
-        protected $_queries = array();
-
-        /**
-         * Set up the test fixture
-         */
-        public function setUp() {
-                parent::setUp();
-                $this-&gt;_queries = array();
-                add_filter( 'query', array( $this, 'query_filter' ) );
-        }
-
-        /**
-         * Tear down the test fixture
-         */
-        public function tearDown() {
-                parent::tearDown();
-                remove_filter( 'query', array( $this, 'query_filter' ) );
-        }
-
-        /**
-         * Log each query
-         * @param string $sql
-         * @return string
-         */
-        public function query_filter( $sql ) {
-                $this-&gt;_queries[] = $sql;
-                return $sql;
-        }
-
-        /**
-         * Test that floats formatted as &quot;0,700&quot; get sanitized properly by wpdb
-         * @global mixed $wpdb
-         *
-         * @ticket 19861
-         */
-        public function test_locale_floats() {
-                global $wpdb;
-
-                // Save the current locale
-                $current_locale = setlocale( LC_ALL, NULL );
-
-                // Switch to Russian
-                $flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES' );
-                if ( false === $flag )
-                        $this-&gt;markTestSkipped( 'No European languages available for testing' );
-
-                // Try an update query
-                $wpdb-&gt;suppress_errors( true );
-                $wpdb-&gt;update(
-                        'test_table',
-                        array( 'float_column' =&gt; 0.7 ),
-                        array( 'meta_id' =&gt; 5 ),
-                        array( '%f' ),
-                        array( '%d' )
-                );
-                $wpdb-&gt;suppress_errors( false );
-
-                // Ensure the float isn't 0,700
-                $this-&gt;assertContains( '0.700', array_pop( $this-&gt;_queries ) );
-
-                // Try a prepare
-                $sql = $wpdb-&gt;prepare( &quot;UPDATE test_table SET float_column = %f AND meta_id = %d&quot;, 0.7, 5 );
-                $this-&gt;assertContains( '0.700', $sql );
-
-                // Restore locale
-                setlocale( LC_ALL, $current_locale );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_filtersphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_filters.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_filters.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_filters.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,243 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test apply_filters() and related functions
- *
- * @group hooks
- */
-class WPTestFilters extends WP_UnitTestCase {
-
-        function test_simple_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter($tag, array(&amp;$a, 'filter'));
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-
-                // only one event occurred for the hook, with empty args
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                // only our hook was called
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                $args = array_pop($a-&gt;get_args());
-                $this-&gt;assertEquals(array($val), $args);
-        }
-
-        function test_remove_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter($tag, array(&amp;$a, 'filter'));
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter($tag, array(&amp;$a, 'filter'));
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-        }
-
-        function test_has_filter() {
-                        $tag = rand_str();
-                        $func = rand_str();
-
-                        $this-&gt;assertFalse( has_filter($tag, $func) );
-                        $this-&gt;assertFalse( has_filter($tag) );
-                        add_filter($tag, $func);
-                        $this-&gt;assertEquals( 10, has_filter($tag, $func) );
-                        $this-&gt;assertTrue( has_filter($tag) );
-                        remove_filter($tag, $func);
-                        $this-&gt;assertFalse( has_filter($tag, $func) );
-                        $this-&gt;assertFalse( has_filter($tag) );
-        }
-
-        // one tag with multiple filters
-        function test_multiple_filters() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                // add both filters to the hook
-                add_filter($tag, array(&amp;$a1, 'filter'));
-                add_filter($tag, array(&amp;$a2, 'filter'));
-
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-
-                // both filters called once each
-                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
-                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
-        }
-
-        function test_filter_args_1() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-                $arg1 = rand_str();
-
-                add_filter($tag, array(&amp;$a, 'filter'), 10, 2);
-                // call the filter with a single argument
-                $this-&gt;assertEquals($val, apply_filters($tag, $val, $arg1));
-
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val, $arg1), array_pop($a-&gt;get_args()));
-        }
-
-        function test_filter_args_2() {
-                $a1 = new MockAction();
-                $a2 = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-                $arg1 = rand_str();
-                $arg2 = rand_str();
-
-                // a1 accepts two arguments, a2 doesn't
-                add_filter($tag, array(&amp;$a1, 'filter'), 10, 3);
-                add_filter($tag, array(&amp;$a2, 'filter'));
-                // call the filter with two arguments
-                $this-&gt;assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
-
-                // a1 should be called with both args
-                $this-&gt;assertEquals(1, $a1-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val, $arg1, $arg2), array_pop($a1-&gt;get_args()));
-
-                // a2 should be called with one only
-                $this-&gt;assertEquals(1, $a2-&gt;get_call_count());
-                $this-&gt;assertEquals(array($val), array_pop($a2-&gt;get_args()));
-        }
-
-        function test_filter_priority() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                // make two filters with different priorities
-                add_filter($tag, array(&amp;$a, 'filter'), 10);
-                add_filter($tag, array(&amp;$a, 'filter2'), 9);
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-
-                // there should be two events, one per filter
-                $this-&gt;assertEquals(2, $a-&gt;get_call_count());
-
-                $expected = array (
-                        // filter2 is called first because it has priority 9
-                        array (
-                                'filter' =&gt; 'filter2',
-                                'tag' =&gt; $tag,
-                                'args' =&gt; array($val)
-                        ),
-                        // filter 1 is called second
-                        array (
-                                'filter' =&gt; 'filter',
-                                'tag' =&gt; $tag,
-                                'args' =&gt; array($val)
-                        ),
-                );
-
-                $this-&gt;assertEquals($expected, $a-&gt;get_events());
-        }
-
-        function test_all_filter() {
-                $a = new MockAction();
-                $tag1 = rand_str();
-                $tag2 = rand_str();
-                $val = rand_str();
-
-                // add an 'all' filter
-                add_filter('all', array(&amp;$a, 'filterall'));
-                // do some filters
-                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
-                $this-&gt;assertEquals($val, apply_filters($tag2, $val));
-                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
-                $this-&gt;assertEquals($val, apply_filters($tag1, $val));
-
-                // our filter should have been called once for each apply_filters call
-                $this-&gt;assertEquals(4, $a-&gt;get_call_count());
-                // the right hooks should have been called in order
-                $this-&gt;assertEquals(array($tag1, $tag2, $tag1, $tag1), $a-&gt;get_tags());
-
-                remove_filter('all', array(&amp;$a, 'filterall'));
-                $this-&gt;assertFalse( has_filter('all', array(&amp;$a, 'filterall')) );
-
-        }
-
-        function test_remove_all_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter('all', array(&amp;$a, 'filterall'));
-                $this-&gt;assertTrue( has_filter('all') );
-                $this-&gt;assertEquals( 10, has_filter('all', array(&amp;$a, 'filterall')) );
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter('all', array(&amp;$a, 'filterall'));
-                $this-&gt;assertFalse( has_filter('all', array(&amp;$a, 'filterall')) );
-                $this-&gt;assertFalse( has_filter('all') );
-                $this-&gt;assertEquals($val, apply_filters($tag, $val));
-                // call cound should remain at 1
-                $this-&gt;assertEquals(1, $a-&gt;get_call_count());
-                $this-&gt;assertEquals(array($tag), $a-&gt;get_tags());
-        }
-
-        /**
-         * @ticket 9886
-         */
-        function test_filter_ref_array() {
-                $obj = new stdClass();
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'filter'));
-
-                apply_filters_ref_array($tag, array(&amp;$obj));
-
-                $args = $a-&gt;get_args();
-                $this-&gt;assertSame($args[0][0], $obj);
-                // just in case we don't trust assertSame
-                $obj-&gt;foo = true;
-                $this-&gt;assertFalse( empty($args[0][0]-&gt;foo) );
-        }
-
-        /**
-         * @ticket 12723
-         */
-        function test_filter_ref_array_result() {
-                $obj = new stdClass();
-                $a = new MockAction();
-                $b = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&amp;$a, 'filter_append'), 10, 2);
-                add_action($tag, array(&amp;$b, 'filter_append'), 10, 2);
-
-                $result = apply_filters_ref_array($tag, array('string', &amp;$obj));
-
-                $this-&gt;assertEquals($result, 'string_append_append');
-
-                $args = $a-&gt;get_args();
-                $this-&gt;assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj-&gt;foo = true;
-                $this-&gt;assertFalse( empty($args[0][1]-&gt;foo) );
-
-                $args = $b-&gt;get_args();
-                $this-&gt;assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj-&gt;foo = true;
-                $this-&gt;assertFalse( empty($args[0][1]-&gt;foo) );
-
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_httpphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_http.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_http.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_http.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,267 +0,0 @@
</span><del>-&lt;?php
-/**
- * Note, When running these tests, remember that some things are done differently
- * based on safe_mode. You can run the test in safe_mode like such:
- *
- *   phpunit -d safe_mode=on --group http
- *
- * You may also need `-d safe_mode_gid=1` to relax the safe_mode checks to allow
- * inclusion of PEAR.
- *
- * The WP_HTTP tests require a class-http.php file of r17550 or later.
- */
-
-/**
- * @group http
- */
-abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
-        // You can use your own version of data/WPHTTP-testcase-redirection-script.php here.
-        var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
-
-        function setUp() {
-
-                if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
-                        $this-&gt;markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
-                        return;
-                }
-
-                $class = &quot;WP_HTTP_&quot; . $this-&gt;transport;
-                if ( !call_user_func( array($class, 'test') ) ) {
-                        $this-&gt;markTestSkipped( sprintf('The transport %s is not supported on this system', $this-&gt;transport) );
-                }
-
-                // Disable all transports aside from this one.
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( &quot;use_{$t}_transport&quot;, '__return_false' ); // Just strip them all
-                        if ( $t != $this-&gt;transport )
-                                add_filter( &quot;use_{$t}_transport&quot;, '__return_false' ); // and add it back if need be..
-                }
-        }
-
-        function tearDown() {
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( &quot;use_{$t}_transport&quot;, '__return_false' );
-                }
-        }
-
-        function test_redirect_on_301() {
-                // 5 : 5 &amp; 301
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=301&amp;rt=' . 5, array('redirection' =&gt; 5) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        function test_redirect_on_302() {
-                // 5 : 5 &amp; 302
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 5) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_301_no_redirect() {
-                // 5 &gt; 0 &amp; 301
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=301&amp;rt=' . 5, array('redirection' =&gt; 0) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals(301, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_302_no_redirect() {
-                // 5 &gt; 0 &amp; 302
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 0) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals(302, (int)$res['response']['code'] );
-        }
-
-        function test_redirections_equal() {
-                // 5 - 5
-                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 5, array('redirection' =&gt; 5) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        function test_no_head_redirections() {
-                // No redirections on HEAD request:
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 1, array('method' =&gt; 'HEAD') );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals( 302, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_head() {
-                // Redirections on HEAD request when Requested
-                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 5, array('redirection' =&gt; 5, 'method' =&gt; 'HEAD') );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals( 200, (int)$res['response']['code'] );
-        }
-
-        function test_redirections_greater() {
-                // 10 &gt; 5
-                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 10, array('redirection' =&gt; 5) );
-                $this-&gt;assertTrue( is_wp_error($res), print_r($res, true) );
-        }
-
-        function test_redirections_greater_edgecase() {
-                // 6 &gt; 5 (close edgecase)
-                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 6, array('redirection' =&gt; 5) );
-                $this-&gt;assertTrue( is_wp_error($res) );
-        }
-
-        function test_redirections_less_edgecase() {
-                // 4 &lt; 5 (close edgecase)
-                $res = wp_remote_request($this-&gt;redirection_script . '?rt=' . 4, array('redirection' =&gt; 5) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirections_zero_redirections_specified() {
-                // 0 redirections asked for, Should return the document?
-                $res = wp_remote_request($this-&gt;redirection_script . '?code=302&amp;rt=' . 5, array('redirection' =&gt; 0) );
-                $this-&gt;assertFalse( is_wp_error($res) );
-                $this-&gt;assertEquals( 302, (int)$res['response']['code'] );
-        }
-
-        /**
-         * Do not redirect on non 3xx status codes
-         *
-         * @ticket 16889
-         *
-         * Is this valid? Streams, cURL and therefore PHP Extension (ie. all PHP Internal) follow redirects
-         * on all status codes, currently all of WP_HTTP follows this template.
-         */
-        function test_location_header_on_200() {
-                // Prints PASS on initial load, FAIL if the client follows the specified redirection
-                $res = wp_remote_request( $this-&gt;redirection_script . '?200-location=true' );
-                $this-&gt;assertEquals( 'PASS', $res['body']);
-        }
-
-        /**
-         * @ticket 11888
-         */
-        function test_send_headers() {
-                // Test that the headers sent are recieved by the server
-                $headers = array('test1' =&gt; 'test', 'test2' =&gt; 0, 'test3' =&gt; '');
-                $res = wp_remote_request( $this-&gt;redirection_script . '?header-check', array('headers' =&gt; $headers) );
-
-                $this-&gt;assertFalse( is_wp_error($res) );
-
-                $headers = array();
-                foreach ( explode(&quot;\n&quot;, $res['body']) as $key =&gt; $value ) {
-                        if ( empty($value) )
-                                continue;
-                        $parts = explode(':', $value,2);
-                        unset($heaers[$key]);
-                        $headers[ $parts[0] ] = $parts[1];
-                }
-
-                $this-&gt;assertTrue( isset($headers['test1']) &amp;&amp; 'test' == $headers['test1'] );
-                $this-&gt;assertTrue( isset($headers['test2']) &amp;&amp; '0' === $headers['test2'] );
-                // cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value.
-                // Should it be that empty headers with empty values are NOT sent?
-                //$this-&gt;assertTrue( isset($headers['test3']) &amp;&amp; '' === $headers['test3'] );
-        }
-
-        function test_file_stream() {
-                $url = 'http://unit-tests.svn.wordpress.org/trunk/data/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
-                $size = 87348;
-                $res = wp_remote_request( $url, array( 'stream' =&gt; true, 'timeout' =&gt; 30 ) ); //Auto generate the filename.
-
-                $this-&gt;assertFalse( is_wp_error( $res ) );
-                $this-&gt;assertEquals( '', $res['body'] ); // The body should be empty.
-                $this-&gt;assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
-                $this-&gt;assertEquals( $size, filesize($res['filename']) ); // Check that the file is written to disk correctly without any extra characters
-
-                unlink($res['filename']); // Remove the temporary file
-        }
-}
-
-// Stubs to test each transport
-/**
- * @group http
- */
-class WPHTTP_curl extends WP_HTTP_UnitTestCase {
-        var $transport = 'curl';
-}
-/**
- * @group http
- */
-class WPHTTP_streams extends WP_HTTP_UnitTestCase {
-        var $transport = 'streams';
-}
-/**
- * @group http
- */
-class WPHTTP_fsockopen extends WP_HTTP_UnitTestCase {
-        var $transport = 'fsockopen';
-}
-
-/**
- * Non-transport-specific WP_HTTP Tests
- *
- * @group http
- */
-class WPHTTP extends WP_UnitTestCase {
-
-        /**
-         * @dataProvider make_absolute_url_testcases
-         */
-        function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
-                if ( ! is_callable( array( 'WP_HTTP', 'make_absolute_url' ) ) ) {
-                        $this-&gt;markTestSkipped( &quot;This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()&quot; );
-                        return;
-                }
-
-                $actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
-                $this-&gt;assertEquals( $expected, $actual );
-        }
-
-        function make_absolute_url_testcases() {
-                // 0: The Location header, 1: The current url, 3: The expected url
-                return array(
-                        array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ), // Absolute URL provided
-                        array( '/location', '', '/location' ), // No current url provided
-
-                        array( '', 'http://example.com', 'http://example.com/' ), // No location provided
-
-                        // Location provided relative to site root
-                        array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ),
-                        array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ),
-
-                        // Location provided relative to current file/directory
-                        array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ),
-                        array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ),
-                        array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ),
-
-                        // Location provided relative to current file/directory but in a parent directory
-                        array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ),
-                        array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ),
-                        array( '../file-in-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-parent.ext' ),
-                        array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ),
-
-                        // Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT)
-                        array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ),
-                        array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ),
-                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-grand-parent.ext' ),
-                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory/filename/', 'http://example.com/file-in-grand-parent.ext' ),
-                        array( '../../file-in-grand-parent.ext', 'http://example.com/directory1/directory2/filename', 'http://example.com/file-in-grand-parent.ext' ),
-
-                        // Query strings should attach, or replace existing query string.
-                        array( '?query=string', 'http://example.com', 'http://example.com/?query=string' ),
-                        array( '?query=string', 'http://example.com/file.ext', 'http://example.com/file.ext?query=string' ),
-                        array( '?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/file.ext?query=string' ),
-                        array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ),
-
-                        // A file with a leading dot
-                        array( '.ext', 'http://example.com/', 'http://example.com/.ext' )
-                );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_admin_barphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_admin_bar.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_admin_bar.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_admin_bar.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group admin-bar
- * @group toolbar
- * @group admin
- */
-class TestWPAdminBar extends WP_UnitTestCase {
-
-        static function setUpBeforeClass() {
-                WP_UnitTestCase::setUpBeforeClass();
-                require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
-        }
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;current_user = get_current_user_id();
-                wp_set_current_user( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
-        }
-
-        function tearDown() {
-                wp_set_current_user( $this-&gt;current_user );
-                parent::tearDown();
-        }
-
-        /**
-         * @ticket 21117
-         */
-        function test_content_post_type() {
-                register_post_type( 'content', array( 'show_in_admin_bar' =&gt; true ) );
-
-                $admin_bar = new WP_Admin_Bar;
-
-                wp_admin_bar_new_content_menu( $admin_bar );
-
-                $nodes = $admin_bar-&gt;get_nodes();
-                $this-&gt;assertFalse( $nodes['new-content']-&gt;parent );
-                $this-&gt;assertEquals( 'new-content', $nodes['add-new-content']-&gt;parent );
-
-                _unregister_post_type( 'content' );
-        }
-
-        /**
-         * @ticket 21117
-         */
-        function test_merging_existing_meta_values() {
-                $admin_bar = new WP_Admin_Bar;
-
-                $admin_bar-&gt;add_node( array(
-                        'id' =&gt; 'test-node',
-                        'meta' =&gt; array( 'class' =&gt; 'test-class' ),
-                ) );
-                $node = $admin_bar-&gt;get_node( 'test-node' );
-                $this-&gt;assertEquals( array( 'class' =&gt; 'test-class' ), $node-&gt;meta );
-
-                $admin_bar-&gt;add_node( array(
-                        'id' =&gt; 'test-node',
-                        'meta' =&gt; array( 'some-meta' =&gt; 'value' ),
-                ) );
-
-                $node = $admin_bar-&gt;get_node( 'test-node' );
-                $this-&gt;assertEquals( array( 'class' =&gt; 'test-class', 'some-meta' =&gt; 'value' ), $node-&gt;meta );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_includes_authorphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_author.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_author.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_author.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test functions in wp-includes/author.php, author-template.php
- *
- * @group author
- * @group user
- */
-class TestWPAuthor extends WP_UnitTestCase {
-        protected $old_post_id = 0;
-        protected $author_id = 0;
-        protected $post_id = 0;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array(
-                        'role' =&gt; 'author',
-                        'user_login' =&gt; 'test_author',
-                        'description' =&gt; 'test_author',
-                ) );
-                $user = new WP_User( $this-&gt;author_id );
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_type' =&gt; 'post'
-                );
-
-                // insert a post and make sure the ID is ok
-                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create( $post );
-
-                setup_postdata( get_post( $this-&gt;post_id ) );
-        }
-
-        function tearDown() {
-                wp_reset_postdata();
-                parent::tearDown();
-        }
-
-        function test_get_the_author() {
-                $author_name = get_the_author();
-                $user = new WP_User( $this-&gt;author_id );
-
-                $this-&gt;assertEquals( $user-&gt;display_name, $author_name );
-                $this-&gt;assertEquals( 'test_author', $author_name );
-        }
-
-        function test_get_the_author_meta() {
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'login' ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
-
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                add_user_meta( $this-&gt;author_id, 'user_description', 'user description' );
-                $this-&gt;assertEquals( 'user description', get_user_meta( $this-&gt;author_id, 'user_description', true ) );
-                // user_description in meta is ignored. The content of description is returned instead.
-                // See #20285
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-                update_user_meta( $this-&gt;author_id, 'user_description', '' );
-                $this-&gt;assertEquals( '', get_user_meta( $this-&gt;author_id, 'user_description', true ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-
-                $this-&gt;assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
-        }
-
-        function test_get_the_author_meta_no_authordata() {
-                unset( $GLOBALS['authordata'] );
-                $this-&gt;assertEquals( '', get_the_author_meta( 'id' ) );
-                $this-&gt;assertEquals( '', get_the_author_meta( 'user_login' ) );
-                $this-&gt;assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_includes_balance_tagsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_balance_tags.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_balance_tags.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_balance_tags.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,226 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group formatting
- */
-class TestBalanceTags extends WP_UnitTestCase {
-
-        // These are single/self-closing tags that WP has traditionally recognized.
-        var $basic_single_tags = array( 'br', 'hr', 'img', 'input' );
-
-        // This is a complete(?) listing of valid single/self-closing tags.
-        var $single_tags = array(
-                'area', 'base', 'basefont', 'br', 'col', 'command',
-                'embed', 'frame', 'hr', 'img', 'input', 'isindex',
-                'link', 'meta', 'param', 'source' );
-
-        // Tags that can be directly nested within themselves, i.e. &lt;div&gt;&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;
-        var $nestable_tags = array( 'blockquote', 'div', 'q', 'span' );
-        // Use this instead if/when #20401 gets fixed
-        //var $nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
-
-        // These are single tags WP has traditionally properly handled
-        // This test can be removed if #1597 is fixed and the next test passes, as
-        //   it supercedes this test.
-        function test_selfcloses_unclosed_basic_known_single_tags() {
-                foreach ( $this-&gt;basic_single_tags as $tag ) {
-                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&quot;, true ) );
-                }
-        }
-
-        /**
-         * If a recognized valid single tag appears unclosed, it should get self-closed
-         *
-         * @ticket 1597
-         */
-        function test_selfcloses_unclosed_known_single_tags() {
-
-                foreach ( $this-&gt;single_tags as $tag ) {
-                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&quot;, true ) );
-                }
-        }
-
-        // These are single tags WP has traditionally properly handled
-        // This test can be removed if #1597 is fixed and the next test passes, as
-        //   it supercedes this test.
-        function test_selfcloses_basic_known_single_tags_having_closing_tag() {
-                foreach ( $this-&gt;basic_single_tags as $tag ) {
-                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&lt;/$tag&gt;&quot;, true ) );
-                }
-        }
-
-        /**
-         * If a recognized valid single tag is given a closing tag, the closing tag
-         *   should get removed and tag should be self-closed.
-         *
-         * @ticket 1597
-         */
-        function test_selfcloses_known_single_tags_having_closing_tag() {
-
-                foreach ( $this-&gt;single_tags as $tag ) {
-                        $this-&gt;assertEquals( &quot;&lt;$tag /&gt;&quot;, balanceTags( &quot;&lt;$tag&gt;&lt;/$tag&gt;&quot;, true ) );
-                }
-        }
-
-        /**
-         * @ticket 1597
-         */
-        function test_closes_unknown_single_tags_with_closing_tag() {
-
-                $inputs = array(
-                        '&lt;strong/&gt;',
-                        '&lt;em /&gt;',
-                        '&lt;p class=&quot;main1&quot;/&gt;',
-                        '&lt;p class=&quot;main2&quot; /&gt;',
-                );
-                $expected = array(
-                        '&lt;strong&gt;&lt;/strong&gt;',
-                        '&lt;em&gt;&lt;/em&gt;',
-                        '&lt;p class=&quot;main1&quot;&gt;&lt;/p&gt;',
-                        '&lt;p class=&quot;main2&quot;&gt;&lt;/p&gt;',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_closes_unclosed_single_tags_having_attributes() {
-                $inputs = array(
-                        '&lt;img src=&quot;/images/example.png&quot;&gt;',
-                        '&lt;input type=&quot;text&quot; name=&quot;example&quot;&gt;'
-                );
-                $expected = array(
-                        '&lt;img src=&quot;/images/example.png&quot;/&gt;',
-                        '&lt;input type=&quot;text&quot; name=&quot;example&quot;/&gt;'
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_allows_validly_closed_single_tags() {
-                $inputs = array(
-                        '&lt;br /&gt;',
-                        '&lt;hr /&gt;',
-                        '&lt;img src=&quot;/images/example.png&quot; /&gt;',
-                        '&lt;input type=&quot;text&quot; name=&quot;example&quot; /&gt;'
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_balances_nestable_tags() {
-                $inputs = array(
-                        '&lt;q&gt;Test&lt;q&gt;Test&lt;/q&gt;',
-                        '&lt;div&gt;&lt;div&gt;Test',
-                        '&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;',
-                );
-                $expected = array(
-                        '&lt;q&gt;Test&lt;q&gt;Test&lt;/q&gt;&lt;/q&gt;',
-                        '&lt;div&gt;&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;',
-                        '&lt;div&gt;Test&lt;/div&gt;',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_allows_adjacent_nestable_tags() {
-                $inputs = array(
-                        '&lt;blockquote&gt;&lt;blockquote&gt;Example quote&lt;/blockquote&gt;&lt;/blockquote&gt;',
-                        '&lt;div class=&quot;container&quot;&gt;&lt;div&gt;This is allowed&gt;&lt;/div&gt;&lt;/div&gt;',
-                        '&lt;span&gt;&lt;span&gt;&lt;span&gt;Example in spans&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;',
-                        '&lt;blockquote&gt;Main quote&lt;blockquote&gt;Example quote&lt;/blockquote&gt; more text&lt;/blockquote&gt;',
-                        '&lt;q&gt;&lt;q class=&quot;inner-q&quot;&gt;Inline quote&lt;/q&gt;&lt;/q&gt;',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        /**
-         * @ticket 20401
-         */
-        function test_allows_immediately_nested_object_tags() {
-
-                $object = '&lt;object id=&quot;obj1&quot;&gt;&lt;param name=&quot;param1&quot;/&gt;&lt;object id=&quot;obj2&quot;&gt;&lt;param name=&quot;param2&quot;/&gt;&lt;/object&gt;&lt;/object&gt;';
-                $this-&gt;assertEquals( $object, balanceTags( $object, true ) );
-        }
-
-        function test_balances_nested_non_nestable_tags() {
-                $inputs = array(
-                        '&lt;b&gt;&lt;b&gt;This is bold&lt;/b&gt;&lt;/b&gt;',
-                        '&lt;b&gt;Some text here &lt;b&gt;This is bold&lt;/b&gt;&lt;/b&gt;',
-                );
-                $expected = array(
-                        '&lt;b&gt;&lt;/b&gt;&lt;b&gt;This is bold&lt;/b&gt;',
-                        '&lt;b&gt;Some text here &lt;/b&gt;&lt;b&gt;This is bold&lt;/b&gt;',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_fixes_improper_closing_tag_sequence() {
-                $inputs = array(
-                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;bold &lt;em&gt;and emphasis&lt;/p&gt;&lt;/em&gt;&lt;/strong&gt;',
-                        '&lt;ul&gt;&lt;li&gt;Aaa&lt;/li&gt;&lt;li&gt;Bbb&lt;/ul&gt;&lt;/li&gt;',
-                );
-                $expected = array(
-                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;bold &lt;em&gt;and emphasis&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;',
-                        '&lt;ul&gt;&lt;li&gt;Aaa&lt;/li&gt;&lt;li&gt;Bbb&lt;/li&gt;&lt;/ul&gt;',
-                );
-
-                foreach ($inputs as $key =&gt; $input) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_adds_missing_closing_tags() {
-                $inputs = array(
-                        '&lt;b&gt;&lt;i&gt;Test&lt;/b&gt;',
-                        '&lt;p&gt;Test',
-                        '&lt;p&gt;Test test&lt;/em&gt; test&lt;/p&gt;',
-                        '&lt;/p&gt;Test',
-                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;Test&lt;/p&gt;',
-                );
-                $expected = array(
-                        '&lt;b&gt;&lt;i&gt;Test&lt;/i&gt;&lt;/b&gt;',
-                        '&lt;p&gt;Test&lt;/p&gt;',
-                        '&lt;p&gt;Test test test&lt;/p&gt;',
-                        'Test',
-                        '&lt;p&gt;Here is a &lt;strong class=&quot;part&quot;&gt;Test&lt;/strong&gt;&lt;/p&gt;',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_removes_extraneous_closing_tags() {
-                $inputs = array(
-                        '&lt;b&gt;Test&lt;/b&gt;&lt;/b&gt;',
-                        '&lt;div&gt;Test&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Test',
-                        '&lt;p&gt;Test test&lt;/em&gt; test&lt;/p&gt;',
-                        '&lt;/p&gt;Test',
-                );
-                $expected = array(
-                        '&lt;b&gt;Test&lt;/b&gt;',
-                        '&lt;div&gt;Test&lt;/div&gt;&lt;div&gt;Test&lt;/div&gt;',
-                        '&lt;p&gt;Test test test&lt;/p&gt;',
-                        'Test',
-                );
-
-                foreach ( $inputs as $key =&gt; $input ) {
-                        $this-&gt;assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_cachephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_cache.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_cache.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_cache.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,151 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group cache
- */
-class TestObjectCache extends WP_UnitTestCase {
-        var $cache = NULL;
-
-        function setUp() {
-                parent::setUp();
-                // create two cache objects with a shared cache dir
-                // this simulates a typical cache situation, two separate requests interacting
-                $this-&gt;cache =&amp; $this-&gt;init_cache();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $this-&gt;flush_cache();
-        }
-
-        function &amp;init_cache() {
-                $cache = new WP_Object_Cache();
-                return $cache;
-        }
-
-        function test_miss() {
-                $this-&gt;assertEquals(NULL, $this-&gt;cache-&gt;get(rand_str()));
-        }
-
-        function test_add_get() {
-                $key = rand_str();
-                $val = rand_str();
-
-                $this-&gt;cache-&gt;add($key, $val);
-                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
-        }
-
-        function test_add_get_0() {
-                $key = rand_str();
-                $val = 0;
-
-                // you can store zero in the cache
-                $this-&gt;cache-&gt;add($key, $val);
-                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
-        }
-
-        function test_add_get_null() {
-                $key = rand_str();
-                $val = null;
-
-                $this-&gt;assertTrue( $this-&gt;cache-&gt;add($key, $val) );
-                // null is converted to empty string
-                $this-&gt;assertEquals( '', $this-&gt;cache-&gt;get($key) );
-        }
-
-        function test_add() {
-                $key = rand_str();
-                $val1 = rand_str();
-                $val2 = rand_str();
-
-                // add $key to the cache
-                $this-&gt;assertTrue($this-&gt;cache-&gt;add($key, $val1));
-                $this-&gt;assertEquals($val1, $this-&gt;cache-&gt;get($key));
-                // $key is in the cache, so reject new calls to add()
-                $this-&gt;assertFalse($this-&gt;cache-&gt;add($key, $val2));
-                $this-&gt;assertEquals($val1, $this-&gt;cache-&gt;get($key));
-        }
-
-        function test_replace() {
-                $key = rand_str();
-                $val = rand_str();
-
-                // memcached rejects replace() if the key does not exist
-                $this-&gt;assertFalse($this-&gt;cache-&gt;replace($key, $val));
-                $this-&gt;assertFalse($this-&gt;cache-&gt;get($key));
-        }
-
-        function test_set() {
-                $key = rand_str();
-                $val = rand_str();
-
-                // memcached accepts set() if the key does not exist
-                $this-&gt;assertTrue($this-&gt;cache-&gt;set($key, $val));
-                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
-        }
-
-        function test_flush() {
-                $key = rand_str();
-                $val = rand_str();
-
-                $this-&gt;cache-&gt;add($key, $val);
-                // item is visible to both cache objects
-                $this-&gt;assertEquals($val, $this-&gt;cache-&gt;get($key));
-                $this-&gt;cache-&gt;flush();
-                // If there is no value get returns false.
-                $this-&gt;assertFalse($this-&gt;cache-&gt;get($key));
-        }
-
-        // Make sure objects are cloned going to and from the cache
-        function test_object_refs() {
-                $key = rand_str();
-                $object_a = new stdClass;
-                $object_a-&gt;foo = 'alpha';
-                $this-&gt;cache-&gt;set( $key, $object_a );
-                $object_a-&gt;foo = 'bravo';
-                $object_b = $this-&gt;cache-&gt;get( $key );
-                $this-&gt;assertEquals( 'alpha', $object_b-&gt;foo );
-                $object_b-&gt;foo = 'charlie';
-                $this-&gt;assertEquals( 'bravo', $object_a-&gt;foo );
-
-                $key = rand_str();
-                $object_a = new stdClass;
-                $object_a-&gt;foo = 'alpha';
-                $this-&gt;cache-&gt;add( $key, $object_a );
-                $object_a-&gt;foo = 'bravo';
-                $object_b = $this-&gt;cache-&gt;get( $key );
-                $this-&gt;assertEquals( 'alpha', $object_b-&gt;foo );
-                $object_b-&gt;foo = 'charlie';
-                $this-&gt;assertEquals( 'bravo', $object_a-&gt;foo );
-        }
-
-        function test_incr() {
-                $key = rand_str();
-
-                $this-&gt;assertFalse( $this-&gt;cache-&gt;incr( $key ) );
-
-                $this-&gt;cache-&gt;set( $key, 0 );
-                $this-&gt;cache-&gt;incr( $key );
-                $this-&gt;assertEquals( 1, $this-&gt;cache-&gt;get( $key ) );
-
-                $this-&gt;cache-&gt;incr( $key, 2 );
-                $this-&gt;assertEquals( 3, $this-&gt;cache-&gt;get( $key ) );
-        }
-
-        function test_decr() {
-                $key = rand_str();
-
-                $this-&gt;assertFalse( $this-&gt;cache-&gt;decr( $key ) );
-
-                $this-&gt;cache-&gt;set( $key, 0 );
-                $this-&gt;cache-&gt;decr( $key );
-                $this-&gt;assertEquals( 0, $this-&gt;cache-&gt;get( $key ) );
-
-                $this-&gt;cache-&gt;set( $key, 3 );
-                $this-&gt;cache-&gt;decr( $key );
-                $this-&gt;assertEquals( 2, $this-&gt;cache-&gt;get( $key ) );
-
-                $this-&gt;cache-&gt;decr( $key, 2 );
-                $this-&gt;assertEquals( 0, $this-&gt;cache-&gt;get( $key ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_canonicalphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_canonical.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_canonical.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_canonical.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,380 +0,0 @@
</span><del>-&lt;?php
-/**
- * Tests Canonical redirections.
- *
- * In the process of doing so, it also tests WP, WP_Rewrite and WP_Query, A fail here may show a bug in any one of these areas.
- *
- * @group canonical
- * @group rewrite
- * @group query
- */
-class WP_Test_Canonical extends WP_UnitTestCase {
-
-        // This can be defined in a subclass of this class which contains it's own data() method, those tests will be run against the specified permastruct
-        var $structure = '/%year%/%monthnum%/%day%/%postname%/';
-
-        var $old_current_user;
-        var $author_id;
-        var $post_ids;
-        var $term_ids;
-
-        function setUp() {
-                parent::setUp();
-
-                update_option( 'comments_per_page', 5 );
-                update_option( 'posts_per_page', 5 );
-
-                update_option( 'permalink_structure', $this-&gt;structure );
-                create_initial_taxonomies();
-                $GLOBALS['wp_rewrite']-&gt;init();
-                flush_rewrite_rules();
-
-                $this-&gt;old_current_user = get_current_user_id();
-                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'canonical-author' ) );
-                wp_set_current_user( $this-&gt;author_id );
-
-                // Already created by install defaults:
-                // $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'uncategorized' ) );
-
-                $this-&gt;term_ids = array();
-
-                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 587, 'post_title' =&gt; 'post-format-test-audio', 'post_date' =&gt; '2008-06-02 00:00:00' ) );
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'post-format-test-gallery', 'post_date' =&gt; '2008-06-10 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 611, 'post_type' =&gt; 'attachment', 'post_title' =&gt; 'canola2', 'post_parent' =&gt; $post_id ) );
-
-                $this-&gt;factory-&gt;post-&gt;create( array(
-                        'post_title' =&gt; 'images-test',
-                        'post_date' =&gt; '2008-09-03 00:00:00',
-                        'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2 &lt;!--nextpage--&gt; Page 3'
-                ) );
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 149, 'post_title' =&gt; 'comment-test', 'post_date' =&gt; '2008-03-03 00:00:00' ) );
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 15 );
-
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2008-09-05 00:00:00' ) );
-
-                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 123 ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 1 ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'import_id' =&gt; 358 ) );
-
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'sample-page' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about' ) );
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $this-&gt;factory-&gt;post-&gt;create(
-                        array( 'import_id' =&gt; 144, 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $post_id,
-                ) );
-
-                $this-&gt;term_ids['/category/parent/'] = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'parent' ) );
-                $this-&gt;term_ids['/category/parent/child-1/'] = $this-&gt;factory-&gt;term-&gt;create( array(
-                        'taxonomy' =&gt; 'category', 'name' =&gt; 'child-1', 'parent' =&gt; $this-&gt;term_ids['/category/parent/'],
-                ) );
-                $this-&gt;term_ids['/category/parent/child-1/child-2/'] = $this-&gt;factory-&gt;term-&gt;create( array(
-                        'taxonomy' =&gt; 'category', 'name' =&gt; 'child-2', 'parent' =&gt; $this-&gt;term_ids['/category/parent/child-1/'],
-                ) );
-
-                $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-a' ) );
-                $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-b' ) );
-
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'post-formats' ) );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                wp_set_current_user( $this-&gt;old_current_user );
-
-                $GLOBALS['wp_rewrite']-&gt;init();
-        }
-
-        // URL's are relative to the site &quot;front&quot;, ie. /category/uncategorized/ instead of http://site.../category..
-        // Return url's are full url's with the prepended home.
-        function get_canonical($test_url) {
-                $test_url = home_url( $test_url );
-
-                $can_url = redirect_canonical( $test_url, false );
-                if ( ! $can_url )
-                        return $test_url; // No redirect will take place for this request
-
-                return $can_url;
-        }
-
-        /**
-         * @dataProvider data
-         */
-        function test($test_url, $expected, $ticket = 0) {
-                if ( $ticket )
-                        $this-&gt;knownWPBug( $ticket );
-
-                $ticket_ref = ($ticket &gt; 0) ? 'Ticket #' . $ticket : null;
-
-                if ( is_string($expected) )
-                        $expected = array('url' =&gt; $expected);
-                elseif ( is_array($expected) &amp;&amp; !isset($expected['url']) &amp;&amp; !isset($expected['qv']) )
-                        $expected = array( 'qv' =&gt; $expected );
-
-                if ( !isset($expected['url']) &amp;&amp; !isset($expected['qv']) )
-                        $this-&gt;markTestSkipped('No valid expected output was provided');
-
-                if ( false !== strpos( $test_url, '%d' ) ) {
-                        if ( false !== strpos( $test_url, '/?author=%d' ) )
-                                $test_url = sprintf( $test_url, $this-&gt;author_id );
-                        if ( false !== strpos( $test_url, '?cat=%d' ) )
-                                $test_url = sprintf( $test_url, $this-&gt;term_ids[ $expected['url'] ] );
-                }
-
-                $this-&gt;go_to( home_url( $test_url ) );
-
-                // Does the redirect match what's expected?
-                $can_url = $this-&gt;get_canonical( $test_url );
-                $parsed_can_url = parse_url($can_url);
-
-                // Just test the Path and Query if present
-                if ( isset($expected['url']) )
-                        $this-&gt;assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
-
-                if ( ! isset($expected['qv']) )
-                        return;
-
-                // &quot;make&quot; that the request and check the query is correct
-                $this-&gt;go_to( $can_url );
-
-                // Are all query vars accounted for, And correct?
-                global $wp;
-
-                $query_vars = array_diff($wp-&gt;query_vars, $wp-&gt;extra_query_vars);
-                if ( !empty($parsed_can_url['query']) ) {
-                        parse_str($parsed_can_url['query'], $_qv);
-
-                        // $_qv should not contain any elements which are set in $query_vars already (ie. $_GET vars should not be present in the Rewrite)
-                        $this-&gt;assertEquals( array(), array_intersect( $query_vars, $_qv ), 'Query vars are duplicated from the Rewrite into $_GET; ' . $ticket_ref );
-
-                        $query_vars = array_merge($query_vars, $_qv);
-                }
-
-                $this-&gt;assertEquals( $expected['qv'], $query_vars );
-        }
-
-        function data() {
-                /* Data format:
-                 * [0]: $test_url,
-                 * [1]: expected results: Any of the following can be used
-                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
-                 *      array( expected query vars to be set, same as 'qv' above )
-                 *      (string) expected redirect location
-                 * [2]: (optional) The ticket the test refers to, Can be skipped if unknown.
-                 */
-
-                // Please Note: A few test cases are commented out below, Look at the test case following it, in most cases it's simple showing 2 options for the &quot;proper&quot; redirect.
-                return array(
-                        // Categories
-
-                        array( '?cat=%d', '/category/parent/', 15256 ),
-                        array( '?cat=%d', '/category/parent/child-1/', 15256 ),
-                        array( '?cat=%d', '/category/parent/child-1/child-2/' ), // no children
-                        array( '/category/uncategorized/', array( 'url' =&gt; '/category/uncategorized/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized' ) ) ),
-                        array( '/category/uncategorized/page/2/', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ) ),
-                        array( '/category/uncategorized/?paged=2', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ) ),
-                        array( '/category/uncategorized/?paged=2&amp;category_name=uncategorized', array( 'url' =&gt; '/category/uncategorized/page/2/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2) ), 17174 ),
-                        array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
-                        array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
-
-                        // Categories &amp; Intersections with other vars
-                        array( '/category/uncategorized/?tag=post-formats', array( 'url' =&gt; '/category/uncategorized/?tag=post-formats', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'tag' =&gt; 'post-formats') ) ),
-                        array( '/?category_name=cat-a,cat-b', array( 'url' =&gt; '/?category_name=cat-a,cat-b', 'qv' =&gt; array( 'category_name' =&gt; 'cat-a,cat-b' ) ) ),
-
-                        // Taxonomies with extra Query Vars
-                        array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086), // Extra query vars should stay encoded
-
-                        // Categories with Dates
-                        array( '/category/uncategorized/?paged=2&amp;year=2008', array( 'url' =&gt; '/category/uncategorized/page/2/?year=2008', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'paged' =&gt; 2, 'year' =&gt; 2008) ), 17661 ),
-//                        array( '/2008/04/?cat=1', array( 'url' =&gt; '/2008/04/?cat=1', 'qv' =&gt; array('cat' =&gt; '1', 'year' =&gt; '2008', 'monthnum' =&gt; '04' ) ), 17661 ),
-                        array( '/2008/04/?cat=1', array( 'url' =&gt; '/category/uncategorized/?year=2008&amp;monthnum=04', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008', 'monthnum' =&gt; '04' ) ), 17661 ),
-//                        array( '/2008/?category_name=cat-a', array( 'url' =&gt; '/2008/?category_name=cat-a', 'qv' =&gt; array('category_name' =&gt; 'cat-a', 'year' =&gt; '2008' ) ) ),
-                        array( '/2008/?category_name=cat-a', array( 'url' =&gt; '/category/cat-a/?year=2008', 'qv' =&gt; array('category_name' =&gt; 'cat-a', 'year' =&gt; '2008' ) ), 20386 ),
-//                        array( '/category/uncategorized/?year=2008', array( 'url' =&gt; '/2008/?category_name=uncategorized', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008' ) ), 17661 ),
-                        array( '/category/uncategorized/?year=2008', array( 'url' =&gt; '/category/uncategorized/?year=2008', 'qv' =&gt; array('category_name' =&gt; 'uncategorized', 'year' =&gt; '2008' ) ), 17661 ),
-
-                        // Pages
-                        array( '/sample%20page/', array( 'url' =&gt; '/sample-page/', 'qv' =&gt; array('pagename' =&gt; 'sample-page', 'page' =&gt; '' ) ), 17653 ), // Page rules always set 'page'
-                        array( '/sample------page/', array( 'url' =&gt; '/sample-page/', 'qv' =&gt; array('pagename' =&gt; 'sample-page', 'page' =&gt; '' ) ), 14773 ),
-                        array( '/child-page-1/', '/parent-page/child-page-1/'),
-                        array( '/?page_id=144', '/parent-page/child-page-1/'),
-                        array( '/abo', '/about/' ),
-
-                        // Posts
-                        array( '?p=587', '/2008/06/02/post-format-test-audio/'),
-                        array( '/?name=images-test', '/2008/09/03/images-test/'),
-                        // Incomplete slug should resolve and remove the ?name= parameter
-                        array( '/?name=images-te', '/2008/09/03/images-test/', 20374),
-                        // Page slug should resolve to post slug and remove the ?pagename= parameter
-                        array( '/?pagename=images-test', '/2008/09/03/images-test/', 20374),
-
-                        array( '/2008/06/02/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
-                        array( '/2008/06/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
-                        array( '/2008/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
-                        array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in
-                        array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
-
-                        array( '/2008/09/03/images-test/3/', array( 'url' =&gt; '/2008/09/03/images-test/3/', 'qv' =&gt; array( 'name' =&gt; 'images-test', 'year' =&gt; '2008', 'monthnum' =&gt; '09', 'day' =&gt; '03', 'page' =&gt; '/3' ) ) ), // page = /3 ?!
-                        array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/', 11694 ), // post with 4 pages
-                        array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
-                        array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
-
-                        // Comments
-                        array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/', 20388 ),
-                        array( '/2008/03/03/comment-test/comment-page-20/', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
-                        array( '/2008/03/03/comment-test/?cpage=30', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
-
-                        // Attachments
-                        array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
-                        array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
-
-                        // Dates
-                        array( '/?m=2008', '/2008/' ),
-                        array( '/?m=200809', '/2008/09/'),
-                        array( '/?m=20080905', '/2008/09/05/'),
-
-                        array( '/2008/?day=05', '/2008/?day=05'), // no redirect
-                        array( '/2008/09/?day=05', '/2008/09/05/'),
-                        array( '/2008/?monthnum=9', '/2008/09/'),
-
-                        array( '/?year=2008', '/2008/'),
-
-                        // Authors
-                        array( '/?author=%d', '/author/canonical-author/' ),
-//                        array( '/?author=%d&amp;year=2008', '/2008/?author=3'),
-                        array( '/?author=%d&amp;year=2008', '/author/canonical-author/?year=2008', 17661 ),
-//                        array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
-                        array( '/author/canonical-author/?year=2008', '/author/canonical-author/?year=2008', 17661 ),
-
-                        // Feeds
-                        array( '/?feed=atom', '/feed/atom/' ),
-                        array( '/?feed=rss2', '/feed/' ),
-                        array( '/?feed=comments-rss2', '/comments/feed/'),
-                        array( '/?feed=comments-atom', '/comments/feed/atom/'),
-
-                        // Feeds (per-post)
-                        array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
-                        array( '/?p=149&amp;feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
-                        array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ),
-
-                        // Index
-                        array( '/?paged=1', '/' ),
-                        array( '/page/1/', '/' ),
-                        array( '/page1/', '/' ),
-                        array( '/?paged=2', '/page/2/' ),
-                        array( '/page2/', '/page/2/' ),
-
-                        // Misc
-                        array( '/2008%20', '/2008' ),
-                        array( '//2008////', '/2008/' ),
-
-                        // Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static)
-                );
-        }
-}
-
-/**
- * @group canonical
- * @group rewrite
- * @group query
- */
-class WP_Canonical_PageOnFront extends WP_Test_Canonical {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                update_option( 'show_on_front', 'page' );
-                update_option( 'page_for_posts', $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'blog-page', 'post_type' =&gt; 'page' ) ) );
-                update_option( 'page_on_front', $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'front-page', 'post_type' =&gt; 'page' ) ) );
-                $wp_rewrite-&gt;init();
-                flush_rewrite_rules();
-        }
-
-        function data() {
-                /* Format:
-                 * [0]: $test_url,
-                 * [1]: expected results: Any of the following can be used
-                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
-                 *      array( expected query vars to be set, same as 'qv' above )
-                 *      (string) expected redirect location
-                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
-                 */
-                 return array(
-                         // Check against an odd redirect
-                         array( '/page/2/', '/page/2/', 20385 ),
-                         // The page designated as the front page should redirect to the front of the site
-                         array( '/front-page/', '/' ),
-                         array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
-                 );
-        }
-}
-
-/**
- * @group canonical
- * @group rewrite
- * @group query
- */
-class WP_Canonical_CustomRules extends WP_Test_Canonical {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                // Add a custom Rewrite rule to test category redirections.
-                $wp_rewrite-&gt;add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&amp;order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule
-                $wp_rewrite-&gt;flush_rules();
-        }
-
-        function data() {
-                /* Format:
-                 * [0]: $test_url,
-                 * [1]: expected results: Any of the following can be used
-                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
-                 *      array( expected query vars to be set, same as 'qv' above )
-                 *      (string) expected redirect location
-                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
-                 */
-                return array(
-                        // Custom Rewrite rules leading to Categories
-                        array( '/ccr/uncategorized/sort/asc/', array( 'url' =&gt; '/ccr/uncategorized/sort/asc/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'asc' ) ) ),
-                        array( '/ccr/uncategorized/sort/desc/', array( 'url' =&gt; '/ccr/uncategorized/sort/desc/', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'desc' ) ) ),
-                        array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' =&gt; '/ccr/uncategorized/sort/desc/?year=2008', 'qv' =&gt; array( 'category_name' =&gt; 'uncategorized', 'order' =&gt; 'desc', 'year' =&gt; '2008' ) ), 17661 ),
-                );
-        }
-}
-
-/**
- * @group canonical
- * @group rewrite
- * @group query
- */
-class WP_Canonical_NoRewrite extends WP_Test_Canonical {
-
-        var $structure = '';
-
-        // These test cases are run against the test handler in WP_Canonical
-
-        function data() {
-                /* Format:
-                 * [0]: $test_url,
-                 * [1]: expected results: Any of the following can be used
-                 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
-                 *      array( expected query vars to be set, same as 'qv' above )
-                 *      (string) expected redirect location
-                 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
-                 */
-                return array(
-                        array( '/?p=123', '/?p=123' ),
-
-                        // This post_type arg should be stripped, because p=1 exists, and does not have post_type= in its query string
-                        array( '/?post_type=fake-cpt&amp;p=1', '/?p=1' ),
-
-                        // Strip an existing but incorrect post_type arg
-                        array( '/?post_type=page&amp;page_id=1', '/?p=1' ),
-
-                        array( '/?p=358 ', array('url' =&gt; '/?p=358',  'qv' =&gt; array('p' =&gt; '358') ) ), // Trailing spaces
-                        array( '/?p=358%20', array('url' =&gt; '/?p=358',  'qv' =&gt; array('p' =&gt; '358') ) ),
-
-                        array( '/?page_id=1', '/?p=1' ), // redirect page_id to p (should cover page_id|p|attachment_id to one another
-                        array( '/?page_id=1&amp;post_type=revision', '/?p=1' ),
-
-                );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_capabilitiesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_capabilities.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_capabilities.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_capabilities.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,235 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group user
- * @group capabilities
- */
-class TestMapMetaCap extends WP_UnitTestCase {
-        var $super_admins = null;
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;user_ids = array();
-
-                $this-&gt;user_id   = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-
-                if ( isset( $GLOBALS['super_admins'] ) )
-                        $this-&gt;super_admins = $GLOBALS['super_admins'];
-                $user = new WP_User( $this-&gt;user_id );
-                $GLOBALS['super_admins'] = array( $user-&gt;user_login );
-
-                $this-&gt;post_type = rand_str( 20 );
-                register_post_type( $this-&gt;post_type );
-
-                $this-&gt;post_id = wp_insert_post( array(
-                        'post_title' =&gt; rand_str(),
-                        'post_type' =&gt; $this-&gt;post_type,
-                        'post_status' =&gt; 'private',
-                        'post_author' =&gt; $this-&gt;author_id,
-                ) );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                $GLOBALS['super_admins'] = $this-&gt;super_admins;
-                unset( $GLOBALS['wp_post_types'][ $this-&gt;post_type ] );
-        }
-
-        function test_capability_type_post_with_no_extra_caps() {
-
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'post',
-                ) );
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
-
-                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_custom_capability_type_with_map_meta_cap() {
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'book',
-                        'map_meta_cap' =&gt; true,
-                ) );
-
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_books' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_books' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_private_books' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_private_books' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_others_books', 'delete_private_books' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_others_books', 'delete_private_books' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_capability_type_post_with_one_renamed_cap() {
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'post',
-                        'capabilities' =&gt; array( 'edit_posts' =&gt; 'edit_books' ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertFalse( $post_type_object-&gt;map_meta_cap );
-
-                $this-&gt;assertEquals( array( 'edit_post' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_post' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_post' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_post' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_post' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_post' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_capability_type_post_map_meta_cap_true_with_renamed_cap() {
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'post',
-                        'map_meta_cap' =&gt; true,
-                        'capabilities' =&gt; array(
-                                'edit_post' =&gt; 'edit_book', // maps back to itself.
-                                'edit_others_posts' =&gt; 'edit_others_books',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
-
-                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_capability_type_post_with_all_meta_caps_renamed() {
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'post',
-                        'capabilities' =&gt; array(
-                                'edit_post' =&gt; 'edit_book',
-                                'read_post' =&gt; 'read_book',
-                                'delete_post' =&gt; 'delete_book',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertFalse( $post_type_object-&gt;map_meta_cap );
-
-                $this-&gt;assertEquals( array( 'edit_book' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_book' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_book' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_book' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_book' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_book' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_capability_type_post_with_all_meta_caps_renamed_mapped() {
-                register_post_type( $this-&gt;post_type, array(
-                        'capability_type' =&gt; 'post',
-                        'map_meta_cap' =&gt; true,
-                        'capabilities' =&gt; array(
-                                'edit_post'   =&gt; 'edit_book',
-                                'read_post'   =&gt; 'read_book',
-                                'delete_post' =&gt; 'delete_book',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this-&gt;post_type );
-
-                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
-
-                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
-
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
-                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
-        }
-
-        function test_unfiltered_html_cap() {
-                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) &amp;&amp; DISALLOW_UNFILTERED_HTML )
-                        $this-&gt;markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
-                if ( is_multisite() ) {
-                        $this-&gt;assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
-                        $this-&gt;assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this-&gt;user_id ) );
-                } else {
-                        $this-&gt;assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this-&gt;user_id ) );
-                }
-        }
-
-        /**
-         * @ticket 20488
-         */
-        function test_file_edit_caps_not_reliant_on_unfiltered_html_constant() {
-                if ( defined( 'DISALLOW_FILE_MODS' ) || defined( 'DISALLOW_FILE_EDIT' ) )
-                        $this-&gt;markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
-
-                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
-                        if ( ! DISALLOW_UNFILTERED_HTML )
-                                $this-&gt;markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
-                } else {
-                        define( 'DISALLOW_UNFILTERED_HTML', true );
-                }
-
-                $this-&gt;assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', $this-&gt;user_id ) );
-                $this-&gt;assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', $this-&gt;user_id ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_classwpdependenciesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_class-wp-dependencies.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_class-wp-dependencies.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_class-wp-dependencies.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,117 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Dependencies extends WP_UnitTestCase {
-        function test_add() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'one' ));
-                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'two' ));
-
-                //Cannot reuse names
-                $this-&gt;assertFalse($dep-&gt;add( 'one', '' ));
-        }
-
-        function test_remove() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $dep-&gt;remove( 'one' );
-
-                $this-&gt;assertFalse($dep-&gt;query( 'one'));
-                $this-&gt;assertInstanceOf('_WP_Dependency', $dep-&gt;query( 'two' ));
-
-        }
-
-        function test_enqueue() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $dep-&gt;enqueue('one');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
-
-                $dep-&gt;enqueue('two');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-        }
-
-        function test_dequeue() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $dep-&gt;enqueue('one');
-                $dep-&gt;enqueue('two');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-
-                $dep-&gt;dequeue('one');
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-
-                $dep-&gt;dequeue('two');
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
-        }
-
-        function test_enqueue_args() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $dep-&gt;enqueue('one?arg');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
-                $this-&gt;assertEquals('arg', $dep-&gt;args['one']);
-
-                $dep-&gt;enqueue('two?arg');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-                $this-&gt;assertEquals('arg', $dep-&gt;args['two']);
-        }
-
-        function test_dequeue_args() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this-&gt;assertTrue($dep-&gt;add( 'one', '' ));
-                $this-&gt;assertTrue($dep-&gt;add( 'two', '' ));
-
-                $dep-&gt;enqueue('one?arg');
-                $dep-&gt;enqueue('two?arg');
-                $this-&gt;assertTrue($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-                $this-&gt;assertEquals('arg', $dep-&gt;args['one']);
-                $this-&gt;assertEquals('arg', $dep-&gt;args['two']);
-
-                $dep-&gt;dequeue('one');
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertTrue($dep-&gt;query( 'two', 'queue' ));
-                $this-&gt;assertFalse(isset($dep-&gt;args['one']));
-
-                $dep-&gt;dequeue('two');
-                $this-&gt;assertFalse($dep-&gt;query( 'one', 'queue' ));
-                $this-&gt;assertFalse($dep-&gt;query( 'two', 'queue' ));
-                $this-&gt;assertFalse(isset($dep-&gt;args['two']));
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_classwpthemephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_class-wp-theme.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_class-wp-theme.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_class-wp-theme.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,96 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group themes
- */
-class Test_WP_Theme extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;theme_root = realpath( DIR_TESTDATA . '/themedir1' );
-
-                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
-                $GLOBALS['wp_theme_directories'] = array( $this-&gt;theme_root );
-
-                add_filter('theme_root', array(&amp;$this, '_theme_root'));
-                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
-                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
-                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-                parent::tearDown();
-        }
-
-        // replace the normal theme root dir with our premade test dir
-        function _theme_root($dir) {
-                return $this-&gt;theme_root;
-        }
-        function test_new_WP_Theme_top_level() {
-                $theme = new WP_Theme( 'theme1', $this-&gt;theme_root );
-
-                //Meta
-                $this-&gt;assertEquals( 'My Theme', $theme-&gt;get('Name') );
-                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
-                $this-&gt;assertEquals( 'An example theme', $theme-&gt;get('Description') );
-                $this-&gt;assertEquals( 'Minnie Bannister', $theme-&gt;get('Author') );
-                $this-&gt;assertEquals( 'http://example.com/', $theme-&gt;get('AuthorURI') );
-                $this-&gt;assertEquals( '1.3', $theme-&gt;get('Version') );
-                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
-                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
-                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
-
-                //Important
-                $this-&gt;assertEquals( 'theme1', $theme-&gt;get_stylesheet() );
-                $this-&gt;assertEquals( 'theme1', $theme-&gt;get_template() );
-        }
-
-        function test_new_WP_Theme_subdir() {
-                $theme = new WP_Theme( 'subdir/theme2', $this-&gt;theme_root );
-
-                //Meta
-                $this-&gt;assertEquals( 'My Subdir Theme', $theme-&gt;get('Name') );
-                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
-                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme-&gt;get('Description') );
-                $this-&gt;assertEquals( 'Mr. WordPress', $theme-&gt;get('Author') );
-                $this-&gt;assertEquals( 'http://wordpress.org/', $theme-&gt;get('AuthorURI') );
-                $this-&gt;assertEquals( '0.1', $theme-&gt;get('Version') );
-                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
-                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
-                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
-
-                //Important
-                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_stylesheet() );
-                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_template() );
-        }
-
-        /**
-         * @ticket 20313
-         */
-        function test_new_WP_Theme_subdir_bad_root() {
-                // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdir.
-                $theme = new WP_Theme( 'theme2', $this-&gt;theme_root . '/subdir' );
-
-                //Meta
-                $this-&gt;assertEquals( 'My Subdir Theme', $theme-&gt;get('Name') );
-                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
-                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme-&gt;get('Description') );
-                $this-&gt;assertEquals( 'Mr. WordPress', $theme-&gt;get('Author') );
-                $this-&gt;assertEquals( 'http://wordpress.org/', $theme-&gt;get('AuthorURI') );
-                $this-&gt;assertEquals( '0.1', $theme-&gt;get('Version') );
-                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
-                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
-                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
-
-                //Important
-                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_stylesheet() );
-                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_template() );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_classwpxmlrpcserverphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_class-wp-xmlrpc-server.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_class-wp-xmlrpc-server.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_class-wp-xmlrpc-server.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,17 +0,0 @@
</span><del>-&lt;?php
-include_once(ABSPATH . 'wp-admin/includes/admin.php');
-include_once(ABSPATH . WPINC . '/class-IXR.php');
-include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_Disabled extends WP_UnitTestCase {
-        function test_disabled() {
-                $myxmlrpcserver = new wp_xmlrpc_server();
-                $result = $myxmlrpcserver-&gt;wp_getOptions( array( 1, 'username', 'password' ) );
-
-                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
-                $this-&gt;assertEquals( 405, $result-&gt;code );
-        }
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_includes_compatphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_compat.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_compat.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_compat.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,34 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group compat
- */
-class TestMbSubStr extends WP_UnitTestCase {
-        function test_mb_strcut() {
-                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, 3));
-                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, -1));
-                $this-&gt;assertEquals('баб', _mb_substr('баба', 0, -1));
-                $this-&gt;assertEquals('I am your Ð±', _mb_substr('I am your Ð±Ð°Ð±Ð°', 0, 11));
-        }
-}
-
-/**
- * @group compat
- */
-class TestHashHMAC extends WP_UnitTestCase {
-        function test_simple() {
-                $this-&gt;assertEquals('140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac('md5', 'simple', 'key'));
-                $this-&gt;assertEquals('993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac('sha1', 'simple', 'key'));
-        }
-
-        function test_key_padding() {
-                $this-&gt;assertEquals('3c1399103807cf12ec38228614416a8c', _hash_hmac('md5', 'simple', '65 character key 65 character key 65 character key 65 character k'));
-                $this-&gt;assertEquals('4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac('sha1', 'simple', '65 character key 65 character key 65 character key 65 character k'));
-        }
-
-        function test_raw_output() {
-                $this-&gt;assertEquals(array( 1 =&gt; '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
-                $this-&gt;assertEquals(array( 1 =&gt; '993003b95758e0ac2eba451a4c5877eb1bb7b92a'), unpack('H40', _hash_hmac('sha1', 'simple', 'key', true)));
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_feed_rss2php"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_feed_rss2.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_feed_rss2.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_feed_rss2.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,147 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * test the RSS 2.0 feed by generating a feed, parsing it, and checking that the
- * parsed contents match the contents of the posts stored in the database.  Since
- * we're using a real XML parser, this confirms that the feed is valid, well formed,
- * and contains the right stuff.
- *
- * @group feed
- */
-class TestFeedRss2 extends WP_UnitTestCase {
-
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;factory-&gt;post-&gt;create_many( 25 );
-
-                $this-&gt;post_count = get_option('posts_per_rss');
-                $this-&gt;excerpt_only = get_option('rss_use_excerpt');
-                // this seems to break something
-                update_option('use_smilies', false);
-        }
-
-        function do_rss2() {
-                ob_start();
-                // nasty hack
-                global $post;
-                try {
-                        @require(ABSPATH . 'wp-includes/feed-rss2.php');
-                        $out = ob_get_clean();
-                } catch (Exception $e) {
-                        $out = ob_get_clean();
-                        throw($e);
-                }
-                return $out;
-        }
-
-        function test_rss() {
-                $this-&gt;go_to('/feed/');
-                $feed = $this-&gt;do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get the rss element
-                $rss = xml_find($xml, 'rss');
-
-                // there should only be one rss element
-                $this-&gt;assertEquals(1, count($rss));
-
-                $this-&gt;assertEquals('2.0', $rss[0]['attributes']['version']);
-                $this-&gt;assertEquals('http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content']);
-                $this-&gt;assertEquals('http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw']);
-                $this-&gt;assertEquals('http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc']);
-
-                // rss should have exactly one child element (channel)
-                $this-&gt;assertEquals(1, count($rss[0]['child']));
-        }
-
-        function test_channel() {
-                $this-&gt;go_to('/feed/');
-                $feed = $this-&gt;do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get the rss -&gt; channel element
-                $channel = xml_find($xml, 'rss', 'channel');
-
-                $this-&gt;assertTrue(empty($channel[0]['attributes']));
-
-                $title = xml_find($xml, 'rss', 'channel', 'title');
-                $this-&gt;assertEquals(get_option('blogname'), $title[0]['content']);
-
-                $desc = xml_find($xml, 'rss', 'channel', 'description');
-                $this-&gt;assertEquals(get_option('blogdescription'), $desc[0]['content']);
-
-                $link = xml_find($xml, 'rss', 'channel', 'link');
-                $this-&gt;assertEquals(get_option('siteurl'), $link[0]['content']);
-
-                $pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
-                $this-&gt;assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
-        }
-
-        /**
-         * @ticket UT32
-         */
-        function test_items() {
-                $this-&gt;go_to('/feed/');
-                $feed = $this-&gt;do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get all the rss -&gt; channel -&gt; item elements
-                $items = xml_find($xml, 'rss', 'channel', 'item');
-                $posts = get_posts('numberposts='.$this-&gt;post_count);
-
-                // check each of the items against the known post data
-                for ($i=0; $i &lt; $this-&gt;post_count; $i++) {
-
-                        // title
-                        $title = xml_find($items[$i]['child'], 'title');
-                        $this-&gt;assertEquals($posts[$i]-&gt;post_title, $title[0]['content']);
-
-                        // link
-                        $link = xml_find($items[$i]['child'], 'link');
-                        $this-&gt;assertEquals(get_permalink($posts[$i]-&gt;ID), $link[0]['content']);
-
-                        // comment link
-                        $comments_link = xml_find($items[$i]['child'], 'comments');
-                        $this-&gt;assertEquals(get_permalink($posts[$i]-&gt;ID) . '#comments', $comments_link[0]['content']);
-
-                        // pub date
-                        $pubdate = xml_find($items[$i]['child'], 'pubDate');
-                        $this-&gt;assertEquals(strtotime($posts[$i]-&gt;post_date), strtotime($pubdate[0]['content']));
-
-                        // author
-                        $creator = xml_find($items[$i]['child'], 'dc:creator');
-                        $this-&gt;assertEquals($this-&gt;author-&gt;user_nicename, $creator[0]['content']);
-
-                        // categories (perhaps multiple)
-                        $categories = xml_find($items[$i]['child'], 'category');
-                        $cat_ids = wp_get_post_categories($post-&gt;ID);
-                        if (empty($cat_ids))        $cat_ids = array(1);
-                        // should be the same number of categories
-                        $this-&gt;assertEquals(count($cat_ids), count($categories));
-                        // ..with the same names
-                        for ($j=0; $j &lt; count($cat_ids); $j++)
-                                $this-&gt;assertEquals(get_cat_name($cat_ids[$j]), $categories[$j]['content']);
-
-                        // GUID
-                        $guid = xml_find($items[$i]['child'], 'guid');
-                        $this-&gt;assertEquals('false', $guid[0]['attributes']['isPermaLink']);
-                        $this-&gt;assertEquals($posts[$i]-&gt;guid, $guid[0]['content']);
-
-                        // description/excerpt
-                        $description = xml_find($items[$i]['child'], 'description');
-                        $this-&gt;assertEquals(trim($posts[$i]-&gt;post_excerpt), trim($description[0]['content']));
-
-                        // post content
-                        if (!$this-&gt;excerpt_only) {
-                                $content = xml_find($items[$i]['child'], 'content:encoded');
-                                $this-&gt;assertEquals(trim(apply_filters('the_content', $posts[$i]-&gt;post_content)), trim($content[0]['content']));
-                        }
-
-                        // comment rss
-                        $comment_rss = xml_find($items[$i]['child'], 'wfw:commentRss');
-                        $this-&gt;assertEquals(html_entity_decode(get_post_comments_feed_link($posts[$i]-&gt;ID)), $comment_rss[0]['content']);
-                }
-
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_filephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_file.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_file.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_file.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,105 +0,0 @@
</span><del>-&lt;?php
-
-class TestIncludesFile extends WP_UnitTestCase {
-
-        function setUp() {
-                $this-&gt;dir = dirname(tempnam('/tmp', 'foo'));
-
-                $this-&gt;badchars = '&quot;\'[]*&amp;?$';
-        }
-
-        function is_unique_writable_file($path, $filename) {
-                $fullpath = $path . DIRECTORY_SEPARATOR . $filename;
-
-                $fp = fopen( $fullpath, 'x' );
-                // file already exists?
-                if (!$fp)
-                        return false;
-
-                // write some random contents
-                $c = rand_str();
-                fwrite($fp, $c);
-                fclose($fp);
-
-                if ( file_get_contents($fullpath) === $c )
-                        $result = true;
-                else
-                        $result = false;
-
-                return $result;
-        }
-
-        function test_unique_filename_is_valid() {
-                // make sure it produces a valid, writable, unique filename
-                $filename = wp_unique_filename( $this-&gt;dir, rand_str() . '.txt' );
-
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_is_unique() {
-                // make sure it produces two unique filenames
-                $name = rand_str();
-
-                $filename1 = wp_unique_filename( $this-&gt;dir, $name . '.txt' );
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename1) );
-                $filename2 = wp_unique_filename( $this-&gt;dir, $name . '.txt' );
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename2) );
-
-                // the two should be different
-                $this-&gt;assertNotEquals( $filename1, $filename2 );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename1);
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename2);
-        }
-
-        function test_unique_filename_is_sanitized() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this-&gt;dir, $name . $this-&gt;badchars .  '.txt' );
-
-                // make sure the bad characters were all stripped out
-                $this-&gt;assertEquals( $name . '.txt', $filename );
-
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_with_slashes() {
-                $name = rand_str();
-                // &quot;foo/foo.txt&quot;
-                $filename = wp_unique_filename( $this-&gt;dir, $name . '/' . $name .  '.txt' );
-
-                // the slash should be removed, i.e. &quot;foofoo.txt&quot;
-                $this-&gt;assertEquals( $name . $name . '.txt', $filename );
-
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_multiple_ext() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this-&gt;dir, $name . '.php.txt' );
-
-                // &quot;foo.php.txt&quot; becomes &quot;foo.php_.txt&quot;
-                $this-&gt;assertEquals( $name . '.php_.txt', $filename );
-
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_no_ext() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this-&gt;dir, $name );
-
-                $this-&gt;assertEquals( $name, $filename );
-
-                $this-&gt;assertTrue( $this-&gt;is_unique_writable_file($this-&gt;dir, $filename) );
-
-                unlink($this-&gt;dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_ksesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_kses.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_kses.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_kses.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,105 +0,0 @@
</span><del>-&lt;?php
-/**
- * Some simple test cases for KSES post content filtering
- *
- * @group formatting
- * @group kses
- */
-class Test_wp_filter_post_kses extends WP_UnitTestCase {
-
-        /**
-         * @ticket 20210
-         */
-        function test_wp_filter_post_kses_address() {
-                global $allowedposttags;
-
-                $attributes = array(
-                        'class' =&gt; 'classname',
-                        'id' =&gt; 'id',
-                        'style' =&gt; 'color: red;',
-                        'title' =&gt; 'title',
-                );
-
-                foreach ( $attributes as $name =&gt; $value ) {
-                        $string = &quot;&lt;address $name='$value'&gt;1 WordPress Avenue, The Internet.&lt;/address&gt;&quot;;
-                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        /**
-         * @ticket 20210
-         */
-        function test_wp_filter_post_kses_a() {
-                global $allowedposttags;
-
-                $attributes = array(
-                        'class' =&gt; 'classname',
-                        'id' =&gt; 'id',
-                        'style' =&gt; 'color: red;',
-                        'title' =&gt; 'title',
-                        'href' =&gt; 'http://example.com',
-                        'rel' =&gt; 'related',
-                        'rev' =&gt; 'revision',
-                        'name' =&gt; 'name',
-                        'target' =&gt; '_blank',
-                );
-
-                foreach ( $attributes as $name =&gt; $value ) {
-                        $string = &quot;&lt;a $name='$value'&gt;I link this&lt;/a&gt;&quot;;
-                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        /**
-         * @ticket 20210
-         */
-        function test_wp_filter_post_kses_abbr() {
-                global $allowedposttags;
-
-                $attributes = array(
-                        'class' =&gt; 'classname',
-                        'id' =&gt; 'id',
-                        'style' =&gt; 'color: red;',
-                        'title' =&gt; 'title',
-                );
-
-                foreach ( $attributes as $name =&gt; $value ) {
-                        $string = &quot;&lt;abbr $name='$value'&gt;WP&lt;/abbr&gt;&quot;;
-                        $this-&gt;assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        function test_feed_links() {
-                global $allowedposttags;
-
-                $content = &lt;&lt;&lt;EOF
-&lt;a href=&quot;feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:javascript:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;javascript:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:feed:feed:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:javascript:feed:javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:feed:http:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;feed:alert(1)&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-&lt;a href=&quot;&quot;&gt;CLICK ME&lt;/a&gt;
-EOF;
-
-        $this-&gt;assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_mediaphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_media.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_media.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_media.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,102 +0,0 @@
</span><del>-&lt;?php
-
-class TestIncludesMedia extends WP_UnitTestCase {
-
-  function setUp() {
-    $this-&gt;caption = 'A simple caption.';
-    $this-&gt;html_content = &lt;&lt;&lt;CAP
-A &lt;strong class='classy'&gt;bolded&lt;/strong&gt; &lt;em&gt;caption&lt;/em&gt; with a &lt;a href=&quot;#&quot;&gt;link&lt;/a&gt;.
-CAP;
-    $this-&gt;img_content = &lt;&lt;&lt;CAP
-&lt;img src=&quot;pic.jpg&quot; id='anId' alt=&quot;pic&quot;/&gt;
-CAP;
-  }
-
-  function test_img_caption_shortcode_added() {
-    global $shortcode_tags;
-    $this-&gt;assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
-    $this-&gt;assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
-  }
-
-  function test_img_caption_shortcode_with_empty_params() {
-    $result = img_caption_shortcode( array() );
-    $this-&gt;assertNull( $result );
-  }
-
-  function test_img_caption_shortcode_with_bad_attr() {
-    $result = img_caption_shortcode( array(), 'content' );
-    $this-&gt;assertEquals( 'content', 'content' );
-  }
-
-  function test_img_caption_shortcode_with_old_format() {
-    $result = img_caption_shortcode(
-      array( 'width' =&gt; 20, 'caption' =&gt; $this-&gt;caption )
-    );
-    $this-&gt;assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;/{$this-&gt;caption}/&quot;, $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;/width: 30/&quot;, $result, $_r ) );
-  }
-
-  function test_img_caption_shortcode_with_old_format_id_and_align() {
-    $result = img_caption_shortcode(
-      array(
-        'width' =&gt; 20,
-        'caption' =&gt; $this-&gt;caption,
-        'id' =&gt; '&quot;myId',
-        'align' =&gt; '&amp;myAlignment'
-      )
-    );
-    $this-&gt;assertEquals( 1, preg_match_all( '/wp-caption &amp;amp;myAlignment/', $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( '/id=&quot;&amp;quot;myId&quot;/', $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;/{$this-&gt;caption}/&quot;, $result, $_r ) );
-  }
-
-  function test_new_img_caption_shortcode_with_html_caption() {
-    $result = img_caption_shortcode(
-      array( 'width' =&gt; 20, 'caption' =&gt; $this-&gt;html_content )
-    );
-    $our_preg = preg_quote( $this-&gt;html_content );
-
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$our_preg}~&quot;, $result, $_r ) );
-  }
-
-  function test_new_img_caption_shortcode_new_format() {
-    $result = img_caption_shortcode(
-      array( 'width' =&gt; 20 ),
-      $this-&gt;img_content . $this-&gt;html_content
-    );
-    $img_preg = preg_quote( $this-&gt;img_content );
-    $content_preg = preg_quote( $this-&gt;html_content );
-
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
-  }
-
-  function test_new_img_caption_shortcode_new_format_and_linked_image() {
-    $linked_image = &quot;&lt;a href='#'&gt;{$this-&gt;img_content}&lt;/a&gt;&quot;;
-    $result = img_caption_shortcode(
-      array( 'width' =&gt; 20 ),
-      $linked_image . $this-&gt;html_content
-    );
-    $img_preg = preg_quote( $linked_image );
-    $content_preg = preg_quote( $this-&gt;html_content );
-
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
-  }
-
-  function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
-    $linked_image = &quot;&lt;a href='#'&gt;{$this-&gt;img_content}&lt;/a&gt;&quot;;
-    $result = img_caption_shortcode(
-      array( 'width' =&gt; 20 ),
-      $linked_image . &quot;\n\n&quot; . $this-&gt;html_content
-    );
-    $img_preg = preg_quote( $linked_image );
-    $content_preg = preg_quote( $this-&gt;html_content );
-
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~{$img_preg}.*wp-caption-text~&quot;, $result, $_r ) );
-    $this-&gt;assertEquals( 1, preg_match_all( &quot;~wp-caption-text.*{$content_preg}~&quot;, $result, $_r ) );
-  }
-
-}
</del></span></pre></div>
<a id="trunkteststest_includes_metaphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_meta.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_meta.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_meta.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,115 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group meta
- */
-class WPTestIncludesMeta extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
-                $this-&gt;meta_id = add_metadata( 'user', $this-&gt;author-&gt;ID, 'meta_key', 'meta_value' );
-                $this-&gt;delete_meta_id = add_metadata( 'user', $this-&gt;author-&gt;ID, 'delete_meta_key', 'delete_meta_value' );
-        }
-
-        function _meta_sanitize_cb ( $meta_value, $meta_key, $meta_type ) {
-                return 'sanitized';
-        }
-
-        function test_sanitize_meta() {
-                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
-                $this-&gt;assertEquals( 'unsanitized', $meta );
-
-                register_meta( 'post', 'some_meta', array( &amp;$this, '_meta_sanitize_cb' ) );
-                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
-                $this-&gt;assertEquals( 'sanitized', $meta );
-        }
-
-        function test_delete_metadata_by_mid() {
-                // Let's try and delete a non-existing ID, non existing meta
-                $this-&gt;assertFalse( delete_metadata_by_mid( 'user', 0 ) );
-                $this-&gt;assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this-&gt;delete_meta_id ) );
-
-                // Now let's delete the real meta data
-                $this-&gt;assertTrue( delete_metadata_by_mid( 'user', $this-&gt;delete_meta_id ) );
-
-                // And make sure it's been deleted
-                $this-&gt;assertFalse( get_metadata_by_mid( 'user', $this-&gt;delete_meta_id ) );
-
-                // Make sure the caches are cleared
-                $this-&gt;assertFalse( (bool) get_user_meta( $this-&gt;author-&gt;ID, 'delete_meta_key' ) );
-        }
-
-        function test_update_metadata_by_mid() {
-                // Setup
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-
-                // Update the meta value
-                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_new_value' ) );
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-                $this-&gt;assertEquals( 'meta_new_value', $meta-&gt;meta_value );
-
-                // Update the meta value
-                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_new_value', 'meta_new_key' ) );
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-                $this-&gt;assertEquals( 'meta_new_key', $meta-&gt;meta_key );
-
-                // Update the key and value
-                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_value', 'meta_key' ) );
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-                $this-&gt;assertEquals( 'meta_key', $meta-&gt;meta_key );
-                $this-&gt;assertEquals( 'meta_value', $meta-&gt;meta_value );
-
-                // Update the value that has to be serialized
-                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, array( 'first', 'second' ) ) );
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-                $this-&gt;assertEquals( array( 'first', 'second' ), $meta-&gt;meta_value );
-
-                // Let's try some invalid meta data
-                $this-&gt;assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
-                $this-&gt;assertFalse( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'meta_value', array('invalid', 'key' ) ) );
-
-                // Let's see if caches get cleared after updates.
-                $meta = get_metadata_by_mid( 'user', $this-&gt;meta_id );
-                $first = get_user_meta( $meta-&gt;user_id, $meta-&gt;meta_key );
-                $this-&gt;assertTrue( update_metadata_by_mid( 'user', $this-&gt;meta_id, 'other_meta_value' ) );
-                $second = get_user_meta( $meta-&gt;user_id, $meta-&gt;meta_key );
-                $this-&gt;assertFalse( $first === $second );
-        }
-
-        function test_metadata_exists() {
-                $this-&gt;assertFalse( metadata_exists( 'user',  $this-&gt;author-&gt;ID, 'foobarbaz' ) );
-                $this-&gt;assertTrue( metadata_exists( 'user',  $this-&gt;author-&gt;ID, 'meta_key' ) );
-                $this-&gt;assertFalse( metadata_exists( 'user',  1234567890, 'foobarbaz' ) );
-                $this-&gt;assertFalse( metadata_exists( 'user',  1234567890, 'meta_key' ) );
-        }
-
-        function test_metadata_slashes() {
-                $key = rand_str();
-                $value = 'Test\\singleslash';
-                $expected = 'Testsingleslash';
-                $value2 = 'Test\\\\doubleslash';
-                $expected2 = 'Test\\doubleslash';
-                $this-&gt;assertFalse( metadata_exists( 'user', $this-&gt;author-&gt;ID, $key ) );
-                $this-&gt;assertFalse( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
-                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertInternalType( 'int', add_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value ) );
-                $this-&gt;assertEquals( $expected, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
-                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertInternalType( 'int', update_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value ) );
-                $this-&gt;assertEquals( $expected, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertTrue( update_metadata( 'user', $this-&gt;author-&gt;ID, $key, 'blah' ) );
-                $this-&gt;assertEquals( 'blah', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
-                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertFalse( metadata_exists( 'user', $this-&gt;author-&gt;ID, $key ) );
-
-                // Test overslashing
-                $this-&gt;assertInternalType( 'int', add_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value2 ) );
-                $this-&gt;assertEquals( $expected2, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertTrue( delete_metadata( 'user', $this-&gt;author-&gt;ID, $key ) );
-                $this-&gt;assertSame( '', get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-                $this-&gt;assertInternalType( 'int', update_metadata( 'user', $this-&gt;author-&gt;ID, $key, $value2 ) );
-                $this-&gt;assertEquals( $expected2, get_metadata( 'user', $this-&gt;author-&gt;ID, $key, true ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_pluggablephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/test_includes_pluggable.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_pluggable.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_pluggable.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -269,20 +269,3 @@
</span><span class="cx">                 $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
</span><span class="cx">         }
</span><span class="cx"> }
</span><del>-
-/**
- * @group pluggable
- * @group user
- */
-class TestUserFunction extends WP_UnitTestCase {
-        /**
-         * @ticket 13317
-         */
-        function test_get_userdata() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $this-&gt;assertFalse( get_userdata( 0 ) );
-                $this-&gt;assertFalse( get_userdata( '0' ) );
-                $this-&gt;assertFalse( get_userdata( 'string' ) );
-                $this-&gt;assertFalse( get_userdata( array( 'array' ) ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_wpscriptsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_wp-scripts.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_wp-scripts.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_wp-scripts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,88 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Scripts extends WP_UnitTestCase {
-        var $old_wp_scripts;
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;old_wp_scripts = $GLOBALS['wp_scripts'];
-                remove_action( 'wp_default_scripts', 'wp_default_scripts' );
-                $GLOBALS['wp_scripts'] = new WP_Scripts();
-                $GLOBALS['wp_scripts']-&gt;default_version = get_bloginfo( 'version' );
-
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_scripts'] = $this-&gt;old_wp_scripts;
-                add_action( 'wp_default_scripts', 'wp_default_scripts' );
-                parent::tearDown();
-        }
-
-        /**
-         * Test versioning
-         * @ticket 11315
-         */
-        function test_wp_enqueue_script() {
-                wp_enqueue_script('no-deps-no-version', 'example.com', array());
-                wp_enqueue_script('empty-deps-no-version', 'example.com' );
-                wp_enqueue_script('empty-deps-version', 'example.com', array(), 1.2);
-                wp_enqueue_script('empty-deps-null-version', 'example.com', array(), null);
-                $ver = get_bloginfo( 'version' );
-                $expected  = &quot;&lt;script type='text/javascript' src='http://example.com?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com?ver=1.2'&gt;&lt;/script&gt;\n&quot;;
-                $expected .= &quot;&lt;script type='text/javascript' src='http://example.com'&gt;&lt;/script&gt;\n&quot;;
-
-                $this-&gt;assertEquals($expected, get_echo('wp_print_scripts'));
-
-                // No scripts left to print
-                $this-&gt;assertEquals(&quot;&quot;, get_echo('wp_print_scripts'));
-        }
-
-        /**
-         * Test the different protocol references in wp_enqueue_script
-         * @global WP_Scripts $wp_scripts
-         * @ticket 16560
-         */
-        public function test_protocols() {
-                // Init
-                global $wp_scripts;
-                $base_url_backup = $wp_scripts-&gt;base_url;
-                $wp_scripts-&gt;base_url = 'http://example.com/wordpress';
-                $expected = '';
-                $ver = get_bloginfo( 'version' );
-
-                // Try with an HTTP reference
-                wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected  .= &quot;&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-
-                // Try with an HTTPS reference
-                wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected  .= &quot;&lt;script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-
-                // Try with an automatic protocol reference (//)
-                wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected  .= &quot;&lt;script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-
-                // Try with a local resource and an automatic protocol reference (//)
-                $url = '//my_plugin/script.js';
-                wp_enqueue_script( 'plugin-script', $url );
-                $expected  .= &quot;&lt;script type='text/javascript' src='$url?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-
-                // Try with a bad protocol
-                wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected  .= &quot;&lt;script type='text/javascript' src='{$wp_scripts-&gt;base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'&gt;&lt;/script&gt;\n&quot;;
-
-                // Go!
-                $this-&gt;assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
-
-                // No scripts left to print
-                $this-&gt;assertEquals( '', get_echo( 'wp_print_scripts' ) );
-
-                // Cleanup
-                $wp_scripts-&gt;base_url = $base_url_backup;
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_wpstylesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_wp-styles.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_wp-styles.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_includes_wp-styles.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Styles extends WP_UnitTestCase {
-        var $old_wp_styles;
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;old_wp_styles = $GLOBALS['wp_styles'];
-                remove_action( 'wp_default_styles', 'wp_default_styles' );
-                $GLOBALS['wp_styles'] = new WP_Styles();
-                $GLOBALS['wp_styles']-&gt;default_version = get_bloginfo( 'version' );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_styles'] = $this-&gt;old_wp_styles;
-                add_action( 'wp_default_styles', 'wp_default_styles' );
-                parent::tearDown();
-        }
-
-        /**
-         * Test versioning
-         * @ticket 11315
-         */
-        function test_wp_enqueue_style() {
-                wp_enqueue_style('no-deps-no-version', 'example.com' );
-                wp_enqueue_style('no-deps-version', 'example.com', array(), 1.2);
-                wp_enqueue_style('no-deps-null-version', 'example.com', array(), null);
-                wp_enqueue_style('no-deps-null-version-print-media', 'example.com', array(), null, 'print');
-                $ver = get_bloginfo( 'version' );
-                $expected  = &quot;&lt;link rel='stylesheet' id='no-deps-no-version-css'  href='http://example.com?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-version-css'  href='http://example.com?ver=1.2' type='text/css' media='all' /&gt;\n&quot;;
-                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-null-version-css'  href='http://example.com' type='text/css' media='all' /&gt;\n&quot;;
-                $expected .= &quot;&lt;link rel='stylesheet' id='no-deps-null-version-print-media-css'  href='http://example.com' type='text/css' media='print' /&gt;\n&quot;;
-
-                $this-&gt;assertEquals($expected, get_echo('wp_print_styles'));
-
-                // No styles left to print
-                $this-&gt;assertEquals(&quot;&quot;, get_echo('wp_print_styles'));
-        }
-
-        /**
-         * Test the different protocol references in wp_enqueue_style
-         * @global WP_Styles $wp_styles
-         * @ticket 16560
-         */
-        public function test_protocols() {
-                // Init
-                global $wp_styles;
-                $base_url_backup = $wp_styles-&gt;base_url;
-                $wp_styles-&gt;base_url = 'http://example.com/wordpress';
-                $expected = '';
-                $ver = get_bloginfo( 'version' );
-
-                // Try with an HTTP reference
-                wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-http-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-
-                // Try with an HTTPS reference
-                wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-https-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-
-                // Try with an automatic protocol reference (//)
-                wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-doubleslash-css'  href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-
-                // Try with a local resource and an automatic protocol reference (//)
-                $url = '//my_plugin/style.css';
-                wp_enqueue_style( 'plugin-style', $url );
-                $expected  .= &quot;&lt;link rel='stylesheet' id='plugin-style-css'  href='$url?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-
-                // Try with a bad protocol
-                wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected  .= &quot;&lt;link rel='stylesheet' id='reset-css-ftp-css'  href='{$wp_styles-&gt;base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' /&gt;\n&quot;;
-
-                // Go!
-                $this-&gt;assertEquals( $expected, get_echo( 'wp_print_styles' ) );
-
-                // No styles left to print
-                $this-&gt;assertEquals( '', get_echo( 'wp_print_styles' ) );
-
-                // Cleanup
-                $wp_styles-&gt;base_url = $base_url_backup;
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_link_functionsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_link_functions.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_link_functions.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_link_functions.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,157 +0,0 @@
</span><del>-&lt;?php
-
-// tests for link-template.php and related URL functions
-class TestSSLLinks extends WP_UnitTestCase {
-        var $_old_server;
-        function setUp() {
-                $this-&gt;_old_server = $_SERVER;
-        }
-
-        function tearDown() {
-                $_SERVER = $this-&gt;_old_server;
-        }
-
-        function test_is_ssl_positive() {
-                $_SERVER['HTTPS'] = 'on';
-                $this-&gt;assertTrue( is_ssl() );
-
-                $_SERVER['HTTPS'] = 'ON';
-                $this-&gt;assertTrue( is_ssl() );
-
-                $_SERVER['HTTPS'] = '1';
-                $this-&gt;assertTrue( is_ssl() );
-
-                unset( $_SERVER['HTTPS'] );
-                $_SERVER['SERVER_PORT'] = '443';
-                $this-&gt;assertTrue( is_ssl() );
-        }
-
-        function test_is_ssl_negative() {
-                $_SERVER['HTTPS'] = 'off';
-                $this-&gt;assertFalse( is_ssl() );
-
-                $_SERVER['HTTPS'] = 'OFF';
-                $this-&gt;assertFalse( is_ssl() );
-
-                unset($_SERVER['HTTPS']);
-                $this-&gt;assertFalse( is_ssl() );
-        }
-
-        function test_admin_url_valid() {
-                $paths = array(
-                        '' =&gt; &quot;/wp-admin/&quot;,
-                        'foo' =&gt; &quot;/wp-admin/foo&quot;,
-                        '/foo' =&gt; &quot;/wp-admin/foo&quot;,
-                        '/foo/' =&gt; &quot;/wp-admin/foo/&quot;,
-                        'foo.php' =&gt; &quot;/wp-admin/foo.php&quot;,
-                        '/foo.php' =&gt; &quot;/wp-admin/foo.php&quot;,
-                        '/foo.php?bar=1' =&gt; &quot;/wp-admin/foo.php?bar=1&quot;,
-                );
-                $https = array('on', 'off');
-
-                foreach ($https as $val) {
-                        $_SERVER['HTTPS'] = $val;
-                        $siteurl = get_option('siteurl');
-                        if ( $val == 'on' )
-                                $siteurl = str_replace('http://', 'https://', $siteurl);
-
-                        foreach ($paths as $in =&gt; $out) {
-                                $this-&gt;assertEquals( $siteurl.$out, admin_url($in), &quot;admin_url('{$in}') should equal '{$siteurl}{$out}'&quot;);
-                        }
-                }
-        }
-
-        function test_admin_url_invalid() {
-                $paths = array(
-                        null =&gt; &quot;/wp-admin/&quot;,
-                        0 =&gt; &quot;/wp-admin/&quot;,
-                        -1 =&gt; &quot;/wp-admin/&quot;,
-                        '../foo/' =&gt; &quot;/wp-admin/&quot;,
-                        '///' =&gt; &quot;/wp-admin/&quot;,
-                );
-                $https = array('on', 'off');
-
-                foreach ($https as $val) {
-                        $_SERVER['HTTPS'] = $val;
-                        $siteurl = get_option('siteurl');
-                        if ( $val == 'on' )
-                                $siteurl = str_replace('http://', 'https://', $siteurl);
-
-                        foreach ($paths as $in =&gt; $out) {
-                                $this-&gt;assertEquals( $siteurl.$out, admin_url($in), &quot;admin_url('{$in}') should equal '{$siteurl}{$out}'&quot;);
-                        }
-                }
-        }
-
-        function test_set_url_scheme() {
-                if ( ! function_exists( 'set_url_scheme' ) )
-                        return;
-
-                $links = array(
-                        'http://wordpress.org/',
-                        'https://wordpress.org/',
-                        'http://wordpress.org/news/',
-                        'http://wordpress.org',
-                );
-
-                $https_links = array(
-                        'https://wordpress.org/',
-                        'https://wordpress.org/',
-                        'https://wordpress.org/news/',
-                        'https://wordpress.org',
-                );
-
-                $http_links = array(
-                        'http://wordpress.org/',
-                        'http://wordpress.org/',
-                        'http://wordpress.org/news/',
-                        'http://wordpress.org',
-                );
-
-                $relative_links = array(
-                        '/',
-                        '/',
-                        '/news/',
-                        ''
-                );
-
-                $forced_admin = force_ssl_admin();
-                $forced_login = force_ssl_login();
-                $i = 0;
-                foreach ( $links as $link ) {
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );
-                        $this-&gt;assertEquals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );
-
-                        $_SERVER['HTTPS'] = 'on';
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link ) );
-
-                        $_SERVER['HTTPS'] = 'off';
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link ) );
-
-                        force_ssl_login( false );
-                        force_ssl_admin( true );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
-
-                        force_ssl_admin( false );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );
-
-                        force_ssl_login( true );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
-
-                        $i++;
-                }
-
-                force_ssl_admin( $forced_admin );
-                force_ssl_login( $forced_login );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_metaphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_meta.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_meta.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_meta.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,98 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * just make sure the test framework is working
- *
- * @group testsuite
- */
-class WPTestMeta extends WP_UnitTestCase {
-        var $val;
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;val = true;
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $this-&gt;val = false;
-        }
-
-        function test_true() {
-                $this-&gt;assertTrue($this-&gt;val);
-        }
-
-        // two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
-        function test_globals() {
-                global $test_foo;
-                $test_foo = array('foo', 'bar', 'baz');
-
-                function test_globals_foo() {
-                        unset($GLOBALS['test_foo'][1]);
-                }
-
-                test_globals_foo();
-
-                $this-&gt;assertEquals($test_foo, array(0=&gt;'foo', 2=&gt;'baz'));
-                $this-&gt;assertEquals($test_foo, $GLOBALS['test_foo']);
-        }
-
-        function test_globals_bar() {
-                global $test_bar;
-                $test_bar = array('a', 'b', 'c');
-                $this-&gt;assertEquals($test_bar, $GLOBALS['test_bar']);
-        }
-
-}
-
-/**
- * test helper utility functions
- *
- * @group testsuite
- */
-class WPTestUtils extends WP_UnitTestCase {
-
-        function test_strip_ws() {
-                $this-&gt;assertEquals('', strip_ws(''));
-                $this-&gt;assertEquals('foo', strip_ws('foo'));
-                $this-&gt;assertEquals('', strip_ws(&quot;\r\n\t  \n\r\t&quot;));
-
-                $in  = &quot;asdf\n&quot;;
-                $in .= &quot;asdf asdf\n&quot;;
-                $in .= &quot;asdf     asdf\n&quot;;
-                $in .= &quot;\tasdf\n&quot;;
-                $in .= &quot;\tasdf\t\n&quot;;
-                $in .= &quot;\t\tasdf\n&quot;;
-                $in .= &quot;foo bar\n\r\n&quot;;
-                $in .= &quot;foo\n&quot;;
-
-                $expected  = &quot;asdf\n&quot;;
-                $expected .= &quot;asdf asdf\n&quot;;
-                $expected .= &quot;asdf     asdf\n&quot;;
-                $expected .= &quot;asdf\n&quot;;
-                $expected .= &quot;asdf\n&quot;;
-                $expected .= &quot;asdf\n&quot;;
-                $expected .= &quot;foo bar\n&quot;;
-                $expected .= &quot;foo&quot;;
-
-                $this-&gt;assertEquals($expected, strip_ws($in));
-
-        }
-
-        function test_mask_input_value() {
-                $in = &lt;&lt;&lt;EOF
-&lt;h2&gt;Assign Authors&lt;/h2&gt;
-&lt;p&gt;To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as &lt;code&gt;admin&lt;/code&gt;s entries.&lt;/p&gt;
-&lt;p&gt;If a new user is created by WordPress, the password will be set, by default, to &quot;changeme&quot;. Quite suggestive, eh? ;)&lt;/p&gt;
-        &lt;ol id=&quot;authors&quot;&gt;&lt;form action=&quot;?import=wordpress&amp;amp;step=2&amp;amp;id=&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wpnonce&quot; value=&quot;855ae98911&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wp_http_referer&quot; value=&quot;wp-test.php&quot; /&gt;&lt;li&gt;Current author: &lt;strong&gt;Alex Shiels&lt;/strong&gt;&lt;br /&gt;Create user  &lt;input type=&quot;text&quot; value=&quot;Alex Shiels&quot; name=&quot;user[]&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt; or map to existing&lt;select name=&quot;userselect[0]&quot;&gt;
-EOF;
-                // _wpnonce value should be replaced with 'xxx'
-                $expected = &lt;&lt;&lt;EOF
-&lt;h2&gt;Assign Authors&lt;/h2&gt;
-&lt;p&gt;To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as &lt;code&gt;admin&lt;/code&gt;s entries.&lt;/p&gt;
-&lt;p&gt;If a new user is created by WordPress, the password will be set, by default, to &quot;changeme&quot;. Quite suggestive, eh? ;)&lt;/p&gt;
-        &lt;ol id=&quot;authors&quot;&gt;&lt;form action=&quot;?import=wordpress&amp;amp;step=2&amp;amp;id=&quot; method=&quot;post&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wpnonce&quot; value=&quot;***&quot; /&gt;&lt;input type=&quot;hidden&quot; name=&quot;_wp_http_referer&quot; value=&quot;wp-test.php&quot; /&gt;&lt;li&gt;Current author: &lt;strong&gt;Alex Shiels&lt;/strong&gt;&lt;br /&gt;Create user  &lt;input type=&quot;text&quot; value=&quot;Alex Shiels&quot; name=&quot;user[]&quot; maxlength=&quot;30&quot;&gt; &lt;br /&gt; or map to existing&lt;select name=&quot;userselect[0]&quot;&gt;
-EOF;
-                $this-&gt;assertEquals($expected, mask_input_value($in));
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_msphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_ms.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_ms.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_ms.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,354 +0,0 @@
</span><del>-&lt;?php
-
-if ( is_multisite() ) :
-
-/**
- * A set of unit tests for WordPress Multisite
- *
- * @group multisite
- */
-class WPTestMS extends WP_UnitTestCase {
-
-        protected $plugin_hook_count = 0;
-
-        function test_create_and_delete_blog() {
-                global $wpdb, $current_site;
-
-                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 4 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this-&gt;assertInternalType( 'int', $blog_id );
-                        $prefix = $wpdb-&gt;get_blog_prefix( $blog_id );
-
-                        foreach ( $wpdb-&gt;tables( 'blog', false ) as $table ) {
-                                $table_fields = $wpdb-&gt;get_results( &quot;DESCRIBE $prefix$table;&quot; );
-                                $this-&gt;assertNotEmpty( $table_fields );
-                                $result = $wpdb-&gt;get_results( &quot;SELECT * FROM $prefix$table LIMIT 1&quot; );
-                                if ( 'commentmeta' == $table )
-                                        $this-&gt;assertEmpty( $result );
-                                else
-                                        $this-&gt;assertNotEmpty( $result );
-                        }
-                }
-
-                // update the blog count cache to use get_blog_count()
-                wp_update_network_counts();
-                $this-&gt;assertEquals( 4 + 1, (int) get_blog_count() );
-
-                $drop_tables = false;
-                // delete all blogs
-                foreach ( $blog_ids as $blog_id ) {
-                        // drop tables for every second blog
-                        $drop_tables = ! $drop_tables;
-                        wpmu_delete_blog( $blog_id, $drop_tables );
-
-                        $prefix = $wpdb-&gt;get_blog_prefix( $blog_id );
-                        foreach ( $wpdb-&gt;tables( 'blog', false ) as $table ) {
-                                $table_fields = $wpdb-&gt;get_results( &quot;DESCRIBE $prefix$table;&quot; );
-                                if ( $drop_tables )
-                                        $this-&gt;assertEmpty( $table_fields );
-                                else
-                                        $this-&gt;assertNotEmpty( $table_fields, $prefix . $table );
-                        }
-                }
-
-                // update the blog count cache to use get_blog_count()
-                wp_update_network_counts();
-                $this-&gt;assertEquals( 1, get_blog_count() );
-        }
-
-        function test_get_blogs_of_user() {
-                global $current_site;
-
-                // Logged out users don't have blogs.
-                $this-&gt;assertEquals( array(), get_blogs_of_user( 0 ) );
-
-                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 10, array( 'user_id' =&gt; $user1_id ) );
-
-                foreach ( $blog_ids as $blog_id )
-                        $this-&gt;assertInternalType( 'int', $blog_id );
-
-                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
-                sort( $blogs_of_user );
-                $this-&gt;assertEquals ( array_merge( array( 1 ), $blog_ids), $blogs_of_user );
-
-                $this-&gt;assertTrue( remove_user_from_blog( $user1_id, 1 ) );
-
-                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
-                sort( $blogs_of_user );
-                $this-&gt;assertEquals ( $blog_ids, $blogs_of_user );
-
-                // Non-existent users don't have blogs.
-                wpmu_delete_user( $user1_id );
-                $user = new WP_User( $user1_id );
-                $this-&gt;assertFalse( $user-&gt;exists(), 'WP_User-&gt;exists' );
-                $this-&gt;assertEquals( array(), get_blogs_of_user( $user1_id ) );
-        }
-
-        function test_is_blog_user() {
-                global $current_site, $wpdb;
-
-                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-
-                $old_current = get_current_user_id();
-                wp_set_current_user( $user1_id );
-
-                $this-&gt;assertTrue( is_blog_user() );
-                $this-&gt;assertTrue( is_blog_user( $wpdb-&gt;blogid ) );
-
-                $blog_ids = array();
-
-                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 5 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this-&gt;assertInternalType( 'int', $blog_id );
-                        $this-&gt;assertTrue( is_blog_user( $blog_id ) );
-                        $this-&gt;assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
-                        $this-&gt;assertFalse( is_blog_user( $blog_id ) );
-                }
-
-                wp_set_current_user( $old_current );
-        }
-
-        function test_is_user_member_of_blog() {
-                global $current_site, $wpdb;
-
-                $user1_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-
-                $old_current = get_current_user_id();
-                wp_set_current_user( $user1_id );
-
-                $this-&gt;assertTrue( is_user_member_of_blog() );
-                $this-&gt;assertTrue( is_user_member_of_blog( 0, 0 ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( 0, $wpdb-&gt;blogid ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( $user1_id ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( $user1_id, $wpdb-&gt;blogid ) );
-
-                $blog_ids = $this-&gt;factory-&gt;blog-&gt;create_many( 5 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this-&gt;assertInternalType( 'int', $blog_id );
-                        $this-&gt;assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) );
-                        $this-&gt;assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
-                        $this-&gt;assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) );
-                }
-
-                wpmu_delete_user( $user1_id );
-                $user = new WP_User( $user1_id );
-                $this-&gt;assertFalse( $user-&gt;exists(), 'WP_User-&gt;exists' );
-                $this-&gt;assertFalse( is_user_member_of_blog( $user1_id ), 'is_user_member_of_blog' );
-
-                wp_set_current_user( $old_current );
-        }
-
-        function test_active_network_plugins() {
-                $path = &quot;hello.php&quot;;
-
-                // local activate, should be invisible for the network
-                activate_plugin($path); // $network_wide = false
-                $active_plugins = wp_get_active_network_plugins();
-                $this-&gt;assertEquals( Array(), $active_plugins );
-
-                add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) );
-
-                // activate the plugin sitewide
-                activate_plugin($path, '', $network_wide = true);
-                $active_plugins = wp_get_active_network_plugins();
-                $this-&gt;assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins );
-
-                //deactivate the plugin
-                deactivate_plugins($path);
-                $active_plugins = wp_get_active_network_plugins();
-                $this-&gt;assertEquals( Array(), $active_plugins );
-
-                $this-&gt;assertEquals( 1, $this-&gt;plugin_hook_count ); // testing actions and silent mode
-
-                activate_plugin($path, '', $network_wide = true);
-                deactivate_plugins($path, true); // silent
-
-                $this-&gt;assertEquals( 1, $this-&gt;plugin_hook_count ); // testing actions and silent mode
-        }
-
-        function _helper_deactivate_hook() {
-                $this-&gt;plugin_hook_count++;
-        }
-
-        function test_get_user_count() {
-                // Refresh the cache
-                wp_update_network_counts();
-                $start_count = get_user_count();
-
-                $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-
-                $count = get_user_count(); // No change, cache not refreshed
-                $this-&gt;assertEquals( $start_count, $count );
-
-                wp_update_network_counts(); // Magic happens here
-
-                $count = get_user_count();
-                $this-&gt;assertEquals( $start_count + 1, $count );
-        }
-
-        function test_wp_schedule_update_network_counts() {
-                $this-&gt;assertFalse(wp_next_scheduled('update_network_counts'));
-
-                // We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set
-                wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
-
-                $this-&gt;assertInternalType('int', wp_next_scheduled('update_network_counts'));
-        }
-
-        function test_users_can_register_signup_filter() {
-
-                $registration = get_site_option('registration');
-                $this-&gt;assertFalse( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'all');
-                $this-&gt;assertTrue( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'user');
-                $this-&gt;assertTrue( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'none');
-                $this-&gt;assertFalse( users_can_register_signup_filter() );
-        }
-
-        function test_get_dashboard_blog() {
-                global $current_site;
-
-                // if there is no dashboard blog set, current blog is used
-                $dashboard_blog = get_dashboard_blog();
-                $this-&gt;assertEquals( 1, $dashboard_blog-&gt;blog_id );
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id ) );
-                $this-&gt;assertInternalType( 'int', $blog_id );
-
-                // set the dashboard blog to another one
-                update_site_option( 'dashboard_blog', $blog_id );
-                $dashboard_blog = get_dashboard_blog();
-                $this-&gt;assertEquals( $blog_id, $dashboard_blog-&gt;blog_id );
-        }
-
-        function test_wpmu_log_new_registrations() {
-                global $wpdb;
-
-                $user = new WP_User( 1 );
-                $ip = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
-
-                wpmu_log_new_registrations(1,1);
-
-                // currently there is no wrapper function for the registration_log
-                $reg_blog = $wpdb-&gt;get_col( &quot;SELECT email FROM {$wpdb-&gt;registration_log} WHERE {$wpdb-&gt;registration_log}.blog_id = 1 AND IP LIKE '&quot; . $ip . &quot;'&quot; );
-                $this-&gt;assertEquals( $user-&gt;user_email, $reg_blog[ count( $reg_blog )-1 ] );
-        }
-
-        /**
-         * @ticket 18119
-         */
-        function test_upload_is_user_over_quota() {
-                $default_space_allowed = 50;
-                $echo = false;
-
-                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertTrue( is_upload_space_available() );
-
-                update_site_option('upload_space_check_disabled', true);
-                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertTrue( is_upload_space_available() );
-
-                update_site_option( 'blog_upload_space', 0 );
-                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertEquals( $default_space_allowed, get_space_allowed() );
-                $this-&gt;assertTrue( is_upload_space_available() );
-
-                update_site_option('upload_space_check_disabled', false);
-                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertTrue( is_upload_space_available() );
-
-                if ( ! file_exists( BLOGSUPLOADDIR ) )
-                        $this-&gt;markTestSkipped( 'This test is broken when blogs.dir does not exist. ');
-
-                /*
-                This is broken when blogs.dir does not exist, as get_upload_space_available()
-                simply returns the value of blog_upload_space (converted to bytes), which would
-                be negative but still not false. When blogs.dir does exist, &lt; 0 is returned as 0.
-                */
-
-                update_site_option( 'blog_upload_space', -1 );
-                $this-&gt;assertTrue( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertEquals( -1, get_space_allowed() );
-                $this-&gt;assertFalse( is_upload_space_available() );
-
-                update_option( 'blog_upload_space', 0 );
-                $this-&gt;assertFalse( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertEquals( $default_space_allowed, get_space_allowed() );
-                $this-&gt;assertTrue( is_upload_space_available() );
-
-                update_option( 'blog_upload_space', -1 );
-                $this-&gt;assertTrue( upload_is_user_over_quota( $echo ) );
-                $this-&gt;assertEquals( -1, get_space_allowed() );
-                $this-&gt;assertFalse( is_upload_space_available() );
-        }
-
-        function test_wpmu_update_blogs_date() {
-                global $wpdb;
-
-                wpmu_update_blogs_date();
-
-                // compare the update time with the current time, allow delta &lt; 2
-                $blog = get_blog_details( $wpdb-&gt;blogid );
-                $current_time = time();
-                $time_difference = $current_time - strtotime( $blog-&gt;last_updated );
-                $this-&gt;assertLessThan( 2, $time_difference );
-        }
-
-        function test_getters(){
-                global $current_site;
-
-                $blog_id = get_current_blog_id();
-                $blog = get_blog_details( $blog_id );
-                $this-&gt;assertEquals( $blog_id, $blog-&gt;blog_id );
-                $this-&gt;assertEquals( $current_site-&gt;domain, $blog-&gt;domain );
-                $this-&gt;assertEquals( '/', $blog-&gt;path );
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id, 'path' =&gt; '/test_blogname', 'title' =&gt; 'Test Title' ) );
-                $this-&gt;assertInternalType( 'int', $blog_id );
-
-                $this-&gt;assertEquals( 'http://' . DOMAIN_CURRENT_SITE . PATH_CURRENT_SITE . 'test_blogname/', get_blogaddress_by_name('test_blogname') );
-
-                $this-&gt;assertEquals( $blog_id, get_id_from_blogname('test_blogname') );
-        }
-
-        function test_update_blog_details() {
-                global $current_site;
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $blog_id = $this-&gt;factory-&gt;blog-&gt;create( array( 'user_id' =&gt; $user_id, 'path' =&gt; '/test_blogpath', 'title' =&gt; 'Test Title' ) );
-                $this-&gt;assertInternalType( 'int', $blog_id );
-
-                $result = update_blog_details( $blog_id, array('domain' =&gt; 'example.com', 'path' =&gt; 'my_path/') );
-                $this-&gt;assertTrue( $result );
-
-                $blog = get_blog_details( $blog_id );
-                $this-&gt;assertEquals( 'example.com', $blog-&gt;domain );
-                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
-                $this-&gt;assertEquals( '0', $blog-&gt;spam );
-
-                $result = update_blog_details( $blog_id, array('domain' =&gt; 'example2.com','spam' =&gt; 1) );
-                $this-&gt;assertTrue( $result );
-                $blog = get_blog_details( $blog_id );
-                $this-&gt;assertEquals( 'example2.com', $blog-&gt;domain );
-                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
-                $this-&gt;assertEquals( '1', $blog-&gt;spam );
-
-                $result = update_blog_details( $blog_id );
-                $this-&gt;assertFalse( $result );
-                $blog = get_blog_details( $blog_id );
-                $this-&gt;assertEquals( 'example2.com', $blog-&gt;domain );
-                $this-&gt;assertEquals( 'my_path/', $blog-&gt;path );
-                $this-&gt;assertEquals( '1', $blog-&gt;spam );
-                $this-&gt;assertFalse( $result );
-        }
-}
-
-endif;
</del></span></pre></div>
<a id="trunkteststest_optionphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_option.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_option.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_option.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,301 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group options
- */
-class TestOption extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-
-        function __return_foo() {
-                return 'foo';
-        }
-
-        function test_the_basics() {
-                $key = rand_str();
-                $key2 = rand_str();
-                $value = rand_str();
-                $value2 = rand_str();
-
-                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
-                $this-&gt;assertTrue( add_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_option( $key ) );
-                $this-&gt;assertFalse( add_option( $key, $value ) );  // Already exists
-                $this-&gt;assertFalse( update_option( $key, $value ) );  // Value is the same
-                $this-&gt;assertTrue( update_option( $key, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_option( $key ) );
-                $this-&gt;assertFalse( add_option( $key, $value ) );
-                $this-&gt;assertEquals( $value2, get_option( $key ) );
-                $this-&gt;assertTrue( delete_option( $key ) );
-                $this-&gt;assertFalse( get_option( $key ) );
-                $this-&gt;assertFalse( delete_option( $key ) );
-
-                $this-&gt;assertTrue( update_option( $key2, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_option( $key2 ) );
-                $this-&gt;assertTrue( delete_option( $key2 ) );
-                $this-&gt;assertFalse( get_option( $key2 ) );
-        }
-
-        function test_default_filter() {
-                $random = rand_str();
-
-                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
-
-                // Default filter overrides $default arg.
-                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( 'foo', get_option( 'doesnotexist', 'bar' ) );
-
-                // Remove the filter and the $default arg is honored.
-                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
-
-                // Once the option exists, the $default arg and the default filter are ignored.
-                add_option( 'doesnotexist', $random );
-                $this-&gt;assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
-                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
-                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-
-                // Cleanup
-                $this-&gt;assertTrue( delete_option( 'doesnotexist' ) );
-                $this-&gt;assertFalse( get_option( 'doesnotexist' ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
-
-                $this-&gt;assertTrue( add_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_option( $key ) );
-
-                $value = (object) $value;
-                $this-&gt;assertTrue( update_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_option( $key ) );
-                $this-&gt;assertTrue( delete_option( $key ) );
-        }
-}
-
-/**
- * @group options
- */
-class TestSiteOption extends WP_UnitTestCase {
-        function __return_foo() {
-                return 'foo';
-        }
-
-        function test_the_basics() {
-                $key = rand_str();
-                $key2 = rand_str();
-                $value = rand_str();
-                $value2 = rand_str();
-
-                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
-                $this-&gt;assertTrue( add_site_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_option( $key ) );
-                $this-&gt;assertFalse( add_site_option( $key, $value ) );  // Already exists
-                $this-&gt;assertFalse( update_site_option( $key, $value ) );  // Value is the same
-                $this-&gt;assertTrue( update_site_option( $key, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_site_option( $key ) );
-                $this-&gt;assertFalse( add_site_option( $key, $value ) );
-                $this-&gt;assertEquals( $value2, get_site_option( $key ) );
-                $this-&gt;assertTrue( delete_site_option( $key ) );
-                $this-&gt;assertFalse( get_site_option( $key ) );
-                $this-&gt;assertFalse( delete_site_option( $key ) );
-
-                $this-&gt;assertTrue( update_site_option( $key2, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_site_option( $key2 ) );
-                $this-&gt;assertTrue( delete_site_option( $key2 ) );
-                $this-&gt;assertFalse( get_site_option( $key2 ) );
-        }
-
-        function test_default_filter() {
-                $random = rand_str();
-
-                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
-
-                // Default filter overrides $default arg.
-                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( 'foo', get_site_option( 'doesnotexist', 'bar' ) );
-
-                // Remove the filter and the $default arg is honored.
-                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( 'bar', get_site_option( 'doesnotexist', 'bar' ) );
-
-                // Once the option exists, the $default arg and the default filter are ignored.
-                add_site_option( 'doesnotexist', $random );
-                $this-&gt;assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
-                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this-&gt;assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
-                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-
-                // Cleanup
-                $this-&gt;assertTrue( delete_site_option( 'doesnotexist' ) );
-                $this-&gt;assertFalse( get_site_option( 'doesnotexist' ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
-
-                $this-&gt;assertTrue( add_site_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_option( $key ) );
-
-                $value = (object) $value;
-                $this-&gt;assertTrue( update_site_option( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_option( $key ) );
-                $this-&gt;assertTrue( delete_site_option( $key ) );
-        }
-
-        // #15497 - ensure update_site_option will add options with false-y values
-        function test_update_adds_falsey_value() {
-                $key = rand_str();
-                $value = 0;
-
-                delete_site_option( $key );
-                $this-&gt;assertTrue( update_site_option( $key, $value ) );
-                wp_cache_flush(); // ensure we're getting the value from the DB
-                $this-&gt;assertEquals( $value, get_site_option( $key ) );
-        }
-
-        // #18955 - ensure get_site_option doesn't cache the default value for non-existent options
-        function test_get_doesnt_cache_default_value() {
-                $option = rand_str();
-                $default = 'a default';
-
-                $this-&gt;assertEquals( get_site_option( $option, $default ), $default );
-                $this-&gt;assertFalse( get_site_option( $option ) );
-        }
-}
-
-/**
- * @group options
- */
-class TestTransient extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-
-        function test_the_basics() {
-                $key = rand_str();
-                $value = rand_str();
-                $value2 = rand_str();
-
-                $this-&gt;assertFalse( get_transient( 'doesnotexist' ) );
-                $this-&gt;assertTrue( set_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_transient( $key ) );
-                $this-&gt;assertFalse( set_transient( $key, $value ) );
-                $this-&gt;assertTrue( set_transient( $key, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_transient( $key ) );
-                $this-&gt;assertTrue( delete_transient( $key ) );
-                $this-&gt;assertFalse( get_transient( $key ) );
-                $this-&gt;assertFalse( delete_transient( $key ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
-
-                $this-&gt;assertTrue( set_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_transient( $key ) );
-
-                $value = (object) $value;
-                $this-&gt;assertTrue( set_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_transient( $key ) );
-                $this-&gt;assertTrue( delete_transient( $key ) );
-        }
-}
-
-/**
- * @group options
- */
-class TestSiteTransient extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-
-        function test_the_basics() {
-                $key = rand_str();
-                $value = rand_str();
-                $value2 = rand_str();
-
-                $this-&gt;assertFalse( get_site_transient( 'doesnotexist' ) );
-                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
-                $this-&gt;assertFalse( set_site_transient( $key, $value ) );
-                $this-&gt;assertTrue( set_site_transient( $key, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_site_transient( $key ) );
-                $this-&gt;assertTrue( delete_site_transient( $key ) );
-                $this-&gt;assertFalse( get_site_transient( $key ) );
-                $this-&gt;assertFalse( delete_site_transient( $key ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' =&gt; true, 'bar' =&gt; true );
-
-                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
-
-                $value = (object) $value;
-                $this-&gt;assertTrue( set_site_transient( $key, $value ) );
-                $this-&gt;assertEquals( $value, get_site_transient( $key ) );
-                $this-&gt;assertTrue( delete_site_transient( $key ) );
-        }
-}
-
-if ( is_multisite() ) :
-/**
- * @group options
- */
-class TestBlogOption extends WP_UnitTestCase {
-        function test_from_same_site() {
-                $key = rand_str();
-                $key2 = rand_str();
-                $value = rand_str();
-                $value2 = rand_str();
-
-                $this-&gt;assertFalse( get_blog_option( 1, 'doesnotexist' ) );
-                $this-&gt;assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
-
-                $this-&gt;assertTrue( add_blog_option( 1, $key, $value ) );
-                // Assert all values of $blog_id that means the current or main blog (the same here).
-                $this-&gt;assertEquals( $value, get_blog_option( 1, $key ) );
-                $this-&gt;assertEquals( $value, get_blog_option( null, $key ) );
-                $this-&gt;assertEquals( $value, get_blog_option( '1', $key ) );
-                $this-&gt;assertEquals( $value, get_option( $key ) ); // check get_option()
-
-                $this-&gt;assertFalse( add_blog_option( 1, $key, $value ) );  // Already exists
-                $this-&gt;assertFalse( update_blog_option( 1, $key, $value ) );  // Value is the same
-                $this-&gt;assertTrue( update_blog_option( 1, $key, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key ) );
-                $this-&gt;assertEquals( $value2, get_option( $key ) ); // check get_option()
-                $this-&gt;assertFalse( add_blog_option( 1, $key, $value ) );
-                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key ) );
-                $this-&gt;assertEquals( $value2, get_option( $key ) ); // check get_option()
-
-                $this-&gt;assertTrue( delete_blog_option( 1, $key ) );
-                $this-&gt;assertFalse( get_blog_option( 1, $key ) );
-                $this-&gt;assertFalse( get_option( $key ) ); // check get_option()
-                $this-&gt;assertFalse( delete_blog_option( 1, $key ) );
-                $this-&gt;assertTrue( update_blog_option( 1, $key2, $value2 ) );
-                $this-&gt;assertEquals( $value2, get_blog_option( 1, $key2 ) );
-                $this-&gt;assertEquals( $value2, get_option( $key2 ) ); // check get_option()
-                $this-&gt;assertTrue( delete_blog_option( 1, $key2 ) );
-                $this-&gt;assertFalse( get_blog_option( 1, $key2 ) );
-                $this-&gt;assertFalse( get_option( $key2 ) ); // check get_option()
-        }
-}
-endif;
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkteststest_post_filteringphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_post_filtering.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_post_filtering.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_post_filtering.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,211 +0,0 @@
</span><del>-&lt;?php
-
-// save and fetch posts to make sure content is properly filtered.
-// these tests don't care what code is responsible for filtering or how it is called, just that it happens when a post is saved.
-
-/**
- * @group post
- */
-class TestPostFiltering extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                update_option('use_balanceTags', 1);
-                kses_init_filters();
-
-        }
-
-        function tearDown() {
-                kses_remove_filters();
-                parent::tearDown();
-        }
-
-        // a simple test to make sure unclosed tags are fixed
-        function test_post_content_unknown_tag() {
-
-                $content = &lt;&lt;&lt;EOF
-&lt;foobar&gt;no such tag&lt;/foobar&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-no such tag
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        // a simple test to make sure unbalanced tags are fixed
-        function test_post_content_unbalanced_tag() {
-
-                $content = &lt;&lt;&lt;EOF
-&lt;i&gt;italics
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;i&gt;italics&lt;/i&gt;
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        // test kses filtering of disallowed attribute
-        function test_post_content_disallowed_attr() {
-
-                $content = &lt;&lt;&lt;EOF
-&lt;img src='foo' width='500' href='shlorp' /&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;img src='foo' width='500' /&gt;
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        /**
-         * test kses bug. xhtml does not require space before closing empty element
-         * @ticket 12394
-         */
-        function test_post_content_xhtml_empty_elem() {
-                $content = &lt;&lt;&lt;EOF
-&lt;img src='foo' width='500' height='300'/&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;img src='foo' width='500' height='300' /&gt;
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span a --more-- tag
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_more() {
-                $content = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;!--more--&gt;
-that's continued after the jump&lt;/em&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;/em&gt;&lt;!--more--&gt;
-that's continued after the jump
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span a --nextpage-- tag
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_nextpage() {
-                $content = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;!--nextpage--&gt;
-that's continued after the jump&lt;/em&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;/em&gt;&lt;!--nextpage--&gt;
-that's continued after the jump
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order)
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_more_nextpage() {
-                $content = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;!--more--&gt;
-that's continued after the jump&lt;/em&gt;
-&lt;!--nextpage--&gt;
-&lt;p&gt;and the next page
-&lt;!--nextpage--&gt;
-breaks the graf&lt;/p&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;/em&gt;&lt;!--more--&gt;
-that's continued after the jump
-&lt;!--nextpage--&gt;
-&lt;p&gt;and the next page
-&lt;/p&gt;&lt;!--nextpage--&gt;
-breaks the graf
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order)
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_nextpage_more() {
-                $content = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;!--nextpage--&gt;
-that's continued after the jump&lt;/em&gt;
-&lt;!--more--&gt;
-&lt;p&gt;and the next page
-&lt;!--nextpage--&gt;
-breaks the graf&lt;/p&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;/em&gt;&lt;!--nextpage--&gt;
-that's continued after the jump
-&lt;!--more--&gt;
-&lt;p&gt;and the next page
-&lt;/p&gt;&lt;!--nextpage--&gt;
-breaks the graf
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $expected, $post-&gt;post_content );
-        }
-
-        // make sure unbalanced tags are untouched when the balance option is off
-        function test_post_content_nobalance_nextpage_more() {
-
-                update_option('use_balanceTags', 0);
-
-                $content = &lt;&lt;&lt;EOF
-&lt;em&gt;some text&lt;!--nextpage--&gt;
-that's continued after the jump&lt;/em&gt;
-&lt;!--more--&gt;
-&lt;p&gt;and the next page
-&lt;!--nextpage--&gt;
-breaks the graf&lt;/p&gt;
-EOF;
-
-                $id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_content' =&gt; $content ) );
-                $post = get_post($id);
-
-                $this-&gt;assertEquals( $content, $post-&gt;post_content );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_queryphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_query.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_query.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_query.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,647 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * Test the is_*() functions in query.php across the URL structure
- *
- * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
- * then we test the effects of each url on the wp_query object.
- *
- * @group query
- * @group rewrite
- */
-class TestWPQueryVars extends WP_UnitTestCase {
-
-        protected $page_ids;
-        protected $post_ids;
-
-        function setUp() {
-                parent::setUp();
-
-                update_option( 'comments_per_page', 5 );
-                update_option( 'posts_per_page', 5 );
-
-                global $wp_rewrite;
-                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
-                create_initial_taxonomies();
-                $GLOBALS['wp_rewrite']-&gt;init();
-                flush_rewrite_rules();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $GLOBALS['wp_rewrite']-&gt;init();
-        }
-
-        /**
-         * Check each of the WP_Query is_* functions/properties against expected boolean value.
-         *
-         * Any properties that are listed by name as parameters will be expected to be true; any others are
-         * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
-         * and is_feed() must be true and everything else must be false to pass.
-         *
-         * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
-         */
-        function assertQueryTrue(/* ... */) {
-                global $wp_query;
-                $all = array(
-                        'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
-                        'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
-                        'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
-                        'is_posts_page', 'is_post_type_archive',
-                );
-                $true = func_get_args();
-
-                $passed = true;
-                $not_false = $not_true = array(); // properties that were not set to expected values
-
-                foreach ( $all as $query_thing ) {
-                        $result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query-&gt;$query_thing;
-
-                        if ( in_array( $query_thing, $true ) ) {
-                                if ( ! $result ) {
-                                        array_push( $not_true, $query_thing );
-                                        $passed = false;
-                                }
-                        } else if ( $result ) {
-                                array_push( $not_false, $query_thing );
-                                $passed = false;
-                        }
-                }
-
-                $message = '';
-                if ( count($not_true) )
-                        $message .= implode( $not_true, ', ' ) . ' should be true. ';
-                if ( count($not_false) )
-                        $message .= implode( $not_false, ', ' ) . ' should be false.';
-                $this-&gt;assertTrue( $passed, $message );
-        }
-
-        function test_home() {
-                $this-&gt;go_to('/');
-                $this-&gt;assertQueryTrue('is_home');
-        }
-
-        function test_404() {
-                $this-&gt;go_to('/'.rand_str());
-                $this-&gt;assertQueryTrue('is_404');
-        }
-
-        function test_permalink() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertQueryTrue('is_single', 'is_singular');
-        }
-
-        function test_post_comments_feed() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-
-        function test_post_comments_feed_with_no_comments() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-        function test_page() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about' ) );
-                $this-&gt;go_to( get_permalink( $page_id ) );
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_parent_page() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $this-&gt;go_to( get_permalink( $page_id ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_1() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $this-&gt;go_to( get_permalink( $page_id ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_2() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
-                $this-&gt;go_to( get_permalink( $page_id ) );
-
-                $this-&gt;assertQueryTrue('is_page','is_singular');
-        }
-
-        // '(about)/trackback/?$' =&gt; 'index.php?pagename=$matches[1]&amp;tb=1'
-        function test_page_trackback() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}trackback/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page','is_singular','is_trackback');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
-        function test_page_feed() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        function test_page_feed_with_no_comments() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}feed/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?pagename=$matches[1]&amp;feed=$matches[2]'
-        function test_page_feed_atom() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'parent-page' ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-1', 'post_parent' =&gt; $page_id ) );
-                $page_ids[] = $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'child-page-2', 'post_parent' =&gt; $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $page_id, 2 );
-
-                        $url = get_permalink( $page_id );
-                        $this-&gt;go_to(&quot;{$url}feed/atom/&quot;);
-
-                        // make sure the correct wp_query flags are set
-                        $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-                }
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
-        function test_page_page_2() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
-                $this-&gt;go_to(&quot;/about/page/2/&quot;);
-
-                // make sure the correct wp_query flags are set
-                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' =&gt; 'index.php?pagename=$matches[1]&amp;paged=$matches[2]'
-        function test_page_page_2_no_slash() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
-                $this-&gt;go_to(&quot;/about/page2/&quot;);
-
-                // make sure the correct wp_query flags are set
-                $this-&gt;assertQueryTrue('is_page', 'is_singular', 'is_paged');
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-        }
-
-        // FIXME: what is this for?
-        // '(about)(/[0-9]+)?/?$' =&gt; 'index.php?pagename=$matches[1]&amp;page=$matches[2]'
-        function test_pagination_of_posts_page() {
-                $page_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'page', 'post_title' =&gt; 'about', 'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2' ) );
-                update_option( 'show_on_front', 'page' );
-                update_option( 'page_for_posts', $page_id );
-
-                $this-&gt;go_to('/about/2/');
-
-                $this-&gt;assertQueryTrue( 'is_home', 'is_posts_page' );
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this-&gt;assertEquals( $page_id, $wp_query-&gt;get_queried_object()-&gt;ID );
-        }
-
-        // FIXME: no tests for these yet
-        // 'about/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        // 'about/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-
-        // 'feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
-        // '(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]',
-        function test_main_feed_2() {
-                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
-                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-
-                // long version
-                foreach ($feeds as $feed) {
-                        $this-&gt;go_to(&quot;/feed/{$feed}/&quot;);
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-
-                // short version
-                foreach ($feeds as $feed) {
-                        $this-&gt;go_to(&quot;/{$feed}/&quot;);
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-
-        }
-
-        function test_main_feed() {
-                $this-&gt;factory-&gt;post-&gt;create(); // @test_404
-                $types = array('rss2', 'rss', 'atom');
-                foreach ($types as $type) {
-                        $this-&gt;go_to(get_feed_link($type));
-                        $this-&gt;assertQueryTrue('is_feed');
-                }
-        }
-
-        // 'page/?([0-9]{1,})/?$' =&gt; 'index.php?&amp;paged=$matches[1]',
-        function test_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 15 );
-                for ( $i = 2; $i &lt;= 3; $i++ ) {
-                        $this-&gt;go_to(&quot;/page/{$i}/&quot;);
-                        $this-&gt;assertQueryTrue('is_home', 'is_paged');
-                }
-        }
-
-        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
-        // 'comments/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?&amp;feed=$matches[1]&amp;withcomments=1',
-        function test_main_comments_feed() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'hello-world' ) );
-                $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post_id, 2 );
-
-                // check the url as generated by get_post_comments_feed_link()
-                $this-&gt;go_to( get_post_comments_feed_link( $post_id ) );
-                $this-&gt;assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/comments/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/comments/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-        }
-
-        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
-        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?s=$matches[1]&amp;feed=$matches[2]',
-        function test_search_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/search/test/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/search/test/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_feed', 'is_search');
-                }
-        }
-
-        // 'search/(.+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?s=$matches[1]&amp;paged=$matches[2]',
-        function test_search_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_title' =&gt; 'test' ) );
-                $this-&gt;go_to('/search/test/page/2/');
-                $this-&gt;assertQueryTrue('is_search', 'is_paged');
-        }
-
-        // 'search/(.+)/?$' =&gt; 'index.php?s=$matches[1]',
-        function test_search() {
-                $this-&gt;go_to('/search/test/');
-                $this-&gt;assertQueryTrue('is_search');
-        }
-
-        /**
-         * @ticket 13961
-         */
-        function test_search_encoded_chars() {
-                $this-&gt;go_to('/search/F%C3%BCnf%2Bbar/');
-                $this-&gt;assertEquals( get_query_var( 's' ), 'Fünf+bar' );
-        }
-
-        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
-        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?category_name=$matches[1]&amp;feed=$matches[2]',
-        function test_category_feed() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/category/cat-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/category/cat-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-        }
-
-        // 'category/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?category_name=$matches[1]&amp;paged=$matches[2]',
-        function test_category_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10 );
-                $this-&gt;go_to('/category/uncategorized/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_category', 'is_paged');
-        }
-
-        // 'category/(.+?)/?$' =&gt; 'index.php?category_name=$matches[1]',
-        function test_category() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'cat-a', 'taxonomy' =&gt; 'category' ) );
-                $this-&gt;go_to('/category/cat-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_category');
-        }
-
-        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
-        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?tag=$matches[1]&amp;feed=$matches[2]',
-        function test_tag_feed() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/tag/tag-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/tag/tag-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-        }
-
-        // 'tag/(.+?)/page/?([0-9]{1,})/?$' =&gt; 'index.php?tag=$matches[1]&amp;paged=$matches[2]',
-        function test_tag_paged() {
-                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( 10 );
-                foreach ( $post_ids as $post_id )
-                        $this-&gt;factory-&gt;term-&gt;add_post_terms( $post_id, 'tag-a', 'post_tag' );
-                $this-&gt;go_to('/tag/tag-a/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_tag', 'is_paged');
-        }
-
-        // 'tag/(.+?)/?$' =&gt; 'index.php?tag=$matches[1]',
-        function test_tag() {
-                $this-&gt;factory-&gt;term-&gt;create( array( 'name' =&gt; 'tag-a', 'taxonomy' =&gt; 'post_tag' ) );
-                $this-&gt;go_to('/tag/tag-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_tag');
-        }
-
-        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
-        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?author_name=$matches[1]&amp;feed=$matches[2]',
-        function test_author_feed() {
-                $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/author/user-a/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/author/user-a/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-        }
-
-        // 'author/([^/]+)/page/?([0-9]{1,})/?$' =&gt; 'index.php?author_name=$matches[1]&amp;paged=$matches[2]',
-        function test_author_paged() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_author' =&gt; $user_id ) );
-                $this-&gt;go_to('/author/user-a/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author', 'is_paged');
-        }
-
-        // 'author/([^/]+)/?$' =&gt; 'index.php?author_name=$matches[1]',
-        function test_author() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $user_id ) );
-                $this-&gt;go_to('/author/user-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author');
-        }
-
-        function test_author_with_no_posts() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'user_login' =&gt; 'user-a' ) );
-                $this-&gt;go_to('/author/user-a/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_author');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;feed=$matches[4]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;feed=$matches[4]',
-        function test_ymd_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/04/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/04/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;paged=$matches[4]',
-        function test_ymd_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/04/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]',
-        function test_ymd() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/04/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_day', 'is_date');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
-        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;feed=$matches[3]',
-        function test_ym_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/09/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;paged=$matches[3]',
-        function test_ym_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]',
-        function test_ym() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/09/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_month');
-        }
-
-        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
-        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;feed=$matches[2]',
-        function test_y_feed() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;/2007/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/page/?([0-9]{1,})/?$' =&gt; 'index.php?year=$matches[1]&amp;paged=$matches[2]',
-        function test_y_paged() {
-                $this-&gt;factory-&gt;post-&gt;create_many( 10, array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/page/2/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
-        }
-
-        // '([0-9]{4})/?$' =&gt; 'index.php?year=$matches[1]',
-        function test_y() {
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_date' =&gt; '2007-09-04 00:00:00' ) );
-                $this-&gt;go_to('/2007/');
-                $this-&gt;assertQueryTrue('is_archive', 'is_date', 'is_year');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;tb=1',
-        function test_post_trackback() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $permalink = get_permalink( $post_id );
-                $this-&gt;go_to(&quot;{$permalink}trackback/&quot;);
-                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_trackback');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;feed=$matches[5]',
-        function test_post_comment_feed() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-                $permalink = get_permalink( $post_id );
-
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;{$permalink}feed/{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this-&gt;go_to(&quot;{$permalink}{$type}&quot;);
-                                $this-&gt;assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' =&gt; 'index.php?year=$matches[1]&amp;monthnum=$matches[2]&amp;day=$matches[3]&amp;name=$matches[4]&amp;page=$matches[5]',
-        function test_post_paged_short() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array(
-                        'post_date' =&gt; '2007-09-04 00:00:00',
-                        'post_title' =&gt; 'a-post-with-multiple-pages',
-                        'post_content' =&gt; 'Page 1 &lt;!--nextpage--&gt; Page 2'
-                ) );
-                $this-&gt;go_to( get_permalink( $post_id ) . '2/' );
-                // should is_paged be true also?
-                $this-&gt;assertQueryTrue('is_single', 'is_singular');
-
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        function test_post_attachment() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_type' =&gt; 'attachment' ) );
-                $permalink = get_attachment_link( $post_id );
-                $this-&gt;go_to($permalink);
-                $this-&gt;assertQueryTrue('is_single', 'is_attachment', 'is_singular');
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' =&gt; 'index.php?attachment=$matches[1]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' =&gt; 'index.php?attachment=$matches[1]&amp;tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' =&gt; 'index.php?attachment=$matches[1]&amp;feed=$matches[2]',
-}
-
-/**
- * @group query
- * @group rewrite
- */
-class TestWPQueryVerbosePageRules extends TestWPQueryVars {
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                update_option( 'permalink_structure', '/%category%/%year%/%postname%/' );
-                create_initial_taxonomies();
-                $GLOBALS['wp_rewrite']-&gt;init();
-                flush_rewrite_rules();
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_query_resultsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_query_results.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_query_results.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_query_results.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,285 +0,0 @@
</span><del>-&lt;?php
-
-/**
- *
- * Test various query vars and make sure the WP_Query class selects the correct posts.
- * We're testing against a known data set, so we can check that specific posts are included in the output.
- *
- * @group query
- */
-class TestWPQueryPosts extends WP_UnitTestCase {
-        protected $q;
-
-        function setUp() {
-                parent::setUp();
-
-                $cat_a = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-a' ) );
-                $cat_b = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-b' ) );
-                $cat_c = $this-&gt;factory-&gt;term-&gt;create( array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'cat-c' ) );
-
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-b-c', 'post_date' =&gt; '2008-12-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_b, $cat_c ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-and-b', 'post_date' =&gt; '2009-01-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_b ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-b-and-c', 'post_date' =&gt; '2009-02-01 00:00:00', 'post_category' =&gt; array( $cat_b, $cat_c ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cats-a-and-c', 'post_date' =&gt; '2009-03-01 00:00:00', 'post_category' =&gt; array( $cat_a, $cat_c ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-a', 'post_date' =&gt; '2009-04-01 00:00:00', 'post_category' =&gt; array( $cat_a ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-b', 'post_date' =&gt; '2009-05-01 00:00:00', 'post_category' =&gt; array( $cat_b ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'cat-c', 'post_date' =&gt; '2009-06-01 00:00:00', 'post_category' =&gt; array( $cat_c ) ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'lorem-ipsum', 'post_date' =&gt; '2009-07-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'comment-test', 'post_date' =&gt; '2009-08-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'one-trackback', 'post_date' =&gt; '2009-09-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'many-trackbacks', 'post_date' =&gt; '2009-10-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'no-comments', 'post_date' =&gt; '2009-10-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'one-comment', 'post_date' =&gt; '2009-11-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'contributor-post-approved', 'post_date' =&gt; '2009-12-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'embedded-video', 'post_date' =&gt; '2010-01-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'simple-markup-test', 'post_date' =&gt; '2010-02-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'raw-html-code', 'post_date' =&gt; '2010-03-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-b-c', 'tags_input' =&gt; array( 'tag-a', 'tag-b', 'tag-c' ), 'post_date' =&gt; '2010-04-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-a', 'tags_input' =&gt; array( 'tag-a' ), 'post_date' =&gt; '2010-05-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-b', 'tags_input' =&gt; array( 'tag-b' ), 'post_date' =&gt; '2010-06-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tag-c', 'tags_input' =&gt; array( 'tag-c' ), 'post_date' =&gt; '2010-07-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-and-b', 'tags_input' =&gt; array( 'tag-a', 'tag-b' ), 'post_date' =&gt; '2010-08-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-b-and-c', 'tags_input' =&gt; array( 'tag-b', 'tag-c' ), 'post_date' =&gt; '2010-09-01 00:00:00' ) );
-                $this-&gt;factory-&gt;post-&gt;create( array( 'post_title' =&gt; 'tags-a-and-c', 'tags_input' =&gt; array( 'tag-a', 'tag-c' ), 'post_date' =&gt; '2010-10-01 00:00:00' ) );
-
-                unset( $this-&gt;q );
-                $this-&gt;q = new WP_Query();
-        }
-
-        function test_query_default() {
-                $posts = $this-&gt;q-&gt;query('');
-
-                // the output should be the most recent 10 posts as listed here
-                $expected = array(
-                        0 =&gt; 'tags-a-and-c',
-                        1 =&gt; 'tags-b-and-c',
-                        2 =&gt; 'tags-a-and-b',
-                        3 =&gt; 'tag-c',
-                        4 =&gt; 'tag-b',
-                        5 =&gt; 'tag-a',
-                        6 =&gt; 'tags-a-b-c',
-                        7 =&gt; 'raw-html-code',
-                        8 =&gt; 'simple-markup-test',
-                        9 =&gt; 'embedded-video',
-                );
-
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_tag_a() {
-                $posts = $this-&gt;q-&gt;query('tag=tag-a');
-
-                // there are 4 posts with Tag A
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-a', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
-        }
-
-        function test_query_tag_b() {
-                $posts = $this-&gt;q-&gt;query('tag=tag-b');
-
-                // there are 4 posts with Tag A
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertEquals( 'tags-b-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-b', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
-        }
-
-        function test_query_tag_id() {
-                $tag = tag_exists('tag-a');
-                $posts = $this-&gt;q-&gt;query(&quot;tag_id={$tag[term_id]}&quot;);
-
-                // there are 4 posts with Tag A
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-and-b', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-a', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-b-c', $posts[3]-&gt;post_name );
-        }
-
-        function test_query_tag_slug__in() {
-                $posts = $this-&gt;q-&gt;query(&quot;tag_slug__in[]=tag-b&amp;tag_slug__in[]=tag-c&quot;);
-
-                // there are 4 posts with either Tag B or Tag C
-                $this-&gt;assertCount( 6, $posts );
-                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-b-and-c', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-and-b', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-c', $posts[3]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-b', $posts[4]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-b-c', $posts[5]-&gt;post_name );
-        }
-
-
-        function test_query_tag__in() {
-                $tag_a = tag_exists('tag-a');
-                $tag_b = tag_exists('tag-b');
-                $posts = $this-&gt;q-&gt;query(&quot;tag__in[]={$tag_a[term_id]}&amp;tag__in[]={$tag_b[term_id]}&quot;);
-
-                // there are 6 posts with either Tag A or Tag B
-                $this-&gt;assertCount( 6, $posts );
-                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-b-and-c', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-and-b', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-b', $posts[3]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-a', $posts[4]-&gt;post_name );
-                $this-&gt;assertEquals( 'tags-a-b-c', $posts[5]-&gt;post_name );
-        }
-
-        function test_query_tag__not_in() {
-                $tag_a = tag_exists('tag-a');
-                $posts = $this-&gt;q-&gt;query(&quot;tag__not_in[]={$tag_a[term_id]}&quot;);
-
-                // the most recent 10 posts with Tag A excluded
-                // (note the different between this and test_query_default)
-                $expected = array (
-                        0 =&gt; 'tags-b-and-c',
-                        1 =&gt; 'tag-c',
-                        2 =&gt; 'tag-b',
-                        3 =&gt; 'raw-html-code',
-                        4 =&gt; 'simple-markup-test',
-                        5 =&gt; 'embedded-video',
-                        6 =&gt; 'contributor-post-approved',
-                        7 =&gt; 'one-comment',
-                        8 =&gt; 'no-comments',
-                        9 =&gt; 'many-trackbacks',
-                );
-
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_tag__in_but__not_in() {
-                $tag_a = tag_exists('tag-a');
-                $tag_b = tag_exists('tag-b');
-                $posts = $this-&gt;q-&gt;query(&quot;tag__in[]={$tag_a[term_id]}&amp;tag__not_in[]={$tag_b[term_id]}&quot;);
-
-                // there are 4 posts with Tag A, only 2 when we exclude Tag B
-                $this-&gt;assertCount( 2, $posts );
-                $this-&gt;assertEquals( 'tags-a-and-c', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'tag-a', $posts[1]-&gt;post_name );
-        }
-
-
-
-        function test_query_category_name() {
-                $posts = $this-&gt;q-&gt;query('category_name=cat-a');
-
-                // there are 4 posts with Cat A, we'll check for them by name
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertEquals( 'cat-a', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-a-and-c', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-a-and-b', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-a-b-c', $posts[3]-&gt;post_name );
-        }
-
-        function test_query_cat() {
-                $cat = category_exists('cat-b');
-                $posts = $this-&gt;q-&gt;query(&quot;cat=$cat&quot;);
-
-                // there are 4 posts with Cat B
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertEquals( 'cat-b', $posts[0]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-b-and-c', $posts[1]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-a-and-b', $posts[2]-&gt;post_name );
-                $this-&gt;assertEquals( 'cats-a-b-c', $posts[3]-&gt;post_name );
-        }
-
-        function test_query_posts_per_page() {
-                $posts = $this-&gt;q-&gt;query('posts_per_page=5');
-
-                $expected = array (
-                        0 =&gt; 'tags-a-and-c',
-                        1 =&gt; 'tags-b-and-c',
-                        2 =&gt; 'tags-a-and-b',
-                        3 =&gt; 'tag-c',
-                        4 =&gt; 'tag-b',
-                );
-
-                $this-&gt;assertCount( 5, $posts );
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_offset() {
-                $posts = $this-&gt;q-&gt;query('offset=2');
-
-                $expected = array (
-                        0 =&gt; 'tags-a-and-b',
-                        1 =&gt; 'tag-c',
-                        2 =&gt; 'tag-b',
-                        3 =&gt; 'tag-a',
-                        4 =&gt; 'tags-a-b-c',
-                        5 =&gt; 'raw-html-code',
-                        6 =&gt; 'simple-markup-test',
-                        7 =&gt; 'embedded-video',
-                        8 =&gt; 'contributor-post-approved',
-                        9 =&gt; 'one-comment',
-                );
-
-                $this-&gt;assertCount( 10, $posts );
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_paged() {
-                $posts = $this-&gt;q-&gt;query('paged=2');
-
-                $expected = array (
-                        0 =&gt; 'contributor-post-approved',
-                        1 =&gt; 'one-comment',
-                        2 =&gt; 'no-comments',
-                        3 =&gt; 'many-trackbacks',
-                        4 =&gt; 'one-trackback',
-                        5 =&gt; 'comment-test',
-                        6 =&gt; 'lorem-ipsum',
-                        7 =&gt; 'cat-c',
-                        8 =&gt; 'cat-b',
-                        9 =&gt; 'cat-a',
-                );
-
-                $this-&gt;assertCount( 10, $posts );
-                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_paged_and_posts_per_page() {
-                $posts = $this-&gt;q-&gt;query('paged=4&amp;posts_per_page=4');
-
-                $expected = array (
-                        0 =&gt; 'no-comments',
-                        1 =&gt; 'many-trackbacks',
-                        2 =&gt; 'one-trackback',
-                        3 =&gt; 'comment-test',
-                );
-
-                $this-&gt;assertCount( 4, $posts );
-                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        /**
-         * @ticket 18897
-         */
-        function test_query_offset_and_paged() {
-                $posts = $this-&gt;q-&gt;query('paged=2&amp;offset=3');
-
-                $expected = array (
-                        0 =&gt; 'many-trackbacks',
-                        1 =&gt; 'one-trackback',
-                        2 =&gt; 'comment-test',
-                        3 =&gt; 'lorem-ipsum',
-                        4 =&gt; 'cat-c',
-                        5 =&gt; 'cat-b',
-                        6 =&gt; 'cat-a',
-                        7 =&gt; 'cats-a-and-c',
-                        8 =&gt; 'cats-b-and-c',
-                        9 =&gt; 'cats-a-and-b',
-                );
-
-                $this-&gt;assertCount( 10, $posts );
-                $this-&gt;assertTrue( $this-&gt;q-&gt;is_paged() );
-                $this-&gt;assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_shortcodephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_shortcode.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_shortcode.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_shortcode.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,294 +0,0 @@
</span><del>-&lt;?php
-/**
- * @group shortcodes
- */
-class TestShortcode extends WP_UnitTestCase {
-
-        protected $shortcodes = array( 'footag', 'bartag', 'baztag', 'dumptag' );
-
-        function setUp() {
-                parent::setUp();
-                add_shortcode('test-shortcode-tag', array(&amp;$this, '_shortcode_tag'));
-
-                foreach ( $this-&gt;shortcodes as $shortcode )
-                        add_shortcode( $shortcode, array( $this, '_shortcode_' . $shortcode ) );
-
-                $this-&gt;atts = null;
-                $this-&gt;content = null;
-                $this-&gt;tagname = null;
-
-        }
-
-        function tearDown() {
-                global $shortcode_tags;
-                parent::tearDown();
-                foreach ( $this-&gt;shortcodes as $shortcode )
-                        unset( $shortcode_tags[ $shortcode ] );
-                unset( $shortcode_tags['test-shortcode-tag'] );
-        }
-
-        // [footag foo=&quot;bar&quot;]
-        function _shortcode_footag( $atts ) {
-                return @&quot;foo = {$atts['foo']}&quot;;
-        }
-
-        // [bartag foo=&quot;bar&quot;]
-        function _shortcode_bartag( $atts ) {
-                extract(shortcode_atts(array(
-                        'foo' =&gt; 'no foo',
-                        'baz' =&gt; 'default baz',
-                ), $atts));
-
-                return &quot;foo = {$foo}&quot;;
-        }
-
-        // [baztag]content[/baztag]
-        function _shortcode_baztag( $atts, $content = '' ) {
-                return 'content = '.do_shortcode($content);
-        }
-
-        function _shortcode_dumptag( $atts ) {
-                $out = '';
-                foreach ($atts as $k=&gt;$v)
-                        $out .= &quot;$k = $v\n&quot;;
-                return $out;
-        }
-
-        function _shortcode_tag($atts, $content=NULL, $tagname=NULL) {
-                $this-&gt;atts = $atts;
-                $this-&gt;content = $content;
-                $this-&gt;tagname = $tagname;
-        }
-
-        function test_noatts() {
-                do_shortcode('[test-shortcode-tag /]');
-                $this-&gt;assertEquals( '', $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_one_att() {
-                do_shortcode('[test-shortcode-tag foo=&quot;asdf&quot; /]');
-                $this-&gt;assertEquals( array('foo' =&gt; 'asdf'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_not_a_tag() {
-                $out = do_shortcode('[not-a-shortcode-tag]');
-                $this-&gt;assertEquals( '[not-a-shortcode-tag]', $out );
-        }
-
-        function test_two_atts() {
-                do_shortcode('[test-shortcode-tag foo=&quot;asdf&quot; bar=&quot;bing&quot; /]');
-                $this-&gt;assertEquals( array('foo' =&gt; 'asdf', 'bar' =&gt; 'bing'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_noatts_enclosing() {
-                do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]');
-                $this-&gt;assertEquals( '', $this-&gt;atts );
-                $this-&gt;assertEquals( 'content', $this-&gt;content );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_one_att_enclosing() {
-                do_shortcode('[test-shortcode-tag foo=&quot;bar&quot;]content[/test-shortcode-tag]');
-                $this-&gt;assertEquals( array('foo' =&gt; 'bar'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'content', $this-&gt;content );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_two_atts_enclosing() {
-                do_shortcode('[test-shortcode-tag foo=&quot;bar&quot; baz=&quot;bing&quot;]content[/test-shortcode-tag]');
-                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'baz' =&gt; 'bing'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'content', $this-&gt;content );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_unclosed() {
-                $out = do_shortcode('[test-shortcode-tag]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( '', $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_positional_atts_num() {
-                $out = do_shortcode('[test-shortcode-tag 123]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( array(0=&gt;'123'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_positional_atts_url() {
-                $out = do_shortcode('[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( array(0=&gt;'http://www.youtube.com/watch?v=eBGIQ7ZuuiU'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_positional_atts_quotes() {
-                $out = do_shortcode('[test-shortcode-tag &quot;something in quotes&quot; &quot;something else&quot;]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( array(0=&gt;'something in quotes', 1=&gt;'something else'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_positional_atts_mixed() {
-                $out = do_shortcode('[test-shortcode-tag 123 http://wordpress.com/ 0 &quot;foo&quot; bar]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( array(0=&gt;'123', 1=&gt;'http://wordpress.com/', 2=&gt;'0', 3=&gt;'foo', 4=&gt;'bar'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_positional_and_named_atts() {
-                $out = do_shortcode('[test-shortcode-tag 123 url=http://wordpress.com/ foo bar=&quot;baz&quot;]');
-                $this-&gt;assertEquals( '', $out );
-                $this-&gt;assertEquals( array(0=&gt;'123', 'url' =&gt; 'http://wordpress.com/', 1=&gt;'foo', 'bar' =&gt; 'baz'), $this-&gt;atts );
-                $this-&gt;assertEquals( 'test-shortcode-tag', $this-&gt;tagname );
-        }
-
-        function test_footag_default() {
-                $out = do_shortcode('[footag]');
-                $this-&gt;assertEquals('foo = ', $out);
-        }
-
-        function test_footag_val() {
-                $val = rand_str();
-                $out = do_shortcode('[footag foo=&quot;'.$val.'&quot;]');
-                $this-&gt;assertEquals('foo = '.$val, $out);
-        }
-
-        function test_nested_tags() {
-                $out = do_shortcode('[baztag][dumptag abc=&quot;foo&quot; def=123 http://wordpress.com/][/baztag]');
-                $expected = &quot;content = abc = foo\ndef = 123\n0 = http://wordpress.com\n&quot;;
-                $this-&gt;assertEquals($expected, $out);
-        }
-
-        /**
-         * @ticket 6518
-         */
-        function test_tag_escaped() {
-                $out = do_shortcode('[[footag]] [[bartag foo=&quot;bar&quot;]]');
-                $this-&gt;assertEquals('[footag] [bartag foo=&quot;bar&quot;]', $out);
-
-                $out = do_shortcode('[[footag /]] [[bartag foo=&quot;bar&quot; /]]');
-                $this-&gt;assertEquals('[footag /] [bartag foo=&quot;bar&quot; /]', $out);
-
-                $out = do_shortcode('[[baztag foo=&quot;bar&quot;]the content[/baztag]]');
-                $this-&gt;assertEquals('[baztag foo=&quot;bar&quot;]the content[/baztag]', $out);
-
-                // double escaped
-                $out = do_shortcode('[[[footag]]] [[[bartag foo=&quot;bar&quot;]]]');
-                $this-&gt;assertEquals('[[footag]] [[bartag foo=&quot;bar&quot;]]', $out);
-        }
-
-        function test_tag_not_escaped() {
-                // these have square brackets on either end but aren't actually escaped
-                $out = do_shortcode('[[footag] [bartag foo=&quot;bar&quot;]]');
-                $this-&gt;assertEquals('[foo =  foo = bar]', $out);
-
-                $out = do_shortcode('[[footag /] [bartag foo=&quot;bar&quot; /]]');
-                $this-&gt;assertEquals('[foo =  foo = bar]', $out);
-
-                $out = do_shortcode('[[baztag foo=&quot;bar&quot;]the content[/baztag]');
-                $this-&gt;assertEquals('[content = the content', $out);
-
-                $out = do_shortcode('[[not-a-tag]]');
-                $this-&gt;assertEquals('[[not-a-tag]]', $out);
-
-                $out = do_shortcode('[[[footag] [bartag foo=&quot;bar&quot;]]]');
-                $this-&gt;assertEquals('[[foo =  foo = bar]]', $out);
-        }
-
-        function test_mixed_tags() {
-                $in = &lt;&lt;&lt;EOF
-So this is a post with [footag foo=&quot;some stuff&quot;] and a bunch of tags.
-
-[bartag]
-
-[baztag]
-Here's some content
-on more than one line
-[/baztag]
-
-[bartag foo=1] [baztag] [footag foo=&quot;2&quot;] [baztag]
-
-[baztag]
-more content
-[/baztag]
-
-EOF;
-                $expected = &lt;&lt;&lt;EOF
-So this is a post with foo = some stuff and a bunch of tags.
-
-foo = no foo
-
-content =
-Here's some content
-on more than one line
-
-
-foo = 1 content =  foo = 2 content =
-content =
-more content
-
-EOF;
-                $out = do_shortcode($in);
-                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
-        }
-
-        /**
-         * @ticket 6562
-         *
-         * @TODO Review this test as it may be incorrect
-         */
-        function test_utf8_whitespace_1() {
-                do_shortcode(&quot;[test-shortcode-tag foo=\&quot;bar\&quot; \x00\xA0baz=\&quot;123\&quot;]&quot;);
-                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'baz' =&gt; '123'), $this-&gt;atts );
-                $this-&gt;assertEquals( '', $this-&gt;content );
-        }
-
-        /**
-         * @ticket 6562
-         *
-         * @TODO Review this test as it may be incorrect
-         */
-        function test_utf8_whitespace_2() {
-                do_shortcode(&quot;[test-shortcode-tag foo=\&quot;bar\&quot; \x20\x0babc=\&quot;def\&quot;]&quot;);
-                $this-&gt;assertEquals( array('foo' =&gt; 'bar', 'abc' =&gt; 'def'), $this-&gt;atts );
-                $this-&gt;assertEquals( '', $this-&gt;content );
-        }
-
-        function test_shortcode_unautop() {
-                // a blank line is added at the end, so test with it already there
-                $test_string = &lt;&lt;&lt;EOF
-[footag]
-
-EOF;
-
-                $this-&gt;assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
-        }
-
-        /**
-         * @ticket 14050
-         */
-        function test_multiple_shortcode_unautop() {
-                // a blank line is added at the end, so test with it already there
-                $test_string = &lt;&lt;&lt;EOF
-[footag]
-[footag]
-
-EOF;
-
-                $actual = shortcode_unautop( wpautop( $test_string ) );
-                $this-&gt;assertEquals( $test_string, $actual );
-        }
-
-        /**
-         * @ticket 10326
-         */
-        function test_strip_shortcodes() {
-                $this-&gt;assertEquals('before', strip_shortcodes('before[gallery]'));
-                $this-&gt;assertEquals('after', strip_shortcodes('[gallery]after'));
-                $this-&gt;assertEquals('beforeafter', strip_shortcodes('before[gallery]after'));
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_uploadsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_uploads.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_uploads.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_uploads.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-&lt;?php
-
-
-/**
- * @group upload
- * @group media
- */
-class TestUploadFunctions extends WP_UnitTestCase {
-
-        var $siteurl;
-
-        function setUp() {
-                if ( is_multisite() )
-                        $this-&gt;knownUTBug( 35 );
-
-                parent::setUp();
-                return;
-                // system defaults
-                update_option( 'upload_path', 'wp-content/uploads' );
-                update_option( 'upload_url_path', '' );
-                update_option( 'uploads_use_yearmonth_folders', 1 );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                // Remove year/month folders created by wp_upload_dir().
-                $uploads = wp_upload_dir();
-                foreach ( scandir( $uploads['basedir'] ) as $file )
-                        _rmdir( $uploads['basedir'] . '/' . $file );
-                _rmdir( ABSPATH . 'foo/' );
-        }
-
-        function test_upload_dir_default() {
-                // wp_upload_dir() with default parameters
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_dir_relative() {
-                // wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'
-                update_option( 'upload_path', 'foo/bar' );
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this-&gt;assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-        /**
-         * @ticket 5953
-         */
-        function test_upload_dir_absolute() {
-                $path = '/tmp/wp-unit-test';
-                // wp_upload_dir() with an absolute upload path
-                update_option( 'upload_path', $path );
-                // doesn't make sense to use an absolute file path without setting the url path
-                update_option( 'upload_url_path', '/baz' );
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this-&gt;assertEquals( &quot;$path/&quot; . gmstrftime('%Y/%m'), $info['path'] );
-                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_dir_no_yearnum() {
-                update_option( 'uploads_use_yearmonth_folders', 0 );
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
-                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
-                $this-&gt;assertEquals( '', $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_path_absolute() {
-                update_option( 'upload_url_path', 'http://example.org/asdf' );
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_dir_empty() {
-                // upload path setting is empty - it should default to 'wp-content/uploads'
-                update_option('upload_path', '');
-                $info = wp_upload_dir();
-                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this-&gt;assertEquals( '', $info['error'] );
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_userphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_user.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_user.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_user.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,508 +0,0 @@
</span><del>-&lt;?php
-
-// test functions in wp-includes/user.php
-/**
- * @group user
- */
-class TestWPUser extends WP_UnitTestCase {
-
-        protected $_deprecated_errors = array();
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;_deprecated_errors = array();
-        }
-
-        public function deprecated_handler( $function, $message, $version ) {
-                $this-&gt;_deprecated_errors[] = array(
-                        'function' =&gt; $function,
-                        'message'  =&gt; $message,
-                        'version'  =&gt; $version
-                );
-        }
-
-        function test_get_users_of_blog() {
-                // add one of each user role
-                $user_role = array();
-                foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
-                        $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role ) );
-                        $user_role[ $id ] = $role;
-                }
-
-                $user_list = get_users_of_blog();
-
-                // find the role of each user as returned by get_users_of_blog
-                $found = array();
-                foreach ( $user_list as $user ) {
-                        // only include the users we just created - there might be some others that existed previously
-                        if ( isset( $user_role[$user-&gt;user_id] ) ) {
-                                $roles = array_keys( unserialize( $user-&gt;meta_value ) );
-                                $found[ $user-&gt;user_id ] = $roles[0];
-                        }
-                }
-
-                // make sure every user we created was returned
-                $this-&gt;assertEquals($user_role, $found);
-        }
-
-        // simple get/set tests for user_option functions
-        function test_user_option() {
-                $key = rand_str();
-                $val = rand_str();
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-
-                // get an option that doesn't exist
-                $this-&gt;assertFalse(get_user_option($key, $user_id));
-
-                // set and get
-                update_user_option( $user_id, $key, $val );
-                $this-&gt;assertEquals( $val, get_user_option($key, $user_id) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_user_option( $user_id, $key, $val2 );
-                $this-&gt;assertEquals( $val2, get_user_option($key, $user_id) );
-
-        }
-
-        // simple tests for usermeta functions
-        function test_usermeta() {
-
-                $key = rand_str();
-                $val = rand_str();
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-
-                // get a meta key that doesn't exist
-                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
-
-                // set and get
-                update_usermeta( $user_id, $key, $val );
-                $this-&gt;assertEquals( $val, get_usermeta($user_id, $key) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_usermeta( $user_id, $key, $val2 );
-                $this-&gt;assertEquals( $val2, get_usermeta($user_id, $key) );
-
-                // delete and get
-                delete_usermeta( $user_id, $key );
-                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
-
-                // delete by key AND value
-                update_usermeta( $user_id, $key, $val );
-                // incorrect key: key still exists
-                delete_usermeta( $user_id, $key, rand_str() );
-                $this-&gt;assertEquals( $val, get_usermeta($user_id, $key) );
-                // correct key: deleted
-                delete_usermeta( $user_id, $key, $val );
-                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
-
-        }
-
-        // test usermeta functions in array mode
-        function test_usermeta_array() {
-                // some values to set
-                $vals = array(
-                        rand_str() =&gt; 'val-'.rand_str(),
-                        rand_str() =&gt; 'val-'.rand_str(),
-                        rand_str() =&gt; 'val-'.rand_str(),
-                );
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-
-                // there is already some stuff in the array
-                $this-&gt;assertTrue(is_array(get_usermeta($user_id)));
-
-                foreach ($vals as $k=&gt;$v)
-                        update_usermeta( $user_id, $k, $v );
-
-                // get the complete usermeta array
-                $out = get_usermeta($user_id);
-
-                // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
-                // so we'll just check to make sure our values are included somewhere.
-                foreach ($vals as $v)
-                        $this-&gt;assertTrue(in_array($v, $out));
-
-                // delete one key and check again
-                $key_to_delete = array_pop(array_keys($vals));
-                delete_usermeta($user_id, $key_to_delete);
-                $out = get_usermeta($user_id);
-                // make sure that key is excluded from the results
-                foreach ($vals as $k=&gt;$v) {
-                        if ($k == $key_to_delete)
-                                $this-&gt;assertFalse(in_array($v, $out));
-                        else
-                                $this-&gt;assertTrue(in_array($v, $out));
-                }
-        }
-
-        // Test property magic functions for property get/set/isset.
-        function test_user_properties() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                foreach ( $user-&gt;data as $key =&gt; $data ) {
-                        $this-&gt;assertEquals( $data, $user-&gt;$key );
-                }
-
-                $this-&gt;assertTrue( isset( $user-&gt;$key ) );
-                $this-&gt;assertFalse( isset( $user-&gt;fooooooooo ) );
-
-                $user-&gt;$key = 'foo';
-                $this-&gt;assertEquals( 'foo', $user-&gt;$key );
-                $this-&gt;assertEquals( 'foo', $user-&gt;data-&gt;$key );  // This will fail with WP &lt; 3.3
-
-                foreach ( (array) $user as $key =&gt; $value ) {
-                        $this-&gt;assertEquals( $value, $user-&gt;$key );
-                }
-        }
-
-        /**
-         * Test the magic __unset method
-         *
-         * @ticket 20043
-         */
-        public function test_user_unset() {
-                // New user
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                // Test custom fields
-                $user-&gt;customField = 123;
-                $this-&gt;assertEquals( $user-&gt;customField, 123 );
-                unset( $user-&gt;customField );
-                $this-&gt;assertFalse( isset( $user-&gt;customField ) );
-
-                // Test 'id' (lowercase)
-                add_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3 );
-                unset( $user-&gt;id );
-                $this-&gt;assertCount( 1, $this-&gt;_deprecated_errors );
-                $this-&gt;assertEquals( 'WP_User-&gt;id', $this-&gt;_deprecated_errors[0]['function'] );
-                $this-&gt;assertEquals( '2.1', $this-&gt;_deprecated_errors[0]['version'] );
-                remove_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3);
-
-                // Test 'ID'
-                $this-&gt;assertNotEmpty( $user-&gt;ID );
-                unset( $user-&gt;ID );
-                $this-&gt;assertEmpty( $user-&gt;ID );
-        }
-
-        // Test meta property magic functions for property get/set/isset.
-        function test_user_meta_properties() {
-                global $wpdb;
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                update_user_option( $user_id, 'foo', 'foo', true );
-
-                $this-&gt;assertTrue( isset( $user-&gt;foo ) );
-
-                $this-&gt;assertEquals( 'foo', $user-&gt;foo );
-        }
-
-        function test_id_property_back_compat() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $this-&gt;assertTrue( isset( $user-&gt;id ) );
-                $this-&gt;assertEquals( $user-&gt;ID, $user-&gt;id );
-                $user-&gt;id = 1234;
-                $this-&gt;assertEquals( $user-&gt;ID, $user-&gt;id );
-        }
-
-        /**
-         * ticket 19265
-         */
-        function test_user_level_property_back_compat() {
-                $roles = array(
-                        'administrator' =&gt; 10,
-                        'editor' =&gt; 7,
-                        'author' =&gt; 2,
-                        'contributor' =&gt; 1,
-                        'subscriber' =&gt; 0,
-                );
-
-                foreach ( $roles as $role =&gt; $level ) {
-                        $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role ) );
-                        $user = new WP_User( $user_id );
-
-                        $this-&gt;assertTrue( isset( $user-&gt;user_level ) );
-                        $this-&gt;assertEquals( $level, $user-&gt;user_level );
-                }
-        }
-
-        function test_construction() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-
-                $user = new WP_User( $user_id );
-                $this-&gt;assertInstanceOf( 'WP_User', $user );
-                $this-&gt;assertEquals( $user_id, $user-&gt;ID );
-
-                $user2 = new WP_User( 0,  $user-&gt;user_login );
-                $this-&gt;assertInstanceOf( 'WP_User', $user2 );
-                $this-&gt;assertEquals( $user_id, $user2-&gt;ID );
-                $this-&gt;assertEquals( $user-&gt;user_login, $user2-&gt;user_login );
-
-                $user3 = new WP_User();
-                $this-&gt;assertInstanceOf( 'WP_User', $user3 );
-                $this-&gt;assertEquals( 0, $user3-&gt;ID );
-                $this-&gt;assertFalse( isset( $user3-&gt;user_login ) );
-
-                $user3-&gt;init( $user-&gt;data );
-                $this-&gt;assertEquals( $user_id, $user3-&gt;ID );
-
-                $user4 = new WP_User( $user-&gt;user_login );
-                $this-&gt;assertInstanceOf( 'WP_User', $user4 );
-                $this-&gt;assertEquals( $user_id, $user4-&gt;ID );
-                $this-&gt;assertEquals( $user-&gt;user_login, $user4-&gt;user_login );
-
-                $user5 = new WP_User( null, $user-&gt;user_login );
-                $this-&gt;assertInstanceOf( 'WP_User', $user5 );
-                $this-&gt;assertEquals( $user_id, $user5-&gt;ID );
-                $this-&gt;assertEquals( $user-&gt;user_login, $user5-&gt;user_login );
-        }
-
-        function test_get() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
-                        'role' =&gt; 'author',
-                        'user_login' =&gt; 'test_wp_user_get',
-                        'user_pass' =&gt; 'password',
-                        'user_email' =&gt; 'test@test.com',
-                ) );
-
-                $user = new WP_User( $user_id );
-                $this-&gt;assertEquals( 'test_wp_user_get', $user-&gt;get( 'user_login' ) );
-                $this-&gt;assertEquals( 'test@test.com', $user-&gt;get( 'user_email' ) );
-                $this-&gt;assertEquals( 0, $user-&gt;get( 'use_ssl' ) );
-                $this-&gt;assertEquals( '', $user-&gt;get( 'field_that_does_not_exist' ) );
-
-                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
-                $this-&gt;assertEquals( 'abcdefg', $user-&gt;get( 'dashed-key' ) );
-        }
-
-        function test_has_prop() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
-                        'role' =&gt; 'author',
-                        'user_login' =&gt; 'test_wp_user_has_prop',
-                        'user_pass' =&gt; 'password',
-                        'user_email' =&gt; 'test2@test.com',
-                ) );
-
-                $user = new WP_User( $user_id );
-                $this-&gt;assertTrue( $user-&gt;has_prop( 'user_email') );
-                $this-&gt;assertTrue( $user-&gt;has_prop( 'use_ssl' ) );
-                $this-&gt;assertFalse( $user-&gt;has_prop( 'field_that_does_not_exist' ) );
-
-                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
-                $this-&gt;assertTrue( $user-&gt;has_prop( 'dashed-key' ) );
-        }
-
-        function test_update_user() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
-                        'role' =&gt; 'author',
-                        'user_login' =&gt; 'test_wp_update_user',
-                        'user_pass' =&gt; 'password',
-                        'user_email' =&gt; 'test3@test.com',
-                ) );
-                $user = new WP_User( $user_id );
-
-                update_user_meta( $user_id, 'description', 'about me' );
-                $this-&gt;assertEquals( 'about me', $user-&gt;get( 'description' ) );
-
-                $user_data = array( 'ID' =&gt; $user_id, 'display_name' =&gt; 'test user' );
-                wp_update_user( $user_data );
-
-                $user = new WP_User( $user_id );
-                $this-&gt;assertEquals( 'test user', $user-&gt;get( 'display_name' ) );
-
-                // Make sure there is no collateral damage to fields not in $user_data
-                $this-&gt;assertEquals( 'about me', $user-&gt;get( 'description' ) );
-
-                // Test update of fields in _get_additional_user_keys()
-                $user_data = array( 'ID' =&gt; $user_id, 'use_ssl' =&gt; 1, 'show_admin_bar_front' =&gt; 1,
-                                                   'rich_editing' =&gt; 1, 'first_name' =&gt; 'first', 'last_name' =&gt; 'last',
-                                                   'nickname' =&gt; 'nick', 'comment_shortcuts' =&gt; 1, 'admin_color' =&gt; 'classic',
-                                                   'description' =&gt; 'describe', 'aim' =&gt; 'aim', 'yim' =&gt; 'yim', 'jabber' =&gt; 'jabber' );
-                wp_update_user( $user_data );
-
-                $user = new WP_User( $user_id );
-                foreach ( $user_data as $key =&gt; $value )
-                        $this-&gt;assertEquals( $value, $user-&gt;get( $key ), $key );
-        }
-
-        /**
-         * Test that usermeta cache is cleared after user deletion.
-         *
-         * @ticket 19500
-         */
-        function test_get_blogs_of_user() {
-                // Logged out users don't have blogs.
-                $this-&gt;assertEquals( array(), get_blogs_of_user( 0 ) );
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
-                $blogs = get_blogs_of_user( $user_id );
-                $this-&gt;assertEquals( array( 1 ), array_keys( $blogs ) );
-
-                // Non-existent users don't have blogs.
-                if ( is_multisite() )
-                        wpmu_delete_user( $user_id );
-                else
-                        wp_delete_user( $user_id );
-                $this-&gt;assertEquals( array(), get_blogs_of_user( $user_id ) );
-        }
-
-        /**
-         * Test that usermeta cache is cleared after user deletion.
-         *
-         * @ticket 19500
-         */
-        function test_is_user_member_of_blog() {
-                $old_current = get_current_user_id();
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
-                wp_set_current_user( $user_id );
-
-                $this-&gt;assertTrue( is_user_member_of_blog() );
-                $this-&gt;assertTrue( is_user_member_of_blog( 0, 0 ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( $user_id ) );
-                $this-&gt;assertTrue( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
-
-                // Will only remove the user from the current site in multisite; this is desired
-                // and will achieve the desired effect with is_user_member_of_blog().
-                wp_delete_user( $user_id );
-
-                $this-&gt;assertFalse( is_user_member_of_blog( $user_id ) );
-                $this-&gt;assertFalse( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
-
-                wp_set_current_user( $old_current );
-        }
-
-        /**
-         * ticket 19595
-         */
-        function test_global_userdata() {
-                global $userdata, $wpdb;
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
-                wp_set_current_user( $user_id );
-
-                $this-&gt;assertNotEmpty( $userdata );
-                $this-&gt;assertInstanceOf( 'WP_User', $userdata );
-                $this-&gt;assertEquals( $userdata-&gt;ID, $user_id );
-                $prefix = $wpdb-&gt;get_blog_prefix();
-                $cap_key = $prefix . 'capabilities';
-                $this-&gt;assertTrue( isset( $userdata-&gt;$cap_key ) );
-        }
-
-        /**
-         * ticket 19769
-         */
-        function test_global_userdata_is_null_when_logged_out() {
-                global $userdata;
-                wp_set_current_user(0);
-                $this-&gt;assertNull( $userdata );
-        }
-
-        function test_exists() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $this-&gt;assertTrue( $user-&gt;exists() );
-
-                $user = new WP_User( 123456789 );
-
-                $this-&gt;assertFalse( $user-&gt;exists() );
-
-                $user = new WP_User( 0 );
-
-                $this-&gt;assertFalse( $user-&gt;exists() );
-        }
-
-        function test_global_authordata() {
-                global $authordata, $id;
-
-                $old_post_id = $id;
-
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $post = array(
-                        'post_author' =&gt; $user_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_type' =&gt; 'post'
-                );
-
-                // insert a post and make sure the ID is ok
-                $post_id = wp_insert_post( $post );
-                $this-&gt;assertTrue( is_numeric( $post_id ) );
-
-                setup_postdata( get_post( $post_id ) );
-
-                $this-&gt;assertNotEmpty( $authordata );
-                $this-&gt;assertInstanceOf( 'WP_User', $authordata );
-                $this-&gt;assertEquals( $authordata-&gt;ID, $user_id );
-
-                setup_postdata( get_post( $old_post_id ) );
-        }
-
-        function test_delete_user() {
-                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $post = array(
-                        'post_author' =&gt; $user_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_type' =&gt; 'post',
-                );
-
-                // insert a post and make sure the ID is ok
-                $post_id = wp_insert_post($post);
-                $this-&gt;assertTrue(is_numeric($post_id));
-                $this-&gt;assertTrue($post_id &gt; 0);
-
-                $post = get_post( $post_id );
-                $this-&gt;assertEquals( $post_id, $post-&gt;ID );
-
-                $post = array(
-                        'post_author' =&gt; $user_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_type' =&gt; 'nav_menu_item',
-                );
-
-                // insert a post and make sure the ID is ok
-                $nav_id = wp_insert_post($post);
-                $this-&gt;assertTrue(is_numeric($nav_id));
-                $this-&gt;assertTrue($nav_id &gt; 0);
-
-                $post = get_post( $nav_id );
-                $this-&gt;assertEquals( $nav_id, $post-&gt;ID );
-
-                wp_delete_user( $user_id );
-                $user = new WP_User( $user_id );
-                if ( is_multisite() )
-                        $this-&gt;assertTrue( $user-&gt;exists() );
-                else
-                        $this-&gt;assertFalse( $user-&gt;exists() );
-
-                $this-&gt;assertNotNull( get_post( $post_id ) );
-                $this-&gt;assertEquals( 'trash', get_post( $post_id )-&gt;post_status );
-                // nav_menu_item is delete_with_user = false so the nav post should remain published.
-                $this-&gt;assertNotNull( get_post( $nav_id ) );
-                $this-&gt;assertEquals( 'publish', get_post( $nav_id )-&gt;post_status );
-                wp_delete_post( $nav_id, true );
-                $this-&gt;assertNull( get_post( $nav_id ) );
-                wp_delete_post( $post_id, true );
-                $this-&gt;assertNull( get_post( $post_id ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_user_capabilitiesphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_user_capabilities.php (903 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_user_capabilities.php        2012-07-16 17:24:25 UTC (rev 903)
+++ trunk/tests/test_user_capabilities.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -1,541 +0,0 @@
</span><del>-&lt;?php
-
-// Test roles and capabilities via the WP_User class
-
-/**
- * @group user
- * @group capabilities
- */
-class WPTestUserCapabilities extends WP_UnitTestCase {
-        var $user_ids = array();
-
-        function setUp() {
-                parent::setUp();
-                // keep track of users we create
-                $this-&gt;_flush_roles();
-
-                $this-&gt;orig_users = get_users_of_blog();
-        }
-
-        function _flush_roles() {
-                // we want to make sure we're testing against the db, not just in-memory data
-                // this will flush everything and reload it from the db
-                unset($GLOBALS['wp_user_roles']);
-                global $wp_roles;
-                if ( is_object( $wp_roles ) )
-                        $wp_roles-&gt;_init();
-        }
-
-        function _meta_yes_you_can( $can, $key, $post_id, $user_id, $cap, $caps ) {
-                return true;
-        }
-
-        function _meta_no_you_cant( $can, $key, $post_id, $user_id, $cap, $caps ) {
-                return false;
-        }
-
-        function _meta_filter( $meta_value, $meta_key, $meta_type ) {
-                return $meta_value;
-        }
-
-        // test the default roles
-
-        function test_user_administrator() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // make sure the role name is correct
-                $this-&gt;assertEquals(array('administrator'), $user-&gt;roles);
-
-                // check a few of the main capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('switch_themes'));
-                $this-&gt;assertTrue($user-&gt;has_cap('list_users'));
-                $this-&gt;assertTrue($user-&gt;has_cap('manage_options'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_10'));
-        }
-
-        function test_user_editor() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // make sure the role name is correct
-                $this-&gt;assertEquals(array('editor'), $user-&gt;roles);
-
-                // check a few of the main capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('moderate_comments'));
-                $this-&gt;assertTrue($user-&gt;has_cap('manage_categories'));
-                $this-&gt;assertTrue($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_7'));
-
-                // and a few capabilities this user doesn't have
-                $this-&gt;assertFalse($user-&gt;has_cap('switch_themes'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_users'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_8'));
-        }
-
-        function test_user_author() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // make sure the role name is correct
-                $this-&gt;assertEquals(array('author'), $user-&gt;roles);
-
-                // check a few of the main capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertTrue($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_2'));
-
-                // and a few capabilities this user doesn't have
-                $this-&gt;assertFalse($user-&gt;has_cap('moderate_comments'));
-                $this-&gt;assertFalse($user-&gt;has_cap('manage_categories'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_3'));
-        }
-
-        function test_user_contributor() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // make sure the role name is correct
-                $this-&gt;assertEquals(array('contributor'), $user-&gt;roles);
-
-                // check a few of the main capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
-                $this-&gt;assertTrue($user-&gt;has_cap('read'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
-
-                // and a few capabilities this user doesn't have
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
-        }
-
-        function test_user_subscriber() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // make sure the role name is correct
-                $this-&gt;assertEquals(array('subscriber'), $user-&gt;roles);
-
-                // check a few of the main capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('read'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
-
-                // and a few capabilities this user doesn't have
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_1'));
-        }
-
-        // a role that doesn't exist
-        function test_bogus_role() {
-                _disable_wp_die();
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; rand_str() ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // user has no role and no capabilities
-                $this-&gt;assertEquals(array(), $user-&gt;roles);
-                $this-&gt;assertFalse($user-&gt;has_cap('level_0'));
-                _enable_wp_die();
-        }
-
-        // a user with multiple roles
-        function test_user_subscriber_contributor() {
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-                $user-&gt;add_role('contributor');
-
-                // nuke and re-fetch the object to make sure it was stored
-                $user = NULL;
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // user should have two roles now
-                $this-&gt;assertEquals(array('subscriber', 'contributor'), $user-&gt;roles);
-
-                // with contributor capabilities
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
-                $this-&gt;assertTrue($user-&gt;has_cap('read'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
-
-                // but not these
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
-        }
-
-        function test_add_empty_role() {
-                // add_role($role, $display_name, $capabilities = '')
-                // randomly named role with no capabilities
-                global $wp_roles;
-                $role_name = rand_str();
-                add_role($role_name, 'Janitor', array());
-                $this-&gt;_flush_roles();
-                $this-&gt;assertTrue($wp_roles-&gt;is_role($role_name));
-
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
-
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
-
-                // user shouldn't have any capabilities; test a quick sample
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_1'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_0'));
-
-                // clean up
-                remove_role($role_name);
-                $this-&gt;_flush_roles();
-                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
-        }
-
-
-        function test_add_role() {
-                // add_role($role, $display_name, $capabilities = '')
-                // randomly named role with a few capabilities
-                global $wp_roles;
-                $role_name = rand_str();
-                add_role($role_name, 'Janitor', array('edit_posts'=&gt;true, 'edit_pages'=&gt;true, 'level_0'=&gt;true, 'level_1'=&gt;true, 'level_2'=&gt;true));
-                $this-&gt;_flush_roles();
-                $this-&gt;assertTrue($wp_roles-&gt;is_role($role_name));
-
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
-
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
-
-                // the user should have all the above caps
-                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
-                $this-&gt;assertTrue($user-&gt;has_cap('edit_pages'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_2'));
-
-                // shouldn't have any other caps
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_3'));
-
-                // clean up
-                remove_role($role_name);
-                $this-&gt;_flush_roles();
-                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
-        }
-
-        function test_role_add_cap() {
-                // change the capabilites associated with a role and make sure the change is reflected in has_cap()
-
-                global $wp_roles;
-                $role_name = rand_str();
-                add_role( $role_name, 'Janitor', array('level_1'=&gt;true) );
-                $this-&gt;_flush_roles();
-                $this-&gt;assertTrue( $wp_roles-&gt;is_role($role_name) );
-
-                // assign a user to that role
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
-
-                // now add a cap to the role
-                $wp_roles-&gt;add_cap($role_name, 'sweep_floor');
-                $this-&gt;_flush_roles();
-
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
-
-                // the user should have all the above caps
-                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user-&gt;has_cap('sweep_floor'));
-
-                // shouldn't have any other caps
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user-&gt;has_cap('level_4'));
-
-                // clean up
-                remove_role($role_name);
-                $this-&gt;_flush_roles();
-                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
-
-        }
-
-        function test_role_remove_cap() {
-                // change the capabilites associated with a role and make sure the change is reflected in has_cap()
-
-                global $wp_roles;
-                $role_name = rand_str();
-                add_role( $role_name, 'Janitor', array('level_1'=&gt;true, 'sweep_floor'=&gt;true, 'polish_doorknobs'=&gt;true) );
-                $this-&gt;_flush_roles();
-                $this-&gt;assertTrue( $wp_roles-&gt;is_role($role_name) );
-
-                // assign a user to that role
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
-
-                // now remove a cap from the role
-                $wp_roles-&gt;remove_cap($role_name, 'polish_doorknobs');
-                $this-&gt;_flush_roles();
-
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
-
-                // the user should have all the above caps
-                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
-                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user-&gt;has_cap('sweep_floor'));
-
-                // shouldn't have the removed cap
-                $this-&gt;assertFalse($user-&gt;has_cap('polish_doorknobs'));
-
-                // clean up
-                remove_role($role_name);
-                $this-&gt;_flush_roles();
-                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
-
-        }
-
-        function test_user_add_cap() {
-                // add an extra capability to a user
-
-                // there are two contributors
-                $id_1 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
-                $id_2 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
-
-                // user 1 has an extra capability
-                $user_1 = new WP_User($id_1);
-                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
-                $user_1-&gt;add_cap('publish_posts');
-
-                // re-fetch both users from the db
-                $user_1 = new WP_User($id_1);
-                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
-                $user_2 = new WP_User($id_2);
-                $this-&gt;assertTrue($user_2-&gt;exists(), &quot;Problem getting user $id_2&quot;);
-
-                // make sure they're both still contributors
-                $this-&gt;assertEquals(array('contributor'), $user_1-&gt;roles);
-                $this-&gt;assertEquals(array('contributor'), $user_2-&gt;roles);
-
-                // check the extra cap on both users
-                $this-&gt;assertTrue($user_1-&gt;has_cap('publish_posts'));
-                $this-&gt;assertFalse($user_2-&gt;has_cap('publish_posts'));
-
-                // make sure the other caps didn't get messed up
-                $this-&gt;assertTrue($user_1-&gt;has_cap('edit_posts'));
-                $this-&gt;assertTrue($user_1-&gt;has_cap('read'));
-                $this-&gt;assertTrue($user_1-&gt;has_cap('level_1'));
-                $this-&gt;assertTrue($user_1-&gt;has_cap('level_0'));
-                $this-&gt;assertFalse($user_1-&gt;has_cap('upload_files'));
-                $this-&gt;assertFalse($user_1-&gt;has_cap('edit_published_posts'));
-                $this-&gt;assertFalse($user_1-&gt;has_cap('level_2'));
-
-        }
-
-        function test_user_remove_cap() {
-                // add an extra capability to a user then remove it
-
-                // there are two contributors
-                $id_1 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
-                $id_2 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
-
-                // user 1 has an extra capability
-                $user_1 = new WP_User($id_1);
-                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
-                $user_1-&gt;add_cap('publish_posts');
-
-                // now remove the extra cap
-                $user_1-&gt;remove_cap('publish_posts');
-
-                // re-fetch both users from the db
-                $user_1 = new WP_User($id_1);
-                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
-                $user_2 = new WP_User($id_2);
-                $this-&gt;assertTrue($user_2-&gt;exists(), &quot;Problem getting user $id_2&quot;);
-
-                // make sure they're both still contributors
-                $this-&gt;assertEquals(array('contributor'), $user_1-&gt;roles);
-                $this-&gt;assertEquals(array('contributor'), $user_2-&gt;roles);
-
-                // check the removed cap on both users
-                $this-&gt;assertFalse($user_1-&gt;has_cap('publish_posts'));
-                $this-&gt;assertFalse($user_2-&gt;has_cap('publish_posts'));
-
-        }
-
-        function test_user_level_update() {
-                // make sure the user_level is correctly set and changed with the user's role
-
-                // user starts as an author
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // author = user level 2
-                $this-&gt;assertEquals( 2, $user-&gt;user_level );
-
-                // they get promoted to editor - level should get bumped to 7
-                $user-&gt;set_role('editor');
-                $this-&gt;assertEquals( 7, $user-&gt;user_level );
-
-                // demoted to contributor - level is reduced to 1
-                $user-&gt;set_role('contributor');
-                $this-&gt;assertEquals( 1, $user-&gt;user_level );
-
-                // if they have two roles, user_level should be the max of the two
-                $user-&gt;add_role('editor');
-                $this-&gt;assertEquals(array('contributor', 'editor'), $user-&gt;roles);
-                $this-&gt;assertEquals( 7, $user-&gt;user_level );
-        }
-
-        function test_user_remove_all_caps() {
-                // user starts as an author
-                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // add some extra capabilities
-                $user-&gt;add_cap('make_coffee');
-                $user-&gt;add_cap('drink_coffee');
-
-                // re-fetch
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                $this-&gt;assertTrue($user-&gt;has_cap('make_coffee'));
-                $this-&gt;assertTrue($user-&gt;has_cap('drink_coffee'));
-
-                // all caps are removed
-                $user-&gt;remove_all_caps();
-
-                // re-fetch
-                $user = new WP_User($id);
-                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
-
-                // capabilities for the author role should be gone
-#                $this-&gt;assertFalse($user-&gt;has_cap('edit_posts'));
-#                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
-#                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
-#                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
-
-                // the extra capabilities should be gone
-                $this-&gt;assertFalse($user-&gt;has_cap('make_coffee'));
-                $this-&gt;assertFalse($user-&gt;has_cap('drink_coffee'));
-
-                // user level should be empty
-                $this-&gt;assertEmpty( $user-&gt;user_level );
-
-
-        }
-
-        function test_post_meta_caps() {
-                // simple tests for some common meta capabilities
-
-                // Make our author
-                $author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
-
-                // make a post
-                $post = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $author-&gt;ID, 'post_type' =&gt; 'post' ) );
-
-                // the author of the post
-                $this-&gt;assertTrue($author-&gt;exists(), &quot;Problem getting user $author-&gt;ID&quot;);
-
-                // add some other users
-                $admin = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) ) );
-                $author_2 = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
-                $editor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
-                $contributor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) ) );
-
-                // administrators, editors and the post owner can edit it
-                $this-&gt;assertTrue($admin-&gt;has_cap('edit_post', $post));
-                $this-&gt;assertTrue($author-&gt;has_cap('edit_post', $post));
-                $this-&gt;assertTrue($editor-&gt;has_cap('edit_post', $post));
-                // other authors and contributors can't
-                $this-&gt;assertFalse($author_2-&gt;has_cap('edit_post', $post));
-                $this-&gt;assertFalse($contributor-&gt;has_cap('edit_post', $post));
-
-                // administrators, editors and the post owner can delete it
-                $this-&gt;assertTrue($admin-&gt;has_cap('delete_post', $post));
-                $this-&gt;assertTrue($author-&gt;has_cap('delete_post', $post));
-                $this-&gt;assertTrue($editor-&gt;has_cap('delete_post', $post));
-                // other authors and contributors can't
-                $this-&gt;assertFalse($author_2-&gt;has_cap('delete_post', $post));
-                $this-&gt;assertFalse($contributor-&gt;has_cap('delete_post', $post));
-
-                // Test meta authorization callbacks
-                if ( function_exists( 'register_meta') ) {
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta',  $post) );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta',  $post) );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta',  $post) );
-
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('edit_post_meta', $post, '_protected') );
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('add_post_meta', $post, '_protected') );
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('delete_post_meta', $post, '_protected') );
-
-                        register_meta( 'post', '_protected', array( &amp;$this, '_meta_filter' ), array( &amp;$this, '_meta_yes_you_can' ) );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta',  $post, '_protected') );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta',  $post, '_protected') );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta',  $post, '_protected') );
-
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta', $post, 'not_protected') );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta', $post, 'not_protected') );
-                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta', $post, 'not_protected') );
-
-                        register_meta( 'post', 'not_protected', array( &amp;$this, '_meta_filter' ), array( &amp;$this, '_meta_no_you_cant' ) );
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('edit_post_meta',  $post, 'not_protected') );
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('add_post_meta',  $post, 'not_protected') );
-                        $this-&gt;assertFalse( $admin-&gt;has_cap('delete_post_meta',  $post, 'not_protected') );
-                }
-        }
-
-        function test_page_meta_caps() {
-                // simple tests for some common meta capabilities
-
-                // Make our author
-                $author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
-
-                // make a page
-                $page = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $author-&gt;ID, 'post_type' =&gt; 'page' ) );
-
-                // the author of the page
-                $this-&gt;assertTrue($author-&gt;exists(), &quot;Problem getting user &quot; . $author-&gt;ID);
-
-                // add some other users
-                $admin = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) ) );
-                $author_2 = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
-                $editor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
-                $contributor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) ) );
-
-                // administrators, editors and the post owner can edit it
-                $this-&gt;assertTrue($admin-&gt;has_cap('edit_page', $page));
-                $this-&gt;assertTrue($editor-&gt;has_cap('edit_page', $page));
-                // other authors and contributors can't
-                $this-&gt;assertFalse($author-&gt;has_cap('edit_page', $page));
-                $this-&gt;assertFalse($author_2-&gt;has_cap('edit_page', $page));
-                $this-&gt;assertFalse($contributor-&gt;has_cap('edit_page', $page));
-
-                // administrators, editors and the post owner can delete it
-                $this-&gt;assertTrue($admin-&gt;has_cap('delete_page', $page));
-                $this-&gt;assertTrue($editor-&gt;has_cap('delete_page', $page));
-                // other authors and contributors can't
-                $this-&gt;assertFalse($author-&gt;has_cap('delete_page', $page));
-                $this-&gt;assertFalse($author_2-&gt;has_cap('delete_page', $page));
-                $this-&gt;assertFalse($contributor-&gt;has_cap('delete_page', $page));
-        }
-}
</del></span></pre></div>
<a id="trunkteststhemeWPThemephpfromrev903trunkteststest_includes_classwpthemephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/theme/WPTheme.php (from rev 903, trunk/tests/test_includes_class-wp-theme.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/theme/WPTheme.php                                (rev 0)
+++ trunk/tests/theme/WPTheme.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,96 @@
</span><ins>+&lt;?php
+/**
+ * @group themes
+ */
+class Tests_Theme_WPTheme extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;theme_root = realpath( DIR_TESTDATA . '/themedir1' );
+
+                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
+                $GLOBALS['wp_theme_directories'] = array( $this-&gt;theme_root );
+
+                add_filter('theme_root', array(&amp;$this, '_theme_root'));
+                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
+                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
+                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+                parent::tearDown();
+        }
+
+        // replace the normal theme root dir with our premade test dir
+        function _theme_root($dir) {
+                return $this-&gt;theme_root;
+        }
+        function test_new_WP_Theme_top_level() {
+                $theme = new WP_Theme( 'theme1', $this-&gt;theme_root );
+
+                //Meta
+                $this-&gt;assertEquals( 'My Theme', $theme-&gt;get('Name') );
+                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
+                $this-&gt;assertEquals( 'An example theme', $theme-&gt;get('Description') );
+                $this-&gt;assertEquals( 'Minnie Bannister', $theme-&gt;get('Author') );
+                $this-&gt;assertEquals( 'http://example.com/', $theme-&gt;get('AuthorURI') );
+                $this-&gt;assertEquals( '1.3', $theme-&gt;get('Version') );
+                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
+                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
+                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
+
+                //Important
+                $this-&gt;assertEquals( 'theme1', $theme-&gt;get_stylesheet() );
+                $this-&gt;assertEquals( 'theme1', $theme-&gt;get_template() );
+        }
+
+        function test_new_WP_Theme_subdir() {
+                $theme = new WP_Theme( 'subdir/theme2', $this-&gt;theme_root );
+
+                //Meta
+                $this-&gt;assertEquals( 'My Subdir Theme', $theme-&gt;get('Name') );
+                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
+                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme-&gt;get('Description') );
+                $this-&gt;assertEquals( 'Mr. WordPress', $theme-&gt;get('Author') );
+                $this-&gt;assertEquals( 'http://wordpress.org/', $theme-&gt;get('AuthorURI') );
+                $this-&gt;assertEquals( '0.1', $theme-&gt;get('Version') );
+                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
+                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
+                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
+
+                //Important
+                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_stylesheet() );
+                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_template() );
+        }
+
+        /**
+         * @ticket 20313
+         */
+        function test_new_WP_Theme_subdir_bad_root() {
+                // This is what get_theme_data() does when you pass it a style.css file for a theme in a subdir.
+                $theme = new WP_Theme( 'theme2', $this-&gt;theme_root . '/subdir' );
+
+                //Meta
+                $this-&gt;assertEquals( 'My Subdir Theme', $theme-&gt;get('Name') );
+                $this-&gt;assertEquals( 'http://example.org/',$theme-&gt;get('ThemeURI') );
+                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme-&gt;get('Description') );
+                $this-&gt;assertEquals( 'Mr. WordPress', $theme-&gt;get('Author') );
+                $this-&gt;assertEquals( 'http://wordpress.org/', $theme-&gt;get('AuthorURI') );
+                $this-&gt;assertEquals( '0.1', $theme-&gt;get('Version') );
+                $this-&gt;assertEquals( '', $theme-&gt;get('Template') );
+                $this-&gt;assertEquals( 'publish', $theme-&gt;get('Status') );
+                $this-&gt;assertEquals( array(), $theme-&gt;get('Tags') );
+
+                //Important
+                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_stylesheet() );
+                $this-&gt;assertEquals( 'subdir/theme2', $theme-&gt;get_template() );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsuploadphpfromrev903trunkteststest_uploadsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/upload.php (from rev 903, trunk/tests/test_uploads.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/upload.php                                (rev 0)
+++ trunk/tests/upload.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+&lt;?php
+
+
+/**
+ * @group upload
+ * @group media
+ */
+class Tests_Upload extends WP_UnitTestCase {
+
+        var $siteurl;
+
+        function setUp() {
+                if ( is_multisite() )
+                        $this-&gt;knownUTBug( 35 );
+
+                parent::setUp();
+                return;
+                // system defaults
+                update_option( 'upload_path', 'wp-content/uploads' );
+                update_option( 'upload_url_path', '' );
+                update_option( 'uploads_use_yearmonth_folders', 1 );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+
+                // Remove year/month folders created by wp_upload_dir().
+                $uploads = wp_upload_dir();
+                foreach ( scandir( $uploads['basedir'] ) as $file )
+                        _rmdir( $uploads['basedir'] . '/' . $file );
+                _rmdir( ABSPATH . 'foo/' );
+        }
+
+        function test_upload_dir_default() {
+                // wp_upload_dir() with default parameters
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_dir_relative() {
+                // wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'
+                update_option( 'upload_path', 'foo/bar' );
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this-&gt;assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+        /**
+         * @ticket 5953
+         */
+        function test_upload_dir_absolute() {
+                $path = '/tmp/wp-unit-test';
+                // wp_upload_dir() with an absolute upload path
+                update_option( 'upload_path', $path );
+                // doesn't make sense to use an absolute file path without setting the url path
+                update_option( 'upload_url_path', '/baz' );
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this-&gt;assertEquals( &quot;$path/&quot; . gmstrftime('%Y/%m'), $info['path'] );
+                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_dir_no_yearnum() {
+                update_option( 'uploads_use_yearmonth_folders', 0 );
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
+                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
+                $this-&gt;assertEquals( '', $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_path_absolute() {
+                update_option( 'upload_url_path', 'http://example.org/asdf' );
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_dir_empty() {
+                // upload path setting is empty - it should default to 'wp-content/uploads'
+                update_option('upload_path', '');
+                $info = wp_upload_dir();
+                $this-&gt;assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this-&gt;assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this-&gt;assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this-&gt;assertEquals( '', $info['error'] );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsurlphpfromrev903trunkteststest_link_functionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/url.php (from rev 903, trunk/tests/test_link_functions.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/url.php                                (rev 0)
+++ trunk/tests/url.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+&lt;?php
+
+// tests for link-template.php and related URL functions
+class Tests_URL extends WP_UnitTestCase {
+        var $_old_server;
+        function setUp() {
+                $this-&gt;_old_server = $_SERVER;
+        }
+
+        function tearDown() {
+                $_SERVER = $this-&gt;_old_server;
+        }
+
+        function test_is_ssl_positive() {
+                $_SERVER['HTTPS'] = 'on';
+                $this-&gt;assertTrue( is_ssl() );
+
+                $_SERVER['HTTPS'] = 'ON';
+                $this-&gt;assertTrue( is_ssl() );
+
+                $_SERVER['HTTPS'] = '1';
+                $this-&gt;assertTrue( is_ssl() );
+
+                unset( $_SERVER['HTTPS'] );
+                $_SERVER['SERVER_PORT'] = '443';
+                $this-&gt;assertTrue( is_ssl() );
+        }
+
+        function test_is_ssl_negative() {
+                $_SERVER['HTTPS'] = 'off';
+                $this-&gt;assertFalse( is_ssl() );
+
+                $_SERVER['HTTPS'] = 'OFF';
+                $this-&gt;assertFalse( is_ssl() );
+
+                unset($_SERVER['HTTPS']);
+                $this-&gt;assertFalse( is_ssl() );
+        }
+
+        function test_admin_url_valid() {
+                $paths = array(
+                        '' =&gt; &quot;/wp-admin/&quot;,
+                        'foo' =&gt; &quot;/wp-admin/foo&quot;,
+                        '/foo' =&gt; &quot;/wp-admin/foo&quot;,
+                        '/foo/' =&gt; &quot;/wp-admin/foo/&quot;,
+                        'foo.php' =&gt; &quot;/wp-admin/foo.php&quot;,
+                        '/foo.php' =&gt; &quot;/wp-admin/foo.php&quot;,
+                        '/foo.php?bar=1' =&gt; &quot;/wp-admin/foo.php?bar=1&quot;,
+                );
+                $https = array('on', 'off');
+
+                foreach ($https as $val) {
+                        $_SERVER['HTTPS'] = $val;
+                        $siteurl = get_option('siteurl');
+                        if ( $val == 'on' )
+                                $siteurl = str_replace('http://', 'https://', $siteurl);
+
+                        foreach ($paths as $in =&gt; $out) {
+                                $this-&gt;assertEquals( $siteurl.$out, admin_url($in), &quot;admin_url('{$in}') should equal '{$siteurl}{$out}'&quot;);
+                        }
+                }
+        }
+
+        function test_admin_url_invalid() {
+                $paths = array(
+                        null =&gt; &quot;/wp-admin/&quot;,
+                        0 =&gt; &quot;/wp-admin/&quot;,
+                        -1 =&gt; &quot;/wp-admin/&quot;,
+                        '../foo/' =&gt; &quot;/wp-admin/&quot;,
+                        '///' =&gt; &quot;/wp-admin/&quot;,
+                );
+                $https = array('on', 'off');
+
+                foreach ($https as $val) {
+                        $_SERVER['HTTPS'] = $val;
+                        $siteurl = get_option('siteurl');
+                        if ( $val == 'on' )
+                                $siteurl = str_replace('http://', 'https://', $siteurl);
+
+                        foreach ($paths as $in =&gt; $out) {
+                                $this-&gt;assertEquals( $siteurl.$out, admin_url($in), &quot;admin_url('{$in}') should equal '{$siteurl}{$out}'&quot;);
+                        }
+                }
+        }
+
+        function test_set_url_scheme() {
+                if ( ! function_exists( 'set_url_scheme' ) )
+                        return;
+
+                $links = array(
+                        'http://wordpress.org/',
+                        'https://wordpress.org/',
+                        'http://wordpress.org/news/',
+                        'http://wordpress.org',
+                );
+
+                $https_links = array(
+                        'https://wordpress.org/',
+                        'https://wordpress.org/',
+                        'https://wordpress.org/news/',
+                        'https://wordpress.org',
+                );
+
+                $http_links = array(
+                        'http://wordpress.org/',
+                        'http://wordpress.org/',
+                        'http://wordpress.org/news/',
+                        'http://wordpress.org',
+                );
+
+                $relative_links = array(
+                        '/',
+                        '/',
+                        '/news/',
+                        ''
+                );
+
+                $forced_admin = force_ssl_admin();
+                $forced_login = force_ssl_login();
+                $i = 0;
+                foreach ( $links as $link ) {
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );
+                        $this-&gt;assertEquals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );
+
+                        $_SERVER['HTTPS'] = 'on';
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link ) );
+
+                        $_SERVER['HTTPS'] = 'off';
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link ) );
+
+                        force_ssl_login( false );
+                        force_ssl_admin( true );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+                        force_ssl_admin( false );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+                        force_ssl_login( true );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this-&gt;assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this-&gt;assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+                        $i++;
+                }
+
+                force_ssl_admin( $forced_admin );
+                force_ssl_login( $forced_login );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsuserauthorphpfromrev903trunkteststest_includes_authorphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/user/author.php (from rev 903, trunk/tests/test_includes_author.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/user/author.php                                (rev 0)
+++ trunk/tests/user/author.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+&lt;?php
+
+/**
+ * Test functions in wp-includes/author.php, author-template.php
+ *
+ * @group author
+ * @group user
+ */
+class Tests_User_Author extends WP_UnitTestCase {
+        protected $old_post_id = 0;
+        protected $author_id = 0;
+        protected $post_id = 0;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array(
+                        'role' =&gt; 'author',
+                        'user_login' =&gt; 'test_author',
+                        'description' =&gt; 'test_author',
+                ) );
+                $user = new WP_User( $this-&gt;author_id );
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_type' =&gt; 'post'
+                );
+
+                // insert a post and make sure the ID is ok
+                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create( $post );
+
+                setup_postdata( get_post( $this-&gt;post_id ) );
+        }
+
+        function tearDown() {
+                wp_reset_postdata();
+                parent::tearDown();
+        }
+
+        function test_get_the_author() {
+                $author_name = get_the_author();
+                $user = new WP_User( $this-&gt;author_id );
+
+                $this-&gt;assertEquals( $user-&gt;display_name, $author_name );
+                $this-&gt;assertEquals( 'test_author', $author_name );
+        }
+
+        function test_get_the_author_meta() {
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'login' ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
+
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                add_user_meta( $this-&gt;author_id, 'user_description', 'user description' );
+                $this-&gt;assertEquals( 'user description', get_user_meta( $this-&gt;author_id, 'user_description', true ) );
+                // user_description in meta is ignored. The content of description is returned instead.
+                // See #20285
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+                update_user_meta( $this-&gt;author_id, 'user_description', '' );
+                $this-&gt;assertEquals( '', get_user_meta( $this-&gt;author_id, 'user_description', true ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                $this-&gt;assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+
+                $this-&gt;assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
+        }
+
+        function test_get_the_author_meta_no_authordata() {
+                unset( $GLOBALS['authordata'] );
+                $this-&gt;assertEquals( '', get_the_author_meta( 'id' ) );
+                $this-&gt;assertEquals( '', get_the_author_meta( 'user_login' ) );
+                $this-&gt;assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsusercapabilitiesphpfromrev903trunkteststest_user_capabilitiesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/user/capabilities.php (from rev 903, trunk/tests/test_user_capabilities.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/user/capabilities.php                                (rev 0)
+++ trunk/tests/user/capabilities.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,541 @@
</span><ins>+&lt;?php
+
+// Test roles and capabilities via the WP_User class
+
+/**
+ * @group user
+ * @group capabilities
+ */
+class Tests_User_Capabilities extends WP_UnitTestCase {
+        var $user_ids = array();
+
+        function setUp() {
+                parent::setUp();
+                // keep track of users we create
+                $this-&gt;_flush_roles();
+
+                $this-&gt;orig_users = get_users_of_blog();
+        }
+
+        function _flush_roles() {
+                // we want to make sure we're testing against the db, not just in-memory data
+                // this will flush everything and reload it from the db
+                unset($GLOBALS['wp_user_roles']);
+                global $wp_roles;
+                if ( is_object( $wp_roles ) )
+                        $wp_roles-&gt;_init();
+        }
+
+        function _meta_yes_you_can( $can, $key, $post_id, $user_id, $cap, $caps ) {
+                return true;
+        }
+
+        function _meta_no_you_cant( $can, $key, $post_id, $user_id, $cap, $caps ) {
+                return false;
+        }
+
+        function _meta_filter( $meta_value, $meta_key, $meta_type ) {
+                return $meta_value;
+        }
+
+        // test the default roles
+
+        function test_user_administrator() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // make sure the role name is correct
+                $this-&gt;assertEquals(array('administrator'), $user-&gt;roles);
+
+                // check a few of the main capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('switch_themes'));
+                $this-&gt;assertTrue($user-&gt;has_cap('list_users'));
+                $this-&gt;assertTrue($user-&gt;has_cap('manage_options'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_10'));
+        }
+
+        function test_user_editor() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // make sure the role name is correct
+                $this-&gt;assertEquals(array('editor'), $user-&gt;roles);
+
+                // check a few of the main capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('moderate_comments'));
+                $this-&gt;assertTrue($user-&gt;has_cap('manage_categories'));
+                $this-&gt;assertTrue($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_7'));
+
+                // and a few capabilities this user doesn't have
+                $this-&gt;assertFalse($user-&gt;has_cap('switch_themes'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_users'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_8'));
+        }
+
+        function test_user_author() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // make sure the role name is correct
+                $this-&gt;assertEquals(array('author'), $user-&gt;roles);
+
+                // check a few of the main capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertTrue($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_2'));
+
+                // and a few capabilities this user doesn't have
+                $this-&gt;assertFalse($user-&gt;has_cap('moderate_comments'));
+                $this-&gt;assertFalse($user-&gt;has_cap('manage_categories'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_3'));
+        }
+
+        function test_user_contributor() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // make sure the role name is correct
+                $this-&gt;assertEquals(array('contributor'), $user-&gt;roles);
+
+                // check a few of the main capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
+                $this-&gt;assertTrue($user-&gt;has_cap('read'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
+
+                // and a few capabilities this user doesn't have
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
+        }
+
+        function test_user_subscriber() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // make sure the role name is correct
+                $this-&gt;assertEquals(array('subscriber'), $user-&gt;roles);
+
+                // check a few of the main capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('read'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
+
+                // and a few capabilities this user doesn't have
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_1'));
+        }
+
+        // a role that doesn't exist
+        function test_bogus_role() {
+                _disable_wp_die();
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; rand_str() ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // user has no role and no capabilities
+                $this-&gt;assertEquals(array(), $user-&gt;roles);
+                $this-&gt;assertFalse($user-&gt;has_cap('level_0'));
+                _enable_wp_die();
+        }
+
+        // a user with multiple roles
+        function test_user_subscriber_contributor() {
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+                $user-&gt;add_role('contributor');
+
+                // nuke and re-fetch the object to make sure it was stored
+                $user = NULL;
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // user should have two roles now
+                $this-&gt;assertEquals(array('subscriber', 'contributor'), $user-&gt;roles);
+
+                // with contributor capabilities
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
+                $this-&gt;assertTrue($user-&gt;has_cap('read'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
+
+                // but not these
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
+        }
+
+        function test_add_empty_role() {
+                // add_role($role, $display_name, $capabilities = '')
+                // randomly named role with no capabilities
+                global $wp_roles;
+                $role_name = rand_str();
+                add_role($role_name, 'Janitor', array());
+                $this-&gt;_flush_roles();
+                $this-&gt;assertTrue($wp_roles-&gt;is_role($role_name));
+
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
+
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
+
+                // user shouldn't have any capabilities; test a quick sample
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_1'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_0'));
+
+                // clean up
+                remove_role($role_name);
+                $this-&gt;_flush_roles();
+                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
+        }
+
+
+        function test_add_role() {
+                // add_role($role, $display_name, $capabilities = '')
+                // randomly named role with a few capabilities
+                global $wp_roles;
+                $role_name = rand_str();
+                add_role($role_name, 'Janitor', array('edit_posts'=&gt;true, 'edit_pages'=&gt;true, 'level_0'=&gt;true, 'level_1'=&gt;true, 'level_2'=&gt;true));
+                $this-&gt;_flush_roles();
+                $this-&gt;assertTrue($wp_roles-&gt;is_role($role_name));
+
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
+
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
+
+                // the user should have all the above caps
+                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_posts'));
+                $this-&gt;assertTrue($user-&gt;has_cap('edit_pages'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_0'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_2'));
+
+                // shouldn't have any other caps
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_3'));
+
+                // clean up
+                remove_role($role_name);
+                $this-&gt;_flush_roles();
+                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
+        }
+
+        function test_role_add_cap() {
+                // change the capabilites associated with a role and make sure the change is reflected in has_cap()
+
+                global $wp_roles;
+                $role_name = rand_str();
+                add_role( $role_name, 'Janitor', array('level_1'=&gt;true) );
+                $this-&gt;_flush_roles();
+                $this-&gt;assertTrue( $wp_roles-&gt;is_role($role_name) );
+
+                // assign a user to that role
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
+
+                // now add a cap to the role
+                $wp_roles-&gt;add_cap($role_name, 'sweep_floor');
+                $this-&gt;_flush_roles();
+
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
+
+                // the user should have all the above caps
+                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user-&gt;has_cap('sweep_floor'));
+
+                // shouldn't have any other caps
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user-&gt;has_cap('level_4'));
+
+                // clean up
+                remove_role($role_name);
+                $this-&gt;_flush_roles();
+                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
+
+        }
+
+        function test_role_remove_cap() {
+                // change the capabilites associated with a role and make sure the change is reflected in has_cap()
+
+                global $wp_roles;
+                $role_name = rand_str();
+                add_role( $role_name, 'Janitor', array('level_1'=&gt;true, 'sweep_floor'=&gt;true, 'polish_doorknobs'=&gt;true) );
+                $this-&gt;_flush_roles();
+                $this-&gt;assertTrue( $wp_roles-&gt;is_role($role_name) );
+
+                // assign a user to that role
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role_name ) );
+
+                // now remove a cap from the role
+                $wp_roles-&gt;remove_cap($role_name, 'polish_doorknobs');
+                $this-&gt;_flush_roles();
+
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+                $this-&gt;assertEquals(array($role_name), $user-&gt;roles);
+
+                // the user should have all the above caps
+                $this-&gt;assertTrue($user-&gt;has_cap($role_name));
+                $this-&gt;assertTrue($user-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user-&gt;has_cap('sweep_floor'));
+
+                // shouldn't have the removed cap
+                $this-&gt;assertFalse($user-&gt;has_cap('polish_doorknobs'));
+
+                // clean up
+                remove_role($role_name);
+                $this-&gt;_flush_roles();
+                $this-&gt;assertFalse($wp_roles-&gt;is_role($role_name));
+
+        }
+
+        function test_user_add_cap() {
+                // add an extra capability to a user
+
+                // there are two contributors
+                $id_1 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
+                $id_2 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
+
+                // user 1 has an extra capability
+                $user_1 = new WP_User($id_1);
+                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
+                $user_1-&gt;add_cap('publish_posts');
+
+                // re-fetch both users from the db
+                $user_1 = new WP_User($id_1);
+                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
+                $user_2 = new WP_User($id_2);
+                $this-&gt;assertTrue($user_2-&gt;exists(), &quot;Problem getting user $id_2&quot;);
+
+                // make sure they're both still contributors
+                $this-&gt;assertEquals(array('contributor'), $user_1-&gt;roles);
+                $this-&gt;assertEquals(array('contributor'), $user_2-&gt;roles);
+
+                // check the extra cap on both users
+                $this-&gt;assertTrue($user_1-&gt;has_cap('publish_posts'));
+                $this-&gt;assertFalse($user_2-&gt;has_cap('publish_posts'));
+
+                // make sure the other caps didn't get messed up
+                $this-&gt;assertTrue($user_1-&gt;has_cap('edit_posts'));
+                $this-&gt;assertTrue($user_1-&gt;has_cap('read'));
+                $this-&gt;assertTrue($user_1-&gt;has_cap('level_1'));
+                $this-&gt;assertTrue($user_1-&gt;has_cap('level_0'));
+                $this-&gt;assertFalse($user_1-&gt;has_cap('upload_files'));
+                $this-&gt;assertFalse($user_1-&gt;has_cap('edit_published_posts'));
+                $this-&gt;assertFalse($user_1-&gt;has_cap('level_2'));
+
+        }
+
+        function test_user_remove_cap() {
+                // add an extra capability to a user then remove it
+
+                // there are two contributors
+                $id_1 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
+                $id_2 = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) );
+
+                // user 1 has an extra capability
+                $user_1 = new WP_User($id_1);
+                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
+                $user_1-&gt;add_cap('publish_posts');
+
+                // now remove the extra cap
+                $user_1-&gt;remove_cap('publish_posts');
+
+                // re-fetch both users from the db
+                $user_1 = new WP_User($id_1);
+                $this-&gt;assertTrue($user_1-&gt;exists(), &quot;Problem getting user $id_1&quot;);
+                $user_2 = new WP_User($id_2);
+                $this-&gt;assertTrue($user_2-&gt;exists(), &quot;Problem getting user $id_2&quot;);
+
+                // make sure they're both still contributors
+                $this-&gt;assertEquals(array('contributor'), $user_1-&gt;roles);
+                $this-&gt;assertEquals(array('contributor'), $user_2-&gt;roles);
+
+                // check the removed cap on both users
+                $this-&gt;assertFalse($user_1-&gt;has_cap('publish_posts'));
+                $this-&gt;assertFalse($user_2-&gt;has_cap('publish_posts'));
+
+        }
+
+        function test_user_level_update() {
+                // make sure the user_level is correctly set and changed with the user's role
+
+                // user starts as an author
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // author = user level 2
+                $this-&gt;assertEquals( 2, $user-&gt;user_level );
+
+                // they get promoted to editor - level should get bumped to 7
+                $user-&gt;set_role('editor');
+                $this-&gt;assertEquals( 7, $user-&gt;user_level );
+
+                // demoted to contributor - level is reduced to 1
+                $user-&gt;set_role('contributor');
+                $this-&gt;assertEquals( 1, $user-&gt;user_level );
+
+                // if they have two roles, user_level should be the max of the two
+                $user-&gt;add_role('editor');
+                $this-&gt;assertEquals(array('contributor', 'editor'), $user-&gt;roles);
+                $this-&gt;assertEquals( 7, $user-&gt;user_level );
+        }
+
+        function test_user_remove_all_caps() {
+                // user starts as an author
+                $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // add some extra capabilities
+                $user-&gt;add_cap('make_coffee');
+                $user-&gt;add_cap('drink_coffee');
+
+                // re-fetch
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                $this-&gt;assertTrue($user-&gt;has_cap('make_coffee'));
+                $this-&gt;assertTrue($user-&gt;has_cap('drink_coffee'));
+
+                // all caps are removed
+                $user-&gt;remove_all_caps();
+
+                // re-fetch
+                $user = new WP_User($id);
+                $this-&gt;assertTrue($user-&gt;exists(), &quot;Problem getting user $id&quot;);
+
+                // capabilities for the author role should be gone
+#                $this-&gt;assertFalse($user-&gt;has_cap('edit_posts'));
+#                $this-&gt;assertFalse($user-&gt;has_cap('edit_published_posts'));
+#                $this-&gt;assertFalse($user-&gt;has_cap('upload_files'));
+#                $this-&gt;assertFalse($user-&gt;has_cap('level_2'));
+
+                // the extra capabilities should be gone
+                $this-&gt;assertFalse($user-&gt;has_cap('make_coffee'));
+                $this-&gt;assertFalse($user-&gt;has_cap('drink_coffee'));
+
+                // user level should be empty
+                $this-&gt;assertEmpty( $user-&gt;user_level );
+
+
+        }
+
+        function test_post_meta_caps() {
+                // simple tests for some common meta capabilities
+
+                // Make our author
+                $author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
+
+                // make a post
+                $post = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $author-&gt;ID, 'post_type' =&gt; 'post' ) );
+
+                // the author of the post
+                $this-&gt;assertTrue($author-&gt;exists(), &quot;Problem getting user $author-&gt;ID&quot;);
+
+                // add some other users
+                $admin = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) ) );
+                $author_2 = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
+                $editor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
+                $contributor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) ) );
+
+                // administrators, editors and the post owner can edit it
+                $this-&gt;assertTrue($admin-&gt;has_cap('edit_post', $post));
+                $this-&gt;assertTrue($author-&gt;has_cap('edit_post', $post));
+                $this-&gt;assertTrue($editor-&gt;has_cap('edit_post', $post));
+                // other authors and contributors can't
+                $this-&gt;assertFalse($author_2-&gt;has_cap('edit_post', $post));
+                $this-&gt;assertFalse($contributor-&gt;has_cap('edit_post', $post));
+
+                // administrators, editors and the post owner can delete it
+                $this-&gt;assertTrue($admin-&gt;has_cap('delete_post', $post));
+                $this-&gt;assertTrue($author-&gt;has_cap('delete_post', $post));
+                $this-&gt;assertTrue($editor-&gt;has_cap('delete_post', $post));
+                // other authors and contributors can't
+                $this-&gt;assertFalse($author_2-&gt;has_cap('delete_post', $post));
+                $this-&gt;assertFalse($contributor-&gt;has_cap('delete_post', $post));
+
+                // Test meta authorization callbacks
+                if ( function_exists( 'register_meta') ) {
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta',  $post) );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta',  $post) );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta',  $post) );
+
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('edit_post_meta', $post, '_protected') );
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('add_post_meta', $post, '_protected') );
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('delete_post_meta', $post, '_protected') );
+
+                        register_meta( 'post', '_protected', array( &amp;$this, '_meta_filter' ), array( &amp;$this, '_meta_yes_you_can' ) );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta',  $post, '_protected') );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta',  $post, '_protected') );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta',  $post, '_protected') );
+
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('edit_post_meta', $post, 'not_protected') );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('add_post_meta', $post, 'not_protected') );
+                        $this-&gt;assertTrue( $admin-&gt;has_cap('delete_post_meta', $post, 'not_protected') );
+
+                        register_meta( 'post', 'not_protected', array( &amp;$this, '_meta_filter' ), array( &amp;$this, '_meta_no_you_cant' ) );
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('edit_post_meta',  $post, 'not_protected') );
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('add_post_meta',  $post, 'not_protected') );
+                        $this-&gt;assertFalse( $admin-&gt;has_cap('delete_post_meta',  $post, 'not_protected') );
+                }
+        }
+
+        function test_page_meta_caps() {
+                // simple tests for some common meta capabilities
+
+                // Make our author
+                $author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
+
+                // make a page
+                $page = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $author-&gt;ID, 'post_type' =&gt; 'page' ) );
+
+                // the author of the page
+                $this-&gt;assertTrue($author-&gt;exists(), &quot;Problem getting user &quot; . $author-&gt;ID);
+
+                // add some other users
+                $admin = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) ) );
+                $author_2 = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) ) );
+                $editor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
+                $contributor = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'contributor' ) ) );
+
+                // administrators, editors and the post owner can edit it
+                $this-&gt;assertTrue($admin-&gt;has_cap('edit_page', $page));
+                $this-&gt;assertTrue($editor-&gt;has_cap('edit_page', $page));
+                // other authors and contributors can't
+                $this-&gt;assertFalse($author-&gt;has_cap('edit_page', $page));
+                $this-&gt;assertFalse($author_2-&gt;has_cap('edit_page', $page));
+                $this-&gt;assertFalse($contributor-&gt;has_cap('edit_page', $page));
+
+                // administrators, editors and the post owner can delete it
+                $this-&gt;assertTrue($admin-&gt;has_cap('delete_page', $page));
+                $this-&gt;assertTrue($editor-&gt;has_cap('delete_page', $page));
+                // other authors and contributors can't
+                $this-&gt;assertFalse($author-&gt;has_cap('delete_page', $page));
+                $this-&gt;assertFalse($author_2-&gt;has_cap('delete_page', $page));
+                $this-&gt;assertFalse($contributor-&gt;has_cap('delete_page', $page));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsusermapMetaCapphpfromrev903trunkteststest_includes_capabilitiesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/user/mapMetaCap.php (from rev 903, trunk/tests/test_includes_capabilities.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/user/mapMetaCap.php                                (rev 0)
+++ trunk/tests/user/mapMetaCap.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,235 @@
</span><ins>+&lt;?php
+
+/**
+ * @group user
+ * @group capabilities
+ */
+class Tests_User_MapMetaCap extends WP_UnitTestCase {
+        var $super_admins = null;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;user_ids = array();
+
+                $this-&gt;user_id   = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'administrator' ) );
+
+                if ( isset( $GLOBALS['super_admins'] ) )
+                        $this-&gt;super_admins = $GLOBALS['super_admins'];
+                $user = new WP_User( $this-&gt;user_id );
+                $GLOBALS['super_admins'] = array( $user-&gt;user_login );
+
+                $this-&gt;post_type = rand_str( 20 );
+                register_post_type( $this-&gt;post_type );
+
+                $this-&gt;post_id = wp_insert_post( array(
+                        'post_title' =&gt; rand_str(),
+                        'post_type' =&gt; $this-&gt;post_type,
+                        'post_status' =&gt; 'private',
+                        'post_author' =&gt; $this-&gt;author_id,
+                ) );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+
+                $GLOBALS['super_admins'] = $this-&gt;super_admins;
+                unset( $GLOBALS['wp_post_types'][ $this-&gt;post_type ] );
+        }
+
+        function test_capability_type_post_with_no_extra_caps() {
+
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'post',
+                ) );
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
+
+                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_custom_capability_type_with_map_meta_cap() {
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'book',
+                        'map_meta_cap' =&gt; true,
+                ) );
+
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_private_books' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_private_books' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_capability_type_post_with_one_renamed_cap() {
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'post',
+                        'capabilities' =&gt; array( 'edit_posts' =&gt; 'edit_books' ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertFalse( $post_type_object-&gt;map_meta_cap );
+
+                $this-&gt;assertEquals( array( 'edit_post' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_post' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_post' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_post' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_post' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_post' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_capability_type_post_map_meta_cap_true_with_renamed_cap() {
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'post',
+                        'map_meta_cap' =&gt; true,
+                        'capabilities' =&gt; array(
+                                'edit_post' =&gt; 'edit_book', // maps back to itself.
+                                'edit_others_posts' =&gt; 'edit_others_books',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
+
+                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_capability_type_post_with_all_meta_caps_renamed() {
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'post',
+                        'capabilities' =&gt; array(
+                                'edit_post' =&gt; 'edit_book',
+                                'read_post' =&gt; 'read_book',
+                                'delete_post' =&gt; 'delete_book',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertFalse( $post_type_object-&gt;map_meta_cap );
+
+                $this-&gt;assertEquals( array( 'edit_book' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_book' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_book' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_book' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_book' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_book' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_capability_type_post_with_all_meta_caps_renamed_mapped() {
+                register_post_type( $this-&gt;post_type, array(
+                        'capability_type' =&gt; 'post',
+                        'map_meta_cap' =&gt; true,
+                        'capabilities' =&gt; array(
+                                'edit_post'   =&gt; 'edit_book',
+                                'read_post'   =&gt; 'read_book',
+                                'delete_post' =&gt; 'delete_book',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this-&gt;post_type );
+
+                $this-&gt;assertTrue( $post_type_object-&gt;map_meta_cap );
+
+                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;edit_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;read_post, $this-&gt;user_id, $this-&gt;post_id ) );
+
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this-&gt;user_id, $this-&gt;post_id ) );
+                $this-&gt;assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object-&gt;cap-&gt;delete_post, $this-&gt;user_id, $this-&gt;post_id ) );
+        }
+
+        function test_unfiltered_html_cap() {
+                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) &amp;&amp; DISALLOW_UNFILTERED_HTML )
+                        $this-&gt;markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+                if ( is_multisite() ) {
+                        $this-&gt;assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
+                        $this-&gt;assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this-&gt;user_id ) );
+                } else {
+                        $this-&gt;assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this-&gt;user_id ) );
+                }
+        }
+
+        /**
+         * @ticket 20488
+         */
+        function test_file_edit_caps_not_reliant_on_unfiltered_html_constant() {
+                if ( defined( 'DISALLOW_FILE_MODS' ) || defined( 'DISALLOW_FILE_EDIT' ) )
+                        $this-&gt;markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
+
+                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
+                        if ( ! DISALLOW_UNFILTERED_HTML )
+                                $this-&gt;markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+                } else {
+                        define( 'DISALLOW_UNFILTERED_HTML', true );
+                }
+
+                $this-&gt;assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', $this-&gt;user_id ) );
+                $this-&gt;assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', $this-&gt;user_id ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsuserphpfromrev903trunkteststest_userphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/user.php (from rev 903, trunk/tests/test_user.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/user.php                                (rev 0)
+++ trunk/tests/user.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,518 @@
</span><ins>+&lt;?php
+
+// test functions in wp-includes/user.php
+/**
+ * @group user
+ */
+class Tests_User_User extends WP_UnitTestCase {
+
+        protected $_deprecated_errors = array();
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;_deprecated_errors = array();
+        }
+
+        public function deprecated_handler( $function, $message, $version ) {
+                $this-&gt;_deprecated_errors[] = array(
+                        'function' =&gt; $function,
+                        'message'  =&gt; $message,
+                        'version'  =&gt; $version
+                );
+        }
+
+        function test_get_users_of_blog() {
+                // add one of each user role
+                $user_role = array();
+                foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
+                        $id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role ) );
+                        $user_role[ $id ] = $role;
+                }
+
+                $user_list = get_users_of_blog();
+
+                // find the role of each user as returned by get_users_of_blog
+                $found = array();
+                foreach ( $user_list as $user ) {
+                        // only include the users we just created - there might be some others that existed previously
+                        if ( isset( $user_role[$user-&gt;user_id] ) ) {
+                                $roles = array_keys( unserialize( $user-&gt;meta_value ) );
+                                $found[ $user-&gt;user_id ] = $roles[0];
+                        }
+                }
+
+                // make sure every user we created was returned
+                $this-&gt;assertEquals($user_role, $found);
+        }
+
+        // simple get/set tests for user_option functions
+        function test_user_option() {
+                $key = rand_str();
+                $val = rand_str();
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+
+                // get an option that doesn't exist
+                $this-&gt;assertFalse(get_user_option($key, $user_id));
+
+                // set and get
+                update_user_option( $user_id, $key, $val );
+                $this-&gt;assertEquals( $val, get_user_option($key, $user_id) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_user_option( $user_id, $key, $val2 );
+                $this-&gt;assertEquals( $val2, get_user_option($key, $user_id) );
+
+        }
+
+        // simple tests for usermeta functions
+        function test_usermeta() {
+
+                $key = rand_str();
+                $val = rand_str();
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+
+                // get a meta key that doesn't exist
+                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
+
+                // set and get
+                update_usermeta( $user_id, $key, $val );
+                $this-&gt;assertEquals( $val, get_usermeta($user_id, $key) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_usermeta( $user_id, $key, $val2 );
+                $this-&gt;assertEquals( $val2, get_usermeta($user_id, $key) );
+
+                // delete and get
+                delete_usermeta( $user_id, $key );
+                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
+
+                // delete by key AND value
+                update_usermeta( $user_id, $key, $val );
+                // incorrect key: key still exists
+                delete_usermeta( $user_id, $key, rand_str() );
+                $this-&gt;assertEquals( $val, get_usermeta($user_id, $key) );
+                // correct key: deleted
+                delete_usermeta( $user_id, $key, $val );
+                $this-&gt;assertEquals( '', get_usermeta($user_id, $key) );
+
+        }
+
+        // test usermeta functions in array mode
+        function test_usermeta_array() {
+                // some values to set
+                $vals = array(
+                        rand_str() =&gt; 'val-'.rand_str(),
+                        rand_str() =&gt; 'val-'.rand_str(),
+                        rand_str() =&gt; 'val-'.rand_str(),
+                );
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+
+                // there is already some stuff in the array
+                $this-&gt;assertTrue(is_array(get_usermeta($user_id)));
+
+                foreach ($vals as $k=&gt;$v)
+                        update_usermeta( $user_id, $k, $v );
+
+                // get the complete usermeta array
+                $out = get_usermeta($user_id);
+
+                // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
+                // so we'll just check to make sure our values are included somewhere.
+                foreach ($vals as $v)
+                        $this-&gt;assertTrue(in_array($v, $out));
+
+                // delete one key and check again
+                $key_to_delete = array_pop(array_keys($vals));
+                delete_usermeta($user_id, $key_to_delete);
+                $out = get_usermeta($user_id);
+                // make sure that key is excluded from the results
+                foreach ($vals as $k=&gt;$v) {
+                        if ($k == $key_to_delete)
+                                $this-&gt;assertFalse(in_array($v, $out));
+                        else
+                                $this-&gt;assertTrue(in_array($v, $out));
+                }
+        }
+
+        // Test property magic functions for property get/set/isset.
+        function test_user_properties() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                foreach ( $user-&gt;data as $key =&gt; $data ) {
+                        $this-&gt;assertEquals( $data, $user-&gt;$key );
+                }
+
+                $this-&gt;assertTrue( isset( $user-&gt;$key ) );
+                $this-&gt;assertFalse( isset( $user-&gt;fooooooooo ) );
+
+                $user-&gt;$key = 'foo';
+                $this-&gt;assertEquals( 'foo', $user-&gt;$key );
+                $this-&gt;assertEquals( 'foo', $user-&gt;data-&gt;$key );  // This will fail with WP &lt; 3.3
+
+                foreach ( (array) $user as $key =&gt; $value ) {
+                        $this-&gt;assertEquals( $value, $user-&gt;$key );
+                }
+        }
+
+        /**
+         * Test the magic __unset method
+         *
+         * @ticket 20043
+         */
+        public function test_user_unset() {
+                // New user
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                // Test custom fields
+                $user-&gt;customField = 123;
+                $this-&gt;assertEquals( $user-&gt;customField, 123 );
+                unset( $user-&gt;customField );
+                $this-&gt;assertFalse( isset( $user-&gt;customField ) );
+
+                // Test 'id' (lowercase)
+                add_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3 );
+                unset( $user-&gt;id );
+                $this-&gt;assertCount( 1, $this-&gt;_deprecated_errors );
+                $this-&gt;assertEquals( 'WP_User-&gt;id', $this-&gt;_deprecated_errors[0]['function'] );
+                $this-&gt;assertEquals( '2.1', $this-&gt;_deprecated_errors[0]['version'] );
+                remove_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3);
+
+                // Test 'ID'
+                $this-&gt;assertNotEmpty( $user-&gt;ID );
+                unset( $user-&gt;ID );
+                $this-&gt;assertEmpty( $user-&gt;ID );
+        }
+
+        // Test meta property magic functions for property get/set/isset.
+        function test_user_meta_properties() {
+                global $wpdb;
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                update_user_option( $user_id, 'foo', 'foo', true );
+
+                $this-&gt;assertTrue( isset( $user-&gt;foo ) );
+
+                $this-&gt;assertEquals( 'foo', $user-&gt;foo );
+        }
+
+        function test_id_property_back_compat() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $this-&gt;assertTrue( isset( $user-&gt;id ) );
+                $this-&gt;assertEquals( $user-&gt;ID, $user-&gt;id );
+                $user-&gt;id = 1234;
+                $this-&gt;assertEquals( $user-&gt;ID, $user-&gt;id );
+        }
+
+        /**
+         * ticket 19265
+         */
+        function test_user_level_property_back_compat() {
+                $roles = array(
+                        'administrator' =&gt; 10,
+                        'editor' =&gt; 7,
+                        'author' =&gt; 2,
+                        'contributor' =&gt; 1,
+                        'subscriber' =&gt; 0,
+                );
+
+                foreach ( $roles as $role =&gt; $level ) {
+                        $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; $role ) );
+                        $user = new WP_User( $user_id );
+
+                        $this-&gt;assertTrue( isset( $user-&gt;user_level ) );
+                        $this-&gt;assertEquals( $level, $user-&gt;user_level );
+                }
+        }
+
+        function test_construction() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+
+                $user = new WP_User( $user_id );
+                $this-&gt;assertInstanceOf( 'WP_User', $user );
+                $this-&gt;assertEquals( $user_id, $user-&gt;ID );
+
+                $user2 = new WP_User( 0,  $user-&gt;user_login );
+                $this-&gt;assertInstanceOf( 'WP_User', $user2 );
+                $this-&gt;assertEquals( $user_id, $user2-&gt;ID );
+                $this-&gt;assertEquals( $user-&gt;user_login, $user2-&gt;user_login );
+
+                $user3 = new WP_User();
+                $this-&gt;assertInstanceOf( 'WP_User', $user3 );
+                $this-&gt;assertEquals( 0, $user3-&gt;ID );
+                $this-&gt;assertFalse( isset( $user3-&gt;user_login ) );
+
+                $user3-&gt;init( $user-&gt;data );
+                $this-&gt;assertEquals( $user_id, $user3-&gt;ID );
+
+                $user4 = new WP_User( $user-&gt;user_login );
+                $this-&gt;assertInstanceOf( 'WP_User', $user4 );
+                $this-&gt;assertEquals( $user_id, $user4-&gt;ID );
+                $this-&gt;assertEquals( $user-&gt;user_login, $user4-&gt;user_login );
+
+                $user5 = new WP_User( null, $user-&gt;user_login );
+                $this-&gt;assertInstanceOf( 'WP_User', $user5 );
+                $this-&gt;assertEquals( $user_id, $user5-&gt;ID );
+                $this-&gt;assertEquals( $user-&gt;user_login, $user5-&gt;user_login );
+        }
+
+        function test_get() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
+                        'role' =&gt; 'author',
+                        'user_login' =&gt; 'test_wp_user_get',
+                        'user_pass' =&gt; 'password',
+                        'user_email' =&gt; 'test@test.com',
+                ) );
+
+                $user = new WP_User( $user_id );
+                $this-&gt;assertEquals( 'test_wp_user_get', $user-&gt;get( 'user_login' ) );
+                $this-&gt;assertEquals( 'test@test.com', $user-&gt;get( 'user_email' ) );
+                $this-&gt;assertEquals( 0, $user-&gt;get( 'use_ssl' ) );
+                $this-&gt;assertEquals( '', $user-&gt;get( 'field_that_does_not_exist' ) );
+
+                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+                $this-&gt;assertEquals( 'abcdefg', $user-&gt;get( 'dashed-key' ) );
+        }
+
+        function test_has_prop() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
+                        'role' =&gt; 'author',
+                        'user_login' =&gt; 'test_wp_user_has_prop',
+                        'user_pass' =&gt; 'password',
+                        'user_email' =&gt; 'test2@test.com',
+                ) );
+
+                $user = new WP_User( $user_id );
+                $this-&gt;assertTrue( $user-&gt;has_prop( 'user_email') );
+                $this-&gt;assertTrue( $user-&gt;has_prop( 'use_ssl' ) );
+                $this-&gt;assertFalse( $user-&gt;has_prop( 'field_that_does_not_exist' ) );
+
+                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+                $this-&gt;assertTrue( $user-&gt;has_prop( 'dashed-key' ) );
+        }
+
+        function test_update_user() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array(
+                        'role' =&gt; 'author',
+                        'user_login' =&gt; 'test_wp_update_user',
+                        'user_pass' =&gt; 'password',
+                        'user_email' =&gt; 'test3@test.com',
+                ) );
+                $user = new WP_User( $user_id );
+
+                update_user_meta( $user_id, 'description', 'about me' );
+                $this-&gt;assertEquals( 'about me', $user-&gt;get( 'description' ) );
+
+                $user_data = array( 'ID' =&gt; $user_id, 'display_name' =&gt; 'test user' );
+                wp_update_user( $user_data );
+
+                $user = new WP_User( $user_id );
+                $this-&gt;assertEquals( 'test user', $user-&gt;get( 'display_name' ) );
+
+                // Make sure there is no collateral damage to fields not in $user_data
+                $this-&gt;assertEquals( 'about me', $user-&gt;get( 'description' ) );
+
+                // Test update of fields in _get_additional_user_keys()
+                $user_data = array( 'ID' =&gt; $user_id, 'use_ssl' =&gt; 1, 'show_admin_bar_front' =&gt; 1,
+                                                   'rich_editing' =&gt; 1, 'first_name' =&gt; 'first', 'last_name' =&gt; 'last',
+                                                   'nickname' =&gt; 'nick', 'comment_shortcuts' =&gt; 1, 'admin_color' =&gt; 'classic',
+                                                   'description' =&gt; 'describe', 'aim' =&gt; 'aim', 'yim' =&gt; 'yim', 'jabber' =&gt; 'jabber' );
+                wp_update_user( $user_data );
+
+                $user = new WP_User( $user_id );
+                foreach ( $user_data as $key =&gt; $value )
+                        $this-&gt;assertEquals( $value, $user-&gt;get( $key ), $key );
+        }
+
+        /**
+         * Test that usermeta cache is cleared after user deletion.
+         *
+         * @ticket 19500
+         */
+        function test_get_blogs_of_user() {
+                // Logged out users don't have blogs.
+                $this-&gt;assertEquals( array(), get_blogs_of_user( 0 ) );
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                $blogs = get_blogs_of_user( $user_id );
+                $this-&gt;assertEquals( array( 1 ), array_keys( $blogs ) );
+
+                // Non-existent users don't have blogs.
+                if ( is_multisite() )
+                        wpmu_delete_user( $user_id );
+                else
+                        wp_delete_user( $user_id );
+                $this-&gt;assertEquals( array(), get_blogs_of_user( $user_id ) );
+        }
+
+        /**
+         * Test that usermeta cache is cleared after user deletion.
+         *
+         * @ticket 19500
+         */
+        function test_is_user_member_of_blog() {
+                $old_current = get_current_user_id();
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                wp_set_current_user( $user_id );
+
+                $this-&gt;assertTrue( is_user_member_of_blog() );
+                $this-&gt;assertTrue( is_user_member_of_blog( 0, 0 ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( $user_id ) );
+                $this-&gt;assertTrue( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
+
+                // Will only remove the user from the current site in multisite; this is desired
+                // and will achieve the desired effect with is_user_member_of_blog().
+                wp_delete_user( $user_id );
+
+                $this-&gt;assertFalse( is_user_member_of_blog( $user_id ) );
+                $this-&gt;assertFalse( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
+
+                wp_set_current_user( $old_current );
+        }
+
+        /**
+         * ticket 19595
+         */
+        function test_global_userdata() {
+                global $userdata, $wpdb;
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'subscriber' ) );
+                wp_set_current_user( $user_id );
+
+                $this-&gt;assertNotEmpty( $userdata );
+                $this-&gt;assertInstanceOf( 'WP_User', $userdata );
+                $this-&gt;assertEquals( $userdata-&gt;ID, $user_id );
+                $prefix = $wpdb-&gt;get_blog_prefix();
+                $cap_key = $prefix . 'capabilities';
+                $this-&gt;assertTrue( isset( $userdata-&gt;$cap_key ) );
+        }
+
+        /**
+         * ticket 19769
+         */
+        function test_global_userdata_is_null_when_logged_out() {
+                global $userdata;
+                wp_set_current_user(0);
+                $this-&gt;assertNull( $userdata );
+        }
+
+        function test_exists() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $this-&gt;assertTrue( $user-&gt;exists() );
+
+                $user = new WP_User( 123456789 );
+
+                $this-&gt;assertFalse( $user-&gt;exists() );
+
+                $user = new WP_User( 0 );
+
+                $this-&gt;assertFalse( $user-&gt;exists() );
+        }
+
+        function test_global_authordata() {
+                global $authordata, $id;
+
+                $old_post_id = $id;
+
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $post = array(
+                        'post_author' =&gt; $user_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_type' =&gt; 'post'
+                );
+
+                // insert a post and make sure the ID is ok
+                $post_id = wp_insert_post( $post );
+                $this-&gt;assertTrue( is_numeric( $post_id ) );
+
+                setup_postdata( get_post( $post_id ) );
+
+                $this-&gt;assertNotEmpty( $authordata );
+                $this-&gt;assertInstanceOf( 'WP_User', $authordata );
+                $this-&gt;assertEquals( $authordata-&gt;ID, $user_id );
+
+                setup_postdata( get_post( $old_post_id ) );
+        }
+
+        function test_delete_user() {
+                $user_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $post = array(
+                        'post_author' =&gt; $user_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_type' =&gt; 'post',
+                );
+
+                // insert a post and make sure the ID is ok
+                $post_id = wp_insert_post($post);
+                $this-&gt;assertTrue(is_numeric($post_id));
+                $this-&gt;assertTrue($post_id &gt; 0);
+
+                $post = get_post( $post_id );
+                $this-&gt;assertEquals( $post_id, $post-&gt;ID );
+
+                $post = array(
+                        'post_author' =&gt; $user_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_type' =&gt; 'nav_menu_item',
+                );
+
+                // insert a post and make sure the ID is ok
+                $nav_id = wp_insert_post($post);
+                $this-&gt;assertTrue(is_numeric($nav_id));
+                $this-&gt;assertTrue($nav_id &gt; 0);
+
+                $post = get_post( $nav_id );
+                $this-&gt;assertEquals( $nav_id, $post-&gt;ID );
+
+                wp_delete_user( $user_id );
+                $user = new WP_User( $user_id );
+                if ( is_multisite() )
+                        $this-&gt;assertTrue( $user-&gt;exists() );
+                else
+                        $this-&gt;assertFalse( $user-&gt;exists() );
+
+                $this-&gt;assertNotNull( get_post( $post_id ) );
+                $this-&gt;assertEquals( 'trash', get_post( $post_id )-&gt;post_status );
+                // nav_menu_item is delete_with_user = false so the nav post should remain published.
+                $this-&gt;assertNotNull( get_post( $nav_id ) );
+                $this-&gt;assertEquals( 'publish', get_post( $nav_id )-&gt;post_status );
+                wp_delete_post( $nav_id, true );
+                $this-&gt;assertNull( get_post( $nav_id ) );
+                wp_delete_post( $post_id, true );
+                $this-&gt;assertNull( get_post( $post_id ) );
+        }
+
+        /**
+         * @ticket 13317
+         */
+        function test_get_userdata() {
+                $this-&gt;assertFalse( get_userdata( 0 ) );
+                $this-&gt;assertFalse( get_userdata( '0' ) );
+                $this-&gt;assertFalse( get_userdata( 'string' ) );
+                $this-&gt;assertFalse( get_userdata( array( 'array' ) ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcDisabledphpfromrev903trunkteststest_includes_classwpxmlrpcserverphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/Disabled.php (from rev 903, trunk/tests/test_includes_class-wp-xmlrpc-server.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/Disabled.php                                (rev 0)
+++ trunk/tests/xmlrpc/Disabled.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;?php
+
+require_once ABSPATH . 'wp-admin/includes/admin.php';
+require_once ABSPATH . WPINC . '/class-IXR.php';
+require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_Disabled extends WP_UnitTestCase {
+        function test_disabled() {
+                $myxmlrpcserver = new wp_xmlrpc_server();
+                $result = $myxmlrpcserver-&gt;wp_getOptions( array( 1, 'username', 'password' ) );
+
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 405, $result-&gt;code );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcmtgetRecentPostTitlesphpfromrev903trunkteststestxmlrpcapitest_mt_getRecentPostTitlesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/mt/getRecentPostTitles.php (from rev 903, trunk/tests/test-xmlrpc-api/test_mt_getRecentPostTitles.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/mt/getRecentPostTitles.php                                (rev 0)
+++ trunk/tests/xmlrpc/mt/getRecentPostTitles.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_no_posts() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+        }
+
+        function test_no_editable_posts() {
+                $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 ) );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 0, count( $result ) );
+        }
+
+        function test_date() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $this-&gt;factory-&gt;post-&gt;create();
+
+                $results = $this-&gt;myxmlrpcserver-&gt;mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $post = get_post( $result['postid'] );
+                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
+
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['dateCreated']-&gt;getTimestamp() );
+                        $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcmweditPostphpfromrev903trunkteststestxmlrpcapitest_mw_editPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/mw/editPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_mw_editPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/mw/editPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/mw/editPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_editPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $post = array();
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( 1, 'username', 'password', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_edit_own_post() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
+        }
+
+        function test_capable_edit_others_post() {
+                $this-&gt;make_user_by_role( 'editor' );
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
+        }
+
+        function test_incapable_edit_others_post() {
+                $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $original_title = 'Post test';
+                $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $original_title, $out-&gt;post_title );
+        }
+
+        function test_capable_reassign_author() {
+                $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' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'wp_author_id' =&gt; $author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $author_id, $out-&gt;post_author );
+        }
+
+        function test_incapable_reassign_author() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'wp_author_id' =&gt; $author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $contributor_id, $out-&gt;post_author );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
+
+                // add post thumbnail to post that does not have one
+                $post2 = array( 'wp_post_thumbnail' =&gt; $attachment_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // edit the post without supplying a post_thumbnail and check that it didn't change
+                $post3 = array( 'post_content' =&gt; 'Updated post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create another attachment
+                $attachment2 = array_merge( $attachment, array( 'title' =&gt; 'Post Thumbnail 2' ) );
+                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+                // change the post's post_thumbnail
+                $post4 = array( 'wp_post_thumbnail' =&gt; $attachment2_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // unset the post's post_thumbnail
+                $post5 = array( 'wp_post_thumbnail' =&gt; '' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array($post_id, 'author', 'author', $post5 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_edit_basic_post_info() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Title', 'post_content' =&gt; 'Content', 'post_excerpt' =&gt; 'Excerpt', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'title' =&gt; 'New Title', 'post_author' =&gt; $contributor_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
+
+                $post3 = array( 'description' =&gt; 'New Content', 'post_author' =&gt; $contributor_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
+                $this-&gt;assertEquals( $post3['description'], $out-&gt;post_content );
+
+                $post4 = array( 'mt_excerpt' =&gt; 'New Excerpt', 'post_author' =&gt; $contributor_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $post2['title'], $out-&gt;post_title );
+                $this-&gt;assertEquals( $post3['description'], $out-&gt;post_content );
+                $this-&gt;assertEquals( $post4['mt_excerpt'], $out-&gt;post_excerpt );
+        }
+
+        // Not allowed since [19914]
+        function test_change_post_type() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Title', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_type' =&gt; 'page' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $result-&gt;code, 401 );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcmwgetPostphpfromrev903trunkteststestxmlrpcapitest_mw_getPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/mw/getPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_mw_getPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/mw/getPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/mw/getPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,142 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_getPost extends WP_XMLRPC_UnitTestCase {
+        var $post_data;
+        var $post_id;
+        var $post_date_ts;
+
+        function setUp() {
+                parent::setUp();
+
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+                $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; $author_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 test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'subscriber', 'subscriber' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        /**
+         * @ticket 20336
+         */
+        function test_invalid_postid() {
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( 9999, 'author', 'author' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this-&gt;assertInternalType( 'string', $result['userid'] );
+                $this-&gt;assertInternalType( 'int', $result['postid'] );
+                $this-&gt;assertInternalType( 'string', $result['description'] );
+                $this-&gt;assertInternalType( 'string', $result['title'] );
+                $this-&gt;assertInternalType( 'string', $result['link'] );
+                $this-&gt;assertInternalType( 'string', $result['permaLink'] );
+                $this-&gt;assertInternalType( 'array',  $result['categories'] );
+                $this-&gt;assertInternalType( 'string', $result['mt_excerpt'] );
+                $this-&gt;assertInternalType( 'string', $result['mt_text_more'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_more_text'] );
+                $this-&gt;assertInternalType( 'int', $result['mt_allow_comments'] );
+                $this-&gt;assertInternalType( 'int', $result['mt_allow_pings'] );
+                $this-&gt;assertInternalType( 'string', $result['mt_keywords'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_password'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
+                $this-&gt;assertInternalType( 'string', $result['post_status'] );
+                $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_post_format'] );
+                $this-&gt;assertInternalType( 'bool',   $result['sticky'] );
+
+
+                // Check expected values
+                $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['title'] );
+                $this-&gt;assertEquals( 'draft', $result['post_status'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['mt_excerpt'] );
+                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
+
+                $this-&gt;assertEquals( '', $result['wp_post_thumbnail'] );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this-&gt;post_id );
+
+                set_post_thumbnail( $this-&gt;post_id, $attachment_id );
+
+                $fields = array( 'post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertInternalType( 'string', $result['wp_post_thumbnail'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+                $this-&gt;assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_date() {
+                $fields = array( 'post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getPost( array( $this-&gt;post_id, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['dateCreated']-&gt;getTimestamp() );
+                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['date_modified']-&gt;getTimestamp() );
+
+                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+                $post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this-&gt;assertEquals( $post_date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
+                $this-&gt;assertEquals( $post_modified_gmt, $result['date_modified_gmt']-&gt;getTimestamp() );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcmwgetRecentPostsphpfromrev903trunkteststestxmlrpcapitest_mw_getRecentPostsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/mw/getRecentPosts.php (from rev 903, trunk/tests/test-xmlrpc-api/test_mw_getRecentPosts.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/mw/getRecentPosts.php                                (rev 0)
+++ trunk/tests/xmlrpc/mw/getRecentPosts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_getRecentPosts extends WP_XMLRPC_UnitTestCase {
+        var $post_data;
+        var $post_id;
+        var $post_date_ts;
+
+        function setUp() {
+                parent::setUp();
+
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+                $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; $author_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 test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_no_editable_posts() {
+                wp_delete_post( $this-&gt;post_id );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 0, count( $result ) );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post' );
+                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $post = get_post( $result['postid'] );
+
+                        // Check data types
+                        $this-&gt;assertInternalType( 'string', $result['userid'] );
+                        $this-&gt;assertInternalType( 'string', $result['postid'] );
+                        $this-&gt;assertInternalType( 'string', $result['description'] );
+                        $this-&gt;assertInternalType( 'string', $result['title'] );
+                        $this-&gt;assertInternalType( 'string', $result['link'] );
+                        $this-&gt;assertInternalType( 'string', $result['permaLink'] );
+                        $this-&gt;assertInternalType( 'array',  $result['categories'] );
+                        $this-&gt;assertInternalType( 'string', $result['mt_excerpt'] );
+                        $this-&gt;assertInternalType( 'string', $result['mt_text_more'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_more_text'] );
+                        $this-&gt;assertInternalType( 'int', $result['mt_allow_comments'] );
+                        $this-&gt;assertInternalType( 'int', $result['mt_allow_pings'] );
+                        $this-&gt;assertInternalType( 'string', $result['mt_keywords'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_password'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
+                        $this-&gt;assertInternalType( 'string', $result['post_status'] );
+                        $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
+                        $this-&gt;assertInternalType( 'string', $result['wp_post_format'] );
+
+                        // Check expected values
+                        $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $result['postid'] );
+                        $this-&gt;assertEquals( $post-&gt;post_title, $result['title'] );
+                        $this-&gt;assertEquals( 'draft', $result['post_status'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+                        $this-&gt;assertEquals( $post-&gt;post_excerpt, $result['mt_excerpt'] );
+                        $this-&gt;assertEquals( url_to_postid( $result['link'] ), $post-&gt;ID );
+
+                        $this-&gt;assertEquals( '', $result['wp_post_thumbnail'] );
+                }
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this-&gt;post_id );
+                set_post_thumbnail( $this-&gt;post_id, $attachment_id );
+
+                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( $this-&gt;post_id, 'author', 'author' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $this-&gt;assertInternalType( 'string', $result['wp_post_thumbnail'] );
+                        $this-&gt;assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+
+                        if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this-&gt;post_id ) {
+                                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
+
+                                $this-&gt;assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+                        }
+                }
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_date() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $results = $this-&gt;myxmlrpcserver-&gt;mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $post = get_post( $result['postid'] );
+                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
+                        $date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post-&gt;post_modified, false ), 'Ymd\TH:i:s' ) );
+
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['dateCreated']-&gt;getTimestamp() );
+                        $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
+                        $this-&gt;assertEquals( strtotime( $post-&gt;post_date ), $result['date_modified']-&gt;getTimestamp() );
+                        $this-&gt;assertEquals( $date_modified_gmt, $result['date_modified_gmt']-&gt;getTimestamp() );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcmwnewPostphpfromrev903trunkteststestxmlrpcapitest_mw_newPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/mw/newPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_mw_newPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/mw/newPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/mw/newPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_newPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $post = array();
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'username', 'password', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $post = array();
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_no_content() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array();
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( 'Content, title, and excerpt are empty.', $result-&gt;message );
+        }
+
+        function test_basic_content() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_ignore_id() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test', 'ID' =&gt; 103948 );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertNotEquals( '103948', $result );
+        }
+
+        function test_capable_publish() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_publish() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_other_author() {
+                $this-&gt;make_user_by_role( 'editor' );
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_other_author() {
+                $this-&gt;make_user_by_role( 'contributor' );
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; $other_author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        /**
+         * @ticket 20356
+         */
+        function test_invalid_author() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'title' =&gt; 'Test', 'wp_author_id' =&gt; 99999999 );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+
+        function test_empty_author() {
+                $my_author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this-&gt;assertEquals( $my_author_id, $out-&gt;post_author );
+                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $this-&gt;make_user_by_role( 'author' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+                $post = array( 'title' =&gt; 'Post Thumbnail Test', 'wp_post_thumbnail' =&gt; $attachment_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_incapable_set_post_type_as_page() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_set_post_type_as_page() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'title' =&gt; 'Test', 'post_type' =&gt; 'page' );
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
+                $this-&gt;assertEquals( 'page', $out-&gt;post_type );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpdeletePostphpfromrev903trunkteststestxmlrpcapitest_wp_deletePostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/deletePost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_deletePost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/deletePost.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/deletePost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_deletePost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'username', 'password', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_invalid_post() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_post_deleted() {
+                $this-&gt;make_user_by_role( 'editor' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue( $result );
+
+                $post = get_post( $post_id );
+                $this-&gt;assertEquals( 'trash', $post-&gt;post_status );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpdeleteTermphpfromrev903trunkteststestxmlrpcapitest_wp_deleteTermphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/deleteTerm.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_deleteTerm.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/deleteTerm.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/deleteTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_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="trunktestsxmlrpcwpeditPostphpfromrev903trunkteststestxmlrpcapitest_wp_editPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/editPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_editPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/editPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/editPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,224 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'username', 'password', 0, array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_edit_own_post() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
+        }
+
+        function test_capable_edit_others_post() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
+        }
+
+        function test_incapable_edit_others_post() {
+                $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $original_title = 'Post test';
+                $post = array( 'post_title' =&gt; $original_title, 'post_author' =&gt; $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' =&gt; $new_title );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $original_title, $out-&gt;post_title );
+        }
+
+        function test_capable_reassign_author() {
+                $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' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_author' =&gt; $author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $author_id, $out-&gt;post_author );
+        }
+
+        function test_incapable_reassign_author() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_author' =&gt; $author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $contributor_id, $out-&gt;post_author );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_author' =&gt; $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
+
+                // add post thumbnail to post that does not have one
+                $post2 = array( 'post_thumbnail' =&gt; $attachment_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // fetch the post to verify that it appears
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $post_id ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertArrayHasKey( 'post_thumbnail', $result );
+                $this-&gt;assertInternalType( 'array', $result['post_thumbnail'] );
+                $this-&gt;assertEquals( $attachment_id, $result['post_thumbnail']['attachment_id'] );
+
+                // edit the post without supplying a post_thumbnail and check that it didn't change
+                $post3 = array( 'post_content' =&gt; 'Updated post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create another attachment
+                $attachment2 = array_merge( $attachment, array( 'post_title' =&gt; 'Post Thumbnail 2' ) );
+                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+                // change the post's post_thumbnail
+                $post4 = array( 'post_thumbnail' =&gt; $attachment2_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // unset the post's post_thumbnail
+                $post5 = array( 'post_thumbnail' =&gt; '' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // use invalid ID
+                $post6 = array( 'post_thumbnail' =&gt; 398420983409 );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_edit_custom_fields() {
+                $contributor_id = $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Post test', 'post_author' =&gt; $contributor_id );
+                $post_id = wp_insert_post( $post );
+                $mid_edit   = add_post_meta( $post_id, 'custom_field_key', '12345678' );
+                $mid_delete = add_post_meta( $post_id, 'custom_field_to_delete', '12345678' );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array(
+                        'post_title' =&gt; $new_title,
+                        'custom_fields' =&gt;
+                                array(
+                                        array( 'id' =&gt; $mid_delete ),
+                                        array( 'id' =&gt; $mid_edit, 'key' =&gt; 'custom_field_key', 'value' =&gt; '87654321' ),
+                                        array( 'key' =&gt; 'custom_field_to_create', 'value' =&gt; '12345678' )
+                                )
+                );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this-&gt;assertEquals( $new_title, $out-&gt;post_title );
+
+                $edited_object = get_metadata_by_mid( 'post', $mid_edit );
+                $this-&gt;assertEquals( '87654321', $edited_object-&gt;meta_value );
+                $this-&gt;assertFalse( get_metadata_by_mid( 'post', $mid_delete ) );
+
+                $created_object = get_post_meta( $post_id, 'custom_field_to_create', true );
+                $this-&gt;assertEquals( $created_object, '12345678' );
+        }
+
+        function test_capable_unsticky() {
+                $editor_id = $this-&gt;make_user_by_role( 'editor' );
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
+                stick_post( $post_id );
+
+                $post2 = array( 'sticky' =&gt; false );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertFalse( is_sticky( $post_id ) );
+        }
+
+        function test_password_transition_unsticky() {
+                // when transitioning to private status or adding a post password, post should be un-stuck
+                $editor_id = $this-&gt;make_user_by_role( 'editor' );
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( array( 'post_author' =&gt; $editor_id ) );
+                stick_post( $post_id );
+
+                $post2 = array( 'post_password' =&gt; 'foobar',  'sticky' =&gt; false );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertFalse( is_sticky( $post_id ) );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpeditTermphpfromrev903trunkteststestxmlrpcapitest_wp_editTermphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/editTerm.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_editTerm.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/editTerm.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/editTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_editTerm extends WP_XMLRPC_UnitTestCase {
+        var $parent_term;
+        var $child_term;
+        var $post_tag;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;parent_term = wp_insert_term( 'parent' . rand_str() , 'category' );
+                $this-&gt;child_term = wp_insert_term( 'child' . rand_str() , 'category' );
+                $this-&gt;post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( 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( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' =&gt; '' ) ) );
+                $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_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; '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_editTerm( array( 1, 'subscriber', 'subscriber', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to edit terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+        function test_term_not_exists() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' =&gt; 'category' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+                $this-&gt;assertEquals(  __( 'Invalid term ID' ), $result-&gt;message );
+        }
+
+        function test_empty_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' =&gt; 'category' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
+        }
+
+        function test_empty_term_name() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;parent_term['term_id'], array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'The term name cannot be empty.' ), $result-&gt;message );
+        }
+
+        function test_parent_for_nonhierarchical() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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'] ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( &quot;This taxonomy is not hierarchical so you can't set a parent.&quot; ), $result-&gt;message );
+        }
+
+        function test_parent_empty() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( __('Empty Term'), $result-&gt;message );
+        }
+
+        function test_parent_invalid() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+        }
+
+        function test_parent_not_existing() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Parent term does not exist.' ), $result-&gt;message );
+        }
+
+        function test_parent_duplicate_slug() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $parent_term = get_term_by( 'id', $this-&gt;parent_term['term_id'], 'category' );
+                $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 ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( htmlspecialchars( sprintf( __('The slug &amp;#8220;%s&amp;#8221; is already in use by another term'), $parent_term-&gt;slug ) ), $result-&gt;message );
+        }
+
+        function test_edit_all_fields() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_editTerm( array( 1, 'editor', 'editor', $this-&gt;child_term['term_id'], $fields ) );
+
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertInternalType( 'boolean', $result );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetCommentphpfromrev903trunkteststestxmlrpcapitest_wp_getCommentphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getComment.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getComment.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getComment.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getComment.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase {
+        var $post_id;
+        var $parent_comment_id;
+        var $parent_comment_data;
+        var $child_comment_id;
+        var $child_comment_data;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                $this-&gt;parent_comment_data = array(
+                        'comment_post_ID' =&gt; $this-&gt;post_id,
+                        'comment_author' =&gt; 'Test commenter',
+                        'comment_author_url' =&gt; 'http://example.com/',
+                        'comment_author_email' =&gt; 'example@example.com',
+                        'comment_content' =&gt; rand_str( 100 ),
+                );
+                $this-&gt;parent_comment_id = wp_insert_comment( $this-&gt;parent_comment_data );
+
+                $this-&gt;child_comment_data = array(
+                        'comment_post_ID' =&gt; $this-&gt;post_id,
+                        'comment_author' =&gt; 'Test commenter 2',
+                        'comment_author_url' =&gt; 'http://example.org/',
+                        'comment_author_email' =&gt; 'example@example.org',
+                        'comment_parent' =&gt; $this-&gt;parent_comment_id,
+                        'comment_content' =&gt; rand_str( 100 )
+                );
+                $this-&gt;child_comment_id = wp_insert_comment( $this-&gt;child_comment_data );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'username', 'password', $this-&gt;parent_comment_id ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'contributor', 'contributor', $this-&gt;parent_comment_id ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_valid_comment() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;parent_comment_id ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this-&gt;assertInternalType( 'string', $result['user_id'] );
+                $this-&gt;assertInternalType( 'string', $result['comment_id'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this-&gt;assertInternalType( 'string', $result['parent'] );
+                $this-&gt;assertInternalType( 'string', $result['status'] );
+                $this-&gt;assertInternalType( 'string', $result['content'] );
+                $this-&gt;assertInternalType( 'string', $result['link'] );
+                $this-&gt;assertInternalType( 'string', $result['post_id'] );
+                $this-&gt;assertInternalType( 'string', $result['post_title'] );
+                $this-&gt;assertInternalType( 'string', $result['author'] );
+                $this-&gt;assertInternalType( 'string', $result['author_url'] );
+                $this-&gt;assertInternalType( 'string', $result['author_email'] );
+                $this-&gt;assertInternalType( 'string', $result['author_ip'] );
+                $this-&gt;assertInternalType( 'string', $result['type'] );
+
+                // Check expected values
+                $this-&gt;assertStringMatchesFormat( '%d', $result['user_id'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['comment_id'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['parent'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['post_id'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_id, $result['comment_id'] );
+                $this-&gt;assertEquals( 0, $result['parent'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_content'], $result['content'] );
+                $this-&gt;assertEquals( $this-&gt;post_id, $result['post_id'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author'], $result['author'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author_url'], $result['author_url'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_data['comment_author_email'], $result['author_email'] );
+        }
+
+        function test_valid_child_comment() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', $this-&gt;child_comment_id ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertEquals( $this-&gt;child_comment_id, $result['comment_id'] );
+                $this-&gt;assertEquals( $this-&gt;parent_comment_id, $result['parent'] );
+        }
+
+        function test_invalid_id() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetCommentsphpfromrev903trunkteststestxmlrpcapitest_wp_getCommentsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getComments.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getComments.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getComments.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getComments.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
+        var $post_id;
+
+        function setUp() {
+                parent::setUp();
+
+                $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 );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'username', 'password', array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_user() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', array() ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $comment = get_comment( $result['comment_id'], ARRAY_A );
+                        $this-&gt;assertEquals( $comment['comment_post_ID'], $result['post_id'] );
+                }
+        }
+
+        function test_post_filter() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $filter = array(
+                        'post_id' =&gt; $this-&gt;post_id
+                );
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $this-&gt;assertEquals( $this-&gt;post_id, $result['post_id'] );
+                }
+        }
+
+        function test_number_filter() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $filter = array(
+                        'post_id' =&gt; $this-&gt;post_id,
+                );
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                // if no 'number' filter is specified, default should be 10
+                $this-&gt;assertEquals( 10, count( $results ) );
+
+                // explicitly set a 'number' filter and verify that only that many are returned
+                $filter['number'] = 5;
+                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
+                $this-&gt;assertEquals( 5, count( $results2 ) );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetMediaItemphpfromrev903trunkteststestxmlrpcapitest_wp_getMediaItemphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getMediaItem.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getMediaItem.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getMediaItem.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getMediaItem.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getMediaItem extends WP_XMLRPC_UnitTestCase {
+        var $post_id;
+        var $attachment_data;
+        var $attachment_id;
+
+        function setUp() {
+                parent::setUp();
+
+                add_theme_support( 'post-thumbnails' );
+
+                $this-&gt;post_id = wp_insert_post( array(
+                        'post_title' =&gt; rand_str(),
+                        'post_content' =&gt; rand_str(),
+                        'post_status' =&gt; 'publish'
+                ));
+
+                $filename = ( DIR_TESTDATA.'/images/waffles.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits(basename($filename), null, $contents);
+                $mime = wp_check_filetype( $filename );
+                $this-&gt;attachment_data = array(
+                        'post_title' =&gt; basename( $upload['file'] ),
+                        'post_content' =&gt; '',
+                        'post_type' =&gt; 'attachment',
+                        'post_parent' =&gt; $this-&gt;post_id,
+                        'post_mime_type' =&gt; $mime['type'],
+                        'guid' =&gt; $upload[ 'url' ]
+                );
+
+                $id = wp_insert_attachment( $this-&gt;attachment_data, $upload[ 'file' ], $this-&gt;post_id );
+                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+                $this-&gt;attachment_id = $id;
+
+                set_post_thumbnail( $this-&gt;post_id, $this-&gt;attachment_id );
+        }
+
+        function tearDown() {
+                remove_theme_support( 'post-thumbnails' );
+
+                parent::tearDown();
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_valid_media_item() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $fields = array( 'post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getMediaItem( array( 1, 'author', 'author', $this-&gt;attachment_id, $fields ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this-&gt;assertInternalType( 'string', $result['attachment_id'] );
+                $this-&gt;assertInternalType( 'int', $result['parent'] );
+                $this-&gt;assertInternalType( 'string', $result['title'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this-&gt;assertInternalType( 'string', $result['caption'] );
+                $this-&gt;assertInternalType( 'string', $result['description'] );
+                $this-&gt;assertInternalType( 'string', $result['link'] );
+                $this-&gt;assertInternalType( 'string', $result['thumbnail'] );
+                $this-&gt;assertInternalType( 'array', $result['metadata'] );
+
+                // Check expected values
+                $this-&gt;assertStringMatchesFormat( '%d', $result['attachment_id'] );
+                $this-&gt;assertEquals( $this-&gt;attachment_data['post_title'], $result['title'] );
+                $this-&gt;assertEquals( wp_get_attachment_url( $this-&gt;attachment_id ), $result['link'] );
+                $this-&gt;assertEquals( wp_get_attachment_thumb_url( $this-&gt;attachment_id ), $result['thumbnail'] );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetOptionsphpfromrev903trunkteststestxmlrpcapitest_wp_getOptionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getOptions.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getOptions.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getOptions.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getOptions.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,203 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getOptions extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_valid_username_password() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+                $this-&gt;assertInternalType( 'array', $result );
+                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
+        }
+
+        function test_option_value() {
+                $this-&gt;make_user_by_role( 'administrator' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
+                $this-&gt;assertInternalType( 'array', $result );
+
+                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this-&gt;assertFalse( $result['default_comment_status']['readonly'] );
+        }
+
+        /**
+         * @ticket 20201
+         */
+        function test_option_values_subscriber() {
+                global $wp_version;
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+                $this-&gt;assertInternalType( 'array', $result );
+
+                // Read Only options
+                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
+                $this-&gt;assertTrue( $result['software_name']['readonly'] );
+
+                $this-&gt;assertEquals( $wp_version, $result['software_version']['value'] );
+                $this-&gt;assertTrue( $result['software_version']['readonly'] );
+
+                /* TODO: Gives junk data in Test Environment
+                $this-&gt;assertEquals( get_site_url(), $result['site-url']['value'] );
+                $this-&gt;assertTrue( $result['site-url']['readonly'] );
+                */
+
+                $this-&gt;assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+                $this-&gt;assertTrue( $result['image_default_link_type']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+                $this-&gt;assertTrue( $result['image_default_size']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+                $this-&gt;assertTrue( $result['image_default_align']['readonly'] );
+
+                $this-&gt;assertEquals( get_template(), $result['template']['value'] );
+                $this-&gt;assertTrue( $result['template']['readonly'] );
+
+                $this-&gt;assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+                $this-&gt;assertTrue( $result['stylesheet']['readonly'] );
+
+                $this-&gt;assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+                $this-&gt;assertTrue( $result['post_thumbnail']['readonly'] );
+
+                // Updatable options
+                $this-&gt;assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+                $this-&gt;assertTrue( $result['time_zone']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+                $this-&gt;assertTrue( $result['blog_title']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+                $this-&gt;assertTrue( $result['blog_tagline']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+                $this-&gt;assertTrue( $result['date_format']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+                $this-&gt;assertTrue( $result['time_format']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+                $this-&gt;assertTrue( $result['users_can_register']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+                $this-&gt;assertTrue( $result['thumbnail_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+                $this-&gt;assertTrue( $result['thumbnail_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+                $this-&gt;assertTrue( $result['thumbnail_crop']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+                $this-&gt;assertTrue( $result['medium_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+                $this-&gt;assertTrue( $result['medium_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+                $this-&gt;assertTrue( $result['large_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+                $this-&gt;assertTrue( $result['large_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this-&gt;assertTrue( $result['default_comment_status']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+                $this-&gt;assertTrue( $result['default_ping_status']['readonly'] );
+        }
+
+        function test_option_values_admin() {
+                global $wp_version;
+
+                $this-&gt;make_user_by_role( 'administrator' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getOptions( array( 1, 'administrator', 'administrator' ) );
+                $this-&gt;assertInternalType( 'array', $result );
+
+                // Read Only options
+                $this-&gt;assertEquals( 'WordPress', $result['software_name']['value'] );
+                $this-&gt;assertTrue( $result['software_name']['readonly'] );
+
+                $this-&gt;assertEquals( $wp_version, $result['software_version']['value'] );
+                $this-&gt;assertTrue( $result['software_version']['readonly'] );
+
+                /* TODO: Gives junk data in Test Environment
+                $this-&gt;assertEquals( get_site_url(), $result['site-url']['value'] );
+                $this-&gt;assertTrue( $result['site-url']['readonly'] );
+                */
+
+                $this-&gt;assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+                $this-&gt;assertTrue( $result['image_default_link_type']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+                $this-&gt;assertTrue( $result['image_default_size']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+                $this-&gt;assertTrue( $result['image_default_align']['readonly'] );
+
+                $this-&gt;assertEquals( get_template(), $result['template']['value'] );
+                $this-&gt;assertTrue( $result['template']['readonly'] );
+
+                $this-&gt;assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+                $this-&gt;assertTrue( $result['stylesheet']['readonly'] );
+
+                $this-&gt;assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+                $this-&gt;assertTrue( $result['post_thumbnail']['readonly'] );
+
+                // Updatable options
+                $this-&gt;assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+                $this-&gt;assertFalse( $result['time_zone']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+                $this-&gt;assertFalse( $result['blog_title']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+                $this-&gt;assertFalse( $result['blog_tagline']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+                $this-&gt;assertFalse( $result['date_format']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+                $this-&gt;assertFalse( $result['time_format']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+                $this-&gt;assertFalse( $result['users_can_register']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+                $this-&gt;assertFalse( $result['thumbnail_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+                $this-&gt;assertFalse( $result['thumbnail_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+                $this-&gt;assertFalse( $result['thumbnail_crop']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+                $this-&gt;assertFalse( $result['medium_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+                $this-&gt;assertFalse( $result['medium_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+                $this-&gt;assertFalse( $result['large_size_w']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+                $this-&gt;assertFalse( $result['large_size_h']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this-&gt;assertFalse( $result['default_comment_status']['readonly'] );
+
+                $this-&gt;assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+                $this-&gt;assertFalse( $result['default_ping_status']['readonly'] );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetPagephpfromrev903trunkteststestxmlrpcapitest_wp_getPagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPage.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPage.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPage.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPage.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPage extends WP_XMLRPC_UnitTestCase {
+        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_type' =&gt; 'page',
+                        'post_title' =&gt; rand_str(),
+                        'post_content' =&gt; rand_str( 2000 ),
+                        'post_excerpt' =&gt; rand_str( 100 ),
+                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
+                        '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 );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        /**
+         * @ticket 20336
+         */
+        function test_invalid_pageid() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+
+        function test_valid_page() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this-&gt;assertInternalType( 'string', $result['userid'] );
+                $this-&gt;assertInternalType( 'int',    $result['page_id'] );
+                $this-&gt;assertInternalType( 'string', $result['page_status'] );
+                $this-&gt;assertInternalType( 'string', $result['description'] );
+                $this-&gt;assertInternalType( 'string', $result['title'] );
+                $this-&gt;assertInternalType( 'string', $result['link'] );
+                $this-&gt;assertInternalType( 'string', $result['permaLink'] );
+                $this-&gt;assertInternalType( 'array',  $result['categories'] );
+                $this-&gt;assertInternalType( 'string', $result['excerpt'] );
+                $this-&gt;assertInternalType( 'string', $result['text_more'] );
+                $this-&gt;assertInternalType( 'int',    $result['mt_allow_comments'] );
+                $this-&gt;assertInternalType( 'int',    $result['mt_allow_pings'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_slug'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_password'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_author'] );
+                $this-&gt;assertInternalType( 'int',    $result['wp_page_parent_id'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_page_parent_title'] );
+                $this-&gt;assertInternalType( 'int',    $result['wp_page_order'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_author_id'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_author_display_name'] );
+                $this-&gt;assertInternalType( 'array',  $result['custom_fields'] );
+                $this-&gt;assertInternalType( 'string', $result['wp_page_template'] );
+
+                // Check expected values
+                $this-&gt;assertStringMatchesFormat( '%d', $result['userid'] );
+                $this-&gt;assertEquals( 'draft', $result['page_status'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['title'] );
+                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['excerpt'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+        }
+
+        function test_date() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPage( array( 1, $this-&gt;post_id, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+                $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['dateCreated']-&gt;getTimestamp() );
+                $this-&gt;assertEquals( $date_gmt, $result['date_created_gmt']-&gt;getTimestamp() );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetPageListphpfromrev903trunkteststestxmlrpcapitest_wp_getPageListphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPageList.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPageList.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPageList.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPageList.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPageList extends WP_XMLRPC_UnitTestCase {
+        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_type' =&gt; 'page',
+                        'post_title' =&gt; rand_str(),
+                        'post_content' =&gt; rand_str( 2000 ),
+                        'post_excerpt' =&gt; rand_str( 100 ),
+                        'post_author' =&gt; $this-&gt;make_user_by_role( 'author' ),
+                        '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 test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'contributor', 'contributor' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_date() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPageList( array( 1, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $page = get_post( $result-&gt;page_id );
+                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page-&gt;post_date, false ), 'Ymd\TH:i:s' ) );
+
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result-&gt;dateCreated );
+                        $this-&gt;assertInstanceOf( 'IXR_Date', $result-&gt;date_created_gmt );
+
+                        $this-&gt;assertEquals( strtotime( $page-&gt;post_date ), $result-&gt;dateCreated-&gt;getTimestamp() );
+                        $this-&gt;assertEquals( $date_gmt, $result-&gt;date_created_gmt-&gt;getTimestamp() );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetPagesphpfromrev903trunkteststestxmlrpcapitest_wp_getPagesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPages.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPages.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPages.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPages.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPages extends WP_XMLRPC_UnitTestCase {
+    var $post_data;
+    var $post_id;
+    var $post_date_ts;
+    var $editor_id;
+
+    function setUp() {
+        parent::setUp();
+
+        $this-&gt;post_date_ts = strtotime( '+1 day' );
+        $this-&gt;post_data = array(
+            'post_type' =&gt; 'page',
+            'post_title' =&gt; rand_str(),
+            'post_content' =&gt; rand_str( 2000 ),
+            'post_excerpt' =&gt; rand_str( 100 ),
+            'post_author' =&gt; $this-&gt;make_user_by_role( 'administrator' ),
+            '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 );
+        $this-&gt;editor_id = $this-&gt;make_user_by_role( 'editor' );
+    }
+
+    function test_invalid_username_password() {
+        $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'username', 'password' ) );
+        $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+        $this-&gt;assertEquals( 403, $result-&gt;code );
+    }
+
+    function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+        $result = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'contributor', 'contributor' ) );
+        $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+        $this-&gt;assertEquals( 401, $result-&gt;code );
+    }
+
+    function test_capable_user() {
+        $results = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'administrator', 'administrator' ) );
+        $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+        foreach( $results as $result ) {
+            $page = get_post( $result['page_id'] );
+            $this-&gt;assertEquals( $page-&gt;post_type, 'page' );
+        }
+    }
+
+    function remove_editor_edit_page_cap( $caps, $cap, $user_id, $args ) {
+        if ( in_array( $cap, array( 'edit_page', 'edit_others_pages' ) ) ) {
+            if ( $user_id == $this-&gt;editor_id &amp;&amp; $args[0] == $this-&gt;post_id ) {
+                return array( false );
+            }
+        }
+
+        return $caps;
+    }
+
+        /**
+         * @ticket 20629
+         */
+        function test_semi_capable_user() {
+        add_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap') , 10, 4 );
+
+        $results = $this-&gt;myxmlrpcserver-&gt;wp_getPages( array( 1, 'editor', 'editor' ) );
+        $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+
+        $found_incapable = false;
+        foreach( $results as $result ) {
+            // WP#20629
+            $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+            if ( $result['page_id'] == $this-&gt;post_id ) {
+                $found_incapable = true;
+                break;
+            }
+        }
+        $this-&gt;assertFalse( $found_incapable );
+
+        remove_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap' ), 10, 4 );
+    }
+
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetPostphpfromrev903trunkteststestxmlrpcapitest_wp_getPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,118 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase {
+        var $post_data;
+        var $post_id;
+        var $post_date_ts;
+        var $post_custom_field;
+
+        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; $this-&gt;make_user_by_role( 'author' ),
+                        '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 );
+                $this-&gt;post_custom_field = array( 'key' =&gt; 'test_custom_field', 'value' =&gt; 12345678);
+                $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'] );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'username', 'password', 1 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post', 'custom_fields' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this-&gt;assertInternalType( 'string', $result['post_id'] );
+                $this-&gt;assertInternalType( 'string', $result['post_title'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+                $this-&gt;assertInternalType( 'string', $result['post_status'] );
+                $this-&gt;assertInternalType( 'string', $result['post_type'] );
+                $this-&gt;assertInternalType( 'string', $result['post_name'] );
+                $this-&gt;assertInternalType( 'string', $result['post_author'] );
+                $this-&gt;assertInternalType( 'string', $result['post_password'] );
+                $this-&gt;assertInternalType( 'string', $result['post_excerpt'] );
+                $this-&gt;assertInternalType( 'string', $result['post_content'] );
+                $this-&gt;assertInternalType( 'string', $result['link'] );
+                $this-&gt;assertInternalType( 'string', $result['comment_status'] );
+                $this-&gt;assertInternalType( 'string', $result['ping_status'] );
+                $this-&gt;assertInternalType( 'bool', $result['sticky'] );
+                $this-&gt;assertInternalType( 'string', $result['post_format'] );
+                $this-&gt;assertInternalType( 'array', $result['post_thumbnail'] );
+                $this-&gt;assertInternalType( 'array', $result['custom_fields'] );
+
+                // Check expected values
+                $this-&gt;assertStringMatchesFormat( '%d', $result['post_id'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_title'], $result['post_title'] );
+                $this-&gt;assertEquals( 'draft', $result['post_status'] );
+                $this-&gt;assertEquals( 'post', $result['post_type'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['post_author'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_excerpt'], $result['post_excerpt'] );
+                $this-&gt;assertEquals( $this-&gt;post_data['post_content'], $result['post_content'] );
+                $this-&gt;assertEquals( url_to_postid( $result['link'] ), $this-&gt;post_id );
+                $this-&gt;assertEquals( $this-&gt;post_custom_field['id'], $result['custom_fields'][0]['id'] );
+                $this-&gt;assertEquals( $this-&gt;post_custom_field['key'], $result['custom_fields'][0]['key'] );
+                $this-&gt;assertEquals( $this-&gt;post_custom_field['value'], $result['custom_fields'][0]['value'] );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_no_fields() {
+                $fields = array();
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // when no fields are requested, only the IDs should be returned
+                $this-&gt;assertEquals( 1, count( $result ) );
+                $this-&gt;assertEquals( array( 'post_id' ), array_keys( $result ) );
+        }
+
+        function test_default_fields() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertArrayHasKey( 'post_id', $result );
+                $this-&gt;assertArrayHasKey( 'link', $result ); // random field from 'posts' group
+                $this-&gt;assertArrayHasKey( 'terms', $result );
+                $this-&gt;assertArrayHasKey( 'custom_fields', $result );
+        }
+
+        function test_date() {
+                $fields = array( 'post' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPost( array( 1, 'author', 'author', $this-&gt;post_id, $fields ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+                $this-&gt;assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+
+                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['post_date']-&gt;getTimestamp() );
+                $this-&gt;assertEquals( $this-&gt;post_date_ts, $result['post_modified']-&gt;getTimestamp() );
+
+                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+                $post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this-&gt;post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this-&gt;assertEquals( $post_date_gmt, $result['post_date_gmt']-&gt;getTimestamp() );
+                $this-&gt;assertEquals( $post_modified_gmt, $result['post_modified_gmt']-&gt;getTimestamp() );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetPostTypephpfromrev903trunkteststestxmlrpcapitest_wp_getPostTypephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPostType.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPostType.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPostType.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPostType.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,132 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostType extends WP_XMLRPC_UnitTestCase {
+        var $cpt_name;
+        var $cpt_args;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;cpt_name = 'post_type_test';
+                $this-&gt;cpt_args = array(
+                        'public' =&gt; false,
+                        'show_ui' =&gt; true,
+                        'show_in_menu' =&gt; true,
+                        'menu_position' =&gt; 7,
+                        'menu_icon' =&gt; 'cpt_icon.png',
+                        'taxonomies' =&gt; array( 'category', 'post_tag' ),
+                        'hierarchical' =&gt; true
+                );
+                register_post_type( $this-&gt;cpt_name, $this-&gt;cpt_args );
+        }
+
+        function tearDown() {
+                _unregister_post_type( $this-&gt;cpt_name );
+
+                parent::tearDown();
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'username', 'password', 'post' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_invalid_post_type_name() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_valid_post_type_name() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_valid_type() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostType( array( 1, 'editor', 'editor', $this-&gt;cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // check data types
+                $this-&gt;assertInternalType( 'string', $result['name'] );
+                $this-&gt;assertInternalType( 'string', $result['label'] );
+                $this-&gt;assertInternalType( 'bool', $result['hierarchical'] );
+                $this-&gt;assertInternalType( 'bool', $result['public'] );
+                $this-&gt;assertInternalType( 'bool', $result['_builtin'] );
+                $this-&gt;assertInternalType( 'bool', $result['map_meta_cap'] );
+                $this-&gt;assertInternalType( 'bool', $result['has_archive'] );
+                $this-&gt;assertInternalType( 'bool', $result['show_ui'] );
+                $this-&gt;assertInternalType( 'int', $result['menu_position'] );
+                $this-&gt;assertInternalType( 'string', $result['menu_icon'] );
+                $this-&gt;assertInternalType( 'array', $result['labels'] );
+                $this-&gt;assertInternalType( 'array', $result['cap'] );
+                $this-&gt;assertInternalType( 'array', $result['taxonomies'] );
+                $this-&gt;assertInternalType( 'array', $result['supports'] );
+
+                // check label data types
+                $this-&gt;assertInternalType( 'string', $result['labels']['name'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['singular_name'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['add_new'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['add_new_item'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['edit_item'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['new_item'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['view_item'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['search_items'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['not_found'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['not_found_in_trash'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['parent_item_colon'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['all_items'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['menu_name'] );
+                $this-&gt;assertInternalType( 'string', $result['labels']['name_admin_bar'] );
+
+                // check cap data types
+                $this-&gt;assertInternalType( 'string', $result['cap']['edit_post'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['read_post'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['delete_post'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['edit_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['edit_others_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['publish_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['read_private_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['read'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['delete_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['delete_private_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['delete_published_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['delete_others_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['edit_private_posts'] );
+                $this-&gt;assertInternalType( 'string', $result['cap']['edit_published_posts'] );
+
+                // check taxonomy data types
+                foreach ( $result['taxonomies'] as $taxonomy ) {
+                        $this-&gt;assertInternalType( 'string', $taxonomy );
+                }
+
+                // check taxonomy data types
+                foreach ( $result['supports'] as $key =&gt; $value ) {
+                        $this-&gt;assertInternalType( 'string', $key );
+                        $this-&gt;assertInternalType( 'bool', $value );
+                }
+
+                // Check expected values
+                $this-&gt;assertEquals( $this-&gt;cpt_name, $result['name'] );
+                foreach ( $this-&gt;cpt_args as $key =&gt; $value ) {
+                        $this-&gt;assertEquals( $value, $result[$key] );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpgetPostTypesphpfromrev903trunkteststestxmlrpcapitest_wp_getPostTypesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPostTypes.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPostTypes.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPostTypes.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPostTypes.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertInternalType( 'array', $result );
+                $this-&gt;assertEquals( 0, count( $result ) );
+        }
+
+        function test_capable_user() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertInternalType( 'array', $result );
+                $this-&gt;assertGreaterThan( 0, count( $result ) );
+        }
+
+        function test_simple_filter() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' =&gt; true ) ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertInternalType( 'array', $result );
+
+                // verify that pages is in the result, and post is not
+                $result_names = wp_list_pluck( $result, 'name' );
+                $this-&gt;assertContains( 'page', $result_names );
+                $this-&gt;assertNotContains( 'post', $result_names );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetPostsphpfromrev903trunkteststestxmlrpcapitest_wp_getPostsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getPosts.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getPosts.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getPosts.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getPosts.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'username', 'password' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        /**
+         * @ticket 20991
+         */
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $filter = array( 'post_type' =&gt; 'page' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_user() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_invalid_post_type() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $filter = array( 'post_type' =&gt; 'invalid_post_type_name' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_filters() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $cpt_name = 'test_wp_getposts_cpt';
+                register_post_type( $cpt_name, array(
+                        'taxonomies' =&gt; array( 'post_tag', 'category' ),
+                        'public' =&gt; true
+                ));
+
+                $num_posts = 17;
+                $post_ids = $this-&gt;factory-&gt;post-&gt;create_many( $num_posts, array( 'post_type' =&gt; $cpt_name ) );
+
+                // get them all
+                $filter = array( 'post_type' =&gt; $cpt_name, 'number' =&gt; $num_posts + 10 );
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+                $this-&gt;assertEquals( $num_posts, count( $results ) );
+
+                // page through results
+                $posts_found = array();
+                $filter['number'] = 5;
+                $filter['offset'] = 0;
+                do {
+                        $presults = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                        foreach( $presults as $post ) {
+                                $posts_found[] = $post['post_id'];
+                        }
+                        $filter['offset'] += $filter['number'];
+                } while ( count( $presults ) &gt; 0 );
+                // verify that $post_ids matches $posts_found
+                $this-&gt;assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) );
+
+                // add comments to some of the posts
+                $random_posts = array_rand( $post_ids, $num_posts / 2 );
+                foreach ( $random_posts as $i ) {
+                        $post = $post_ids[$i];
+                        $this-&gt;factory-&gt;comment-&gt;create_post_comments( $post, rand( 1, 20 ) );
+                }
+
+                // get results ordered by comment count
+                $filter2 = array( 'post_type' =&gt; $cpt_name, 'number' =&gt; $num_posts, 'orderby' =&gt; 'comment_count', 'order' =&gt; 'DESC' );
+                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
+                $last_comment_count = 100;
+                foreach ( $results2 as $post ) {
+                        $comment_count = intval( get_comments_number( $post['post_id'] ) );
+                        $this-&gt;assertLessThanOrEqual( $last_comment_count, $comment_count );
+                        $last_comment_count = $comment_count;
+                }
+
+                // set one of the posts to draft and get drafts
+                $post = get_post( $post_ids[$random_posts[0]] );
+                $post-&gt;post_status = 'draft';
+                wp_update_post( $post );
+                $filter3 = array( 'post_type' =&gt; $cpt_name, 'post_status' =&gt; 'draft' );
+                $results3 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results3 );
+                $this-&gt;assertEquals( 1, count( $results3 ) );
+                $this-&gt;assertEquals( $post-&gt;ID, $results3[0]['post_id'] );
+
+                _unregister_post_type( $cpt_name );
+        }
+
+        function test_fields() {
+                $this-&gt;make_user_by_role( 'editor' );
+                $this-&gt;factory-&gt;post-&gt;create();
+
+                // check default fields
+                $results = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor' ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results );
+                $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields
+                foreach( $expected_fields as $field ) {
+                        $this-&gt;assertArrayHasKey( $field, $results[0] );
+                }
+
+                // request specific fields and verify that only those are returned
+                $filter = array();
+                $fields = array( 'post_name', 'post_author', 'enclosure' );
+                $results2 = $this-&gt;myxmlrpcserver-&gt;wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $results2 );
+                $expected_fields = array_merge( $fields, array( 'post_id' ) );
+                foreach ( array_keys( $results2[0] ) as $field ) {
+                        $this-&gt;assertContains( $field, $expected_fields );
+                }
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetTaxonomiesphpfromrev903trunkteststestxmlrpcapitest_wp_getTaxonomiesphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getTaxonomies.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getTaxonomies.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getTaxonomies.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getTaxonomies.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_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">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetTaxonomyphpfromrev903trunkteststestxmlrpcapitest_wp_getTaxonomyphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getTaxonomy.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getTaxonomy.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getTaxonomy.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getTaxonomy.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_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">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpgetTermphpfromrev903trunkteststestxmlrpcapitest_wp_getTermphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getTerm.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getTerm.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getTerm.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_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="trunktestsxmlrpcwpgetTermsphpfromrev903trunkteststestxmlrpcapitest_wp_getTermsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/getTerms.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_getTerms.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/getTerms.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/getTerms.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_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="trunktestsxmlrpcwpnewPostphpfromrev903trunkteststestxmlrpcapitest_wp_newPostphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/newPost.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_newPost.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/newPost.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/newPost.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,305 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'username', 'password', array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_incapable_user() {
+                $this-&gt;make_user_by_role( 'subscriber' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_no_content() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', array() ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+                $this-&gt;assertEquals( 'Content, title, and excerpt are empty.', $result-&gt;message );
+        }
+
+        function test_basic_content() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Test' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_ignore_id() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'ID' =&gt; 103948 );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertNotEquals( '103948', $result );
+        }
+
+        function test_capable_publish() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_publish() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'publish' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_private() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_private() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_other_author() {
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_other_author() {
+                $other_author_id = $this-&gt;make_user_by_role( 'author' );
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; $other_author_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_invalid_author() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_author' =&gt; 99999999 );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 404, $result-&gt;code );
+        }
+
+        function test_empty_author() {
+                $my_author_id = $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Test' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this-&gt;assertEquals( $my_author_id, $out-&gt;post_author );
+                $this-&gt;assertEquals( 'Test', $out-&gt;post_title );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $this-&gt;make_user_by_role( 'author' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $upload = wp_upload_bits( $filename, null, $contents );
+                $this-&gt;assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' =&gt; 'Post Thumbnail',
+                        'post_type' =&gt; 'attachment',
+                        'post_mime_type' =&gt; 'image/jpeg',
+                        'guid' =&gt; $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+                $post = array( 'post_title' =&gt; 'Post Thumbnail Test', 'post_thumbnail' =&gt; $attachment_id );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_invalid_post_status() {
+                $this-&gt;make_user_by_role( 'author' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'foobar_status' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 'draft', get_post_status( $result ) );
+        }
+
+        function test_incapable_sticky() {
+                $this-&gt;make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_capable_sticky() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'sticky' =&gt; true );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertTrue( is_sticky( $result ) );
+        }
+
+        function test_private_sticky() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_status' =&gt; 'private', 'sticky' =&gt; true );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+        }
+
+        function test_post_format() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'quote' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 'quote', get_post_format( $result ) );
+        }
+
+        function test_invalid_post_format() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' =&gt; 'Test', 'post_format' =&gt; 'tumblr' );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( '', get_post_format( $result ) );
+        }
+
+        function test_invalid_taxonomy() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array(
+                        'post_title' =&gt; 'Test',
+                        'terms' =&gt; array(
+                                'foobar_nonexistant' =&gt; array( 1 )
+                        )
+                );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+
+                $post2 = array(
+                        'post_title' =&gt; 'Test',
+                        'terms_names' =&gt; array(
+                                'foobar_nonexistant' =&gt; array( 1 )
+                        )
+                );
+                $result2 = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result2 );
+                $this-&gt;assertEquals( 401, $result2-&gt;code );
+        }
+
+        function test_invalid_term_id() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $post = array(
+                        'post_title' =&gt; 'Test',
+                        'terms' =&gt; array(
+                                'post_tag' =&gt; array( 1390490823409 )
+                        )
+                );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+        }
+
+        function test_terms() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $tag1 = wp_create_tag ( rand_str( 30 ) );
+                $tag2 = wp_create_tag ( rand_str( 30 ) );
+                $tag3 = wp_create_tag ( rand_str( 30 ) );
+
+                $post = array(
+                        'post_title' =&gt; 'Test',
+                        'terms' =&gt; array(
+                                'post_tag' =&gt; array( $tag2['term_id'], $tag3['term_id'] )
+                        )
+                );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' =&gt; 'ids' ) );
+                $this-&gt;assertNotContains( $tag1['term_id'], $post_tags );
+                $this-&gt;assertContains( $tag2['term_id'], $post_tags );
+                $this-&gt;assertContains( $tag3['term_id'], $post_tags );
+        }
+
+        function test_terms_names() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $ambiguous_name = rand_str( 30 );
+                $parent_cat = wp_create_category( $ambiguous_name );
+                $child_cat = wp_create_category( $ambiguous_name, $parent_cat );
+
+                $cat1_name = rand_str( 30 );
+                $cat1 = wp_create_category( $cat1_name, $parent_cat );
+                $cat2_name = rand_str( 30 );
+
+                // first a post with valid categories; one that already exists and one to be created
+                $post = array(
+                        'post_title' =&gt; 'Test',
+                        'terms_names' =&gt; array(
+                                'category' =&gt; array( $cat1_name, $cat2_name )
+                        )
+                );
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                // verify that cat2 was created
+                $cat2 = get_term_by( 'name', $cat2_name, 'category' );
+                $this-&gt;assertNotEmpty( $cat2 );
+                // check that both categories were set on the post
+                $post_cats = wp_get_object_terms( $result, 'category', array( 'fields' =&gt; 'ids' ) );
+                $this-&gt;assertContains( $cat1, $post_cats );
+                $this-&gt;assertContains( $cat2-&gt;term_id, $post_cats );
+
+                // create a second post attempting to use the ambiguous name
+                $post2 = array(
+                        'post_title' =&gt; 'Test',
+                        'terms_names' =&gt; array(
+                                'category' =&gt; array( $cat1_name, $ambiguous_name )
+                        )
+                );
+                $result2 = $this-&gt;myxmlrpcserver-&gt;wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result2 );
+                $this-&gt;assertEquals( 401, $result2-&gt;code );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsxmlrpcwpnewTermphpfromrev903trunkteststestxmlrpcapitest_wp_newTermphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/newTerm.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_newTerm.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/newTerm.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/newTerm.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newTerm extends WP_XMLRPC_UnitTestCase {
+        var $parent_term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
+                $this-&gt;parent_term = $this-&gt;parent_term['term_id'];
+        }
+
+        function test_invalid_username_password() {
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'username', 'password', array() ) );
+                $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_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; '' ) ) );
+                $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_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; '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_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' =&gt; 'category' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 401, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result-&gt;message );
+        }
+
+        function test_empty_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; '' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'The term name cannot be empty.' ), $result-&gt;message );
+        }
+
+        function test_parent_for_nonhierarchical() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $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' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'This taxonomy is not hierarchical.' ), $result-&gt;message );
+        }
+
+        function test_parent_invalid() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 'dasda', 'name' =&gt; 'test' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 500, $result-&gt;code );
+        }
+
+        function test_parent_not_existing() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; 9999, 'name' =&gt; 'test' ) ) );
+                $this-&gt;assertInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertEquals( 403, $result-&gt;code );
+                $this-&gt;assertEquals( __( 'Parent term does not exist.' ), $result-&gt;message );
+        }
+
+
+        function test_add_term() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'name' =&gt; 'test' ) ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_add_term_with_parent() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test' ) ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_add_term_with_all() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                $taxonomy = array( 'taxonomy' =&gt; 'category', 'parent' =&gt; $this-&gt;parent_term, 'name' =&gt; 'test_all', 'description' =&gt; 'Test all', 'slug' =&gt; 'test_all' );
+                $result  = $this-&gt;myxmlrpcserver-&gt;wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+                $this-&gt;assertStringMatchesFormat( '%d', $result );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunktestsxmlrpcwpuploadFilephpfromrev903trunkteststestxmlrpcapitest_wp_uploadFilephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/xmlrpc/wp/uploadFile.php (from rev 903, trunk/tests/test-xmlrpc-api/test_wp_uploadFile.php) (0 => 904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/xmlrpc/wp/uploadFile.php                                (rev 0)
+++ trunk/tests/xmlrpc/wp/uploadFile.php        2012-07-18 19:01:41 UTC (rev 904)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
+        function test_valid_attachment() {
+                $this-&gt;make_user_by_role( 'editor' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $data = array(
+                        'name' =&gt; 'a2-small.jpg',
+                        'type' =&gt; 'image/jpeg',
+                        'bits' =&gt; base64_encode( $contents )
+                );
+
+
+                $result = $this-&gt;myxmlrpcserver-&gt;mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
+                $this-&gt;assertNotInstanceOf( 'IXR_Error', $result );
+
+                // check data types
+                $this-&gt;assertInternalType( 'string', $result['id'] );
+                $this-&gt;assertStringMatchesFormat( '%d', $result['id'] );
+                $this-&gt;assertInternalType( 'string', $result['file'] );
+                $this-&gt;assertInternalType( 'string', $result['url'] );
+                $this-&gt;assertInternalType( 'string', $result['type'] );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>