<!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>+<?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->assertSame( 10, has_action($tag, $closure) );
+
+                $context = array( rand_str(), rand_str() );
+                do_action($tag, $context[0], $context[1]);
+
+                $this->assertSame($GLOBALS[$context[0]], $context[1]);
+
+                $tag2 = rand_str();
+                $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
+                add_action($tag2, $closure2);
+
+                $this->assertSame( 10, has_action($tag2, $closure2) );
+
+                do_action($tag2);
+
+                $this->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>+<?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(&$a, 'action'));
+                do_action($tag);
+
+                // only one event occurred for the hook, with empty args
+                $this->assertEquals(1, $a->get_call_count());
+                // only our hook was called
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                $args = array_pop($a->get_args());
+                $this->assertEquals(array(''), $args);
+        }
+
+        function test_remove_action() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'action'));
+                do_action($tag);
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the action, do it again, and make sure it's not called this time
+                remove_action($tag, array(&$a, 'action'));
+                do_action($tag);
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+        }
+
+        function test_has_action() {
+                        $tag = rand_str();
+                        $func = rand_str();
+
+                        $this->assertFalse( has_action($tag, $func) );
+                        $this->assertFalse( has_action($tag) );
+                        add_action($tag, $func);
+                        $this->assertEquals( 10, has_action($tag, $func) );
+                        $this->assertTrue( has_action($tag) );
+                        remove_action($tag, $func);
+                        $this->assertFalse( has_action($tag, $func) );
+                        $this->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(&$a1, 'action'));
+                add_action($tag, array(&$a2, 'action'));
+
+                do_action($tag);
+
+                // both actions called once each
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(1, $a2->get_call_count());
+        }
+
+        function test_action_args_1() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_action($tag, array(&$a, 'action'));
+                // call the action with a single argument
+                do_action($tag, $val);
+
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($val), array_pop($a->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(&$a1, 'action'), 10, 2);
+                add_action($tag, array(&$a2, 'action'));
+                // call the action with two arguments
+                do_action($tag, $val1, $val2);
+
+                // a1 should be called with both args
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(array($val1, $val2), array_pop($a1->get_args()));
+
+                // a2 should be called with one only
+                $this->assertEquals(1, $a2->get_call_count());
+                $this->assertEquals(array($val1), array_pop($a2->get_args()));
+        }
+
+        function test_action_priority() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'action'), 10);
+                add_action($tag, array(&$a, 'action2'), 9);
+                do_action($tag);
+
+                // two events, one per action
+                $this->assertEquals(2, $a->get_call_count());
+
+                $expected = array (
+                        // action2 is called first because it has priority 9
+                        array (
+                                'action' => 'action2',
+                                'tag' => $tag,
+                                'args' => array('')
+                        ),
+                        // action 1 is called second
+                        array (
+                                'action' => 'action',
+                                'tag' => $tag,
+                                'args' => array('')
+                        ),
+                );
+
+                $this->assertEquals($expected, $a->get_events());
+        }
+
+        function test_did_action() {
+                $tag1 = rand_str();
+                $tag2 = rand_str();
+
+                // do action tag1 but not tag2
+                do_action($tag1);
+                $this->assertEquals(1, did_action($tag1));
+                $this->assertEquals(0, did_action($tag2));
+
+                // do action tag2 a random number of times
+                $count = rand(0, 10);
+                for ($i=0; $i<$count; $i++)
+                        do_action($tag2);
+
+                // tag1's count hasn't changed, tag2 should be correct
+                $this->assertEquals(1, did_action($tag1));
+                $this->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(&$a, 'action'));
+                $this->assertEquals(10, has_filter('all', array(&$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->assertEquals(4, $a->get_call_count());
+                // only our hook was called
+                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
+
+                remove_action('all', array(&$a, 'action'));
+                $this->assertFalse(has_filter('all', array(&$a, 'action')));
+
+        }
+
+        function test_remove_all_action() {
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action('all', array(&$a, 'action'));
+                $this->assertEquals(10, has_filter('all', array(&$a, 'action')));
+                do_action($tag);
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the action, do it again, and make sure it's not called this time
+                remove_action('all', array(&$a, 'action'));
+                $this->assertFalse(has_filter('all', array(&$a, 'action')));
+                do_action($tag);
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+        }
+
+        function test_action_ref_array() {
+                $obj = new stdClass();
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'action'));
+
+                do_action_ref_array($tag, array(&$obj));
+
+                $args = $a->get_args();
+                $this->assertSame($args[0][0], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][0]->foo) );
+        }
+
+        /**
+         * @ticket 11241
+         */
+        function test_action_keyed_array() {
+                $a = new MockAction();
+
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'action'));
+
+                $context = array( rand_str() => rand_str() );
+                do_action($tag, $context);
+
+                $args = $a->get_args();
+                $this->assertSame($args[0][0], $context);
+
+                $context2 = array( rand_str() => rand_str(), rand_str() => rand_str() );
+                do_action($tag, $context2);
+
+                $args = $a->get_args();
+                $this->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>+<?php
+
+/**
+ * @group admin
+ */
+class TestShortenUrl extends WP_UnitTestCase {
+        function test_shorten_url() {
+                $tests = array(
+                        // strip slashes
+                        'wordpress\.org/about/philosophy'
+                                => 'wordpress.org/about/philosophy', // strip slashes
+                        'http://wordpress.org/about/philosophy/'
+                                => 'wordpress.org/about/philosophy', // remove http, trailing slash
+                        'http://www.wordpress.org/about/philosophy/'
+                                => 'wordpress.org/about/philosophy', // remove http, www
+                        'http://wordpress.org/about/philosophy/#box'
+                                => 'wordpress.org/about/philosophy/#box', // don't shorten 35 characters
+                        'http://wordpress.org/about/philosophy/#decisions'
+                                => 'wordpress.org/about/philosophy/#...', // shorten to 32 if > 35 after cleaning
+                );
+                foreach ( $tests as $k => $v )
+                        $this->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>+<?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' => 'Hello Dolly',
+                        'Title' => '<a href="http://wordpress.org/#" title="Visit plugin homepage">Hello Dolly</a>',
+                        'PluginURI' => 'http://wordpress.org/#',
+                        'Description' => '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. <cite>By <a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>.</cite>',
+                        'Author' => '<a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>',
+                        'AuthorURI' => 'http://ma.tt/',
+                        'Version' => '1.5.1',
+                        'TextDomain' => 'hello-dolly',
+                        'DomainPath' => ''
+                );
+
+                $this->assertTrue( is_array($data) );
+
+                foreach ($default_headers as $name => $value) {
+                        $this->assertTrue(isset($data[$name]));
+                        $this->assertEquals($value, $data[$name]);
+                }
+        }
+
+        function test_menu_page_url() {
+                $current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => '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&#038;page=testpages';
+
+                foreach ($expected as $name => $value) {
+                        $this->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>+<?php
+
+/**
+ * @group admin
+ */
+class WPTestScreen extends WP_UnitTestCase {
+        var $core_screens = array(
+                'index.php' => array( 'base' => 'dashboard', 'id' => 'dashboard' ),
+                'edit.php' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post' ),
+                'post-new.php'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post' ),
+                'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
+                'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
+                'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
+                'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ),
+                'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
+                'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
+                'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),
+                'link-add.php' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link' ),
+                'edit-tags.php?taxonomy=link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category' ),
+                'edit-comments.php' => array( 'base' => 'edit-comments', 'id' => 'edit-comments' ),
+                'themes.php' => array( 'base' => 'themes', 'id' => 'themes' ),
+                'widgets.php' => array( 'base' => 'widgets', 'id' => 'widgets' ),
+                'nav-menus.php' => array( 'base' => 'nav-menus', 'id' => 'nav-menus' ),
+                'plugins.php' => array( 'base' => 'plugins', 'id' => 'plugins' ),
+                'users.php' => array( 'base' => 'users', 'id' => 'users' ),
+                'user-new.php' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user' ),
+                'profile.php' => array( 'base' => 'profile', 'id' => 'profile' ),
+                'tools.php' => array( 'base' => 'tools', 'id' => 'tools' ),
+                'import.php' => array( 'base' => 'import', 'id' => 'import' ),
+                'export.php' => array( 'base' => 'export', 'id' => 'export' ),
+                'options-general.php' => array( 'base' => 'options-general', 'id' => 'options-general' ),
+                'options-writing.php' => array( 'base' => 'options-writing', 'id' => '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->core_screens as $hook_name => $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->post_type ) )
+                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen->post_type;
+                        }
+
+                        $GLOBALS['hook_suffix'] = $hook['path'];
+                        set_current_screen();
+
+                        $this->assertEquals( $screen->id, $current_screen->id, $hook_name );
+                        $this->assertEquals( $screen->base, $current_screen->base, $hook_name );
+                        if ( isset( $screen->action ) )
+                                $this->assertEquals( $screen->action, $current_screen->action, $hook_name );
+                        if ( isset( $screen->post_type ) )
+                                $this->assertEquals( $screen->post_type, $current_screen->post_type, $hook_name );
+                        else
+                                $this->assertEmpty( $current_screen->post_type, $hook_name );
+                        if ( isset( $screen->taxonomy ) )
+                                $this->assertEquals( $screen->taxonomy, $current_screen->taxonomy, $hook_name );
+
+                        // With convert_to_screen(), the same ID should return the exact $current_screen.
+                        $this->assertSame( $current_screen, convert_to_screen( $screen->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->assertSame( $current_screen, convert_to_screen( $GLOBALS['hook_suffix'] ), $hook_name );
+                }
+        }
+
+        function test_post_type_as_hookname() {
+                $screen = convert_to_screen( 'page' );
+                $this->assertEquals( $screen->post_type, 'page' );
+                $this->assertEquals( $screen->base, 'post' );
+                $this->assertEquals( $screen->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->assertEquals( $screen->post_type, 'value-add' );
+                $this->assertEquals( $screen->base, 'post' );
+                $this->assertEquals( $screen->id, 'value-add' );
+
+                $screen = convert_to_screen( 'edit-value-add' ); // the -add part is key.
+                $this->assertEquals( $screen->post_type, 'value-add' );
+                $this->assertEquals( $screen->base, 'edit' );
+                $this->assertEquals( $screen->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->assertEquals( $screen->taxonomy, 'old-or-new' );
+                $this->assertEquals( $screen->base, 'edit-tags' );
+                $this->assertEquals( $screen->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->assertEquals( $screen->post_type, 'edit-some-thing' );
+                $this->assertEquals( $screen->base, 'post' );
+                $this->assertEquals( $screen->id, 'edit-some-thing' );
+
+                $screen = convert_to_screen( 'edit-edit-some-thing' );
+                $this->assertEquals( $screen->post_type, 'edit-some-thing' );
+                $this->assertEquals( $screen->base, 'edit' );
+                $this->assertEquals( $screen->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->assertEquals( $screen->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->assertEquals( $screen->base, 'post' );
+
+                // Core wins.
+                $screen = convert_to_screen( 'edit-tags' );
+                $this->assertEquals( $screen->base, 'edit-tags' );
+
+                $screen = convert_to_screen( 'tags' );
+                $this->assertEquals( $screen->base, 'post' );
+        }
+
+        function test_help_tabs() {
+                $tab = rand_str();
+                $tab_args = array(
+                        'id' => $tab,
+                        'title' => 'Help!',
+                        'content' => 'Some content',
+                        'callback' => false,
+                );
+
+                $screen = get_current_screen();
+                $screen->add_help_tab( $tab_args );
+                $this->assertEquals( $screen->get_help_tab( $tab ), $tab_args );
+
+                $tabs = $screen->get_help_tabs();
+                $this->assertArrayHasKey( $tab, $tabs );
+
+                $screen->remove_help_tab( $tab );
+                $this->assertNull( $screen->get_help_tab( $tab ) );
+
+                $screen->remove_help_tabs();
+                $this->assertEquals( $screen->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>+<?php
+/**
+ * @group admin
+ */
+class WPTestCheckedSelected extends WP_UnitTestCase {
+        function test_equal() {
+                $this->assertEquals(' selected=\'selected\'', selected('foo','foo',false));
+                $this->assertEquals(' checked=\'checked\'', checked('foo','foo',false));
+
+                $this->assertEquals(' selected=\'selected\'', selected('1',1,false));
+                $this->assertEquals(' checked=\'checked\'', checked('1',1,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected('1',true,false));
+                $this->assertEquals(' checked=\'checked\'', checked('1',true,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected(1,1,false));
+                $this->assertEquals(' checked=\'checked\'', checked(1,1,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected(1,true,false));
+                $this->assertEquals(' checked=\'checked\'', checked(1,true,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected(true,true,false));
+                $this->assertEquals(' checked=\'checked\'', checked(true,true,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected('0',0,false));
+                $this->assertEquals(' checked=\'checked\'', checked('0',0,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected(0,0,false));
+                $this->assertEquals(' checked=\'checked\'', checked(0,0,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected('',false,false));
+                $this->assertEquals(' checked=\'checked\'', checked('',false,false));
+
+                $this->assertEquals(' selected=\'selected\'', selected(false,false,false));
+                $this->assertEquals(' checked=\'checked\'', checked(false,false,false));
+        }
+
+        function test_notequal() {
+                $this->assertEquals('', selected('0','',false));
+                $this->assertEquals('', checked('0','',false));
+
+                $this->assertEquals('', selected(0,'',false));
+                $this->assertEquals('', checked(0,'',false));
+
+                $this->assertEquals('', selected(0,false,false));
+                $this->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>+<?php
+/**
+ * @group themes
+ */
+class TestPageTemplates extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this->theme_root = DIR_TESTDATA . '/themedir1';
+
+                $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
+                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
+
+                add_filter('theme_root', array(&$this, '_theme_root'));
+                add_filter( 'stylesheet_root', array(&$this, '_theme_root') );
+                add_filter( 'template_root', array(&$this, '_theme_root') );
+
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
+                remove_filter('theme_root', array(&$this, '_theme_root'));
+                remove_filter( 'stylesheet_root', array(&$this, '_theme_root') );
+                remove_filter( 'template_root', array(&$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->theme_root;
+        }
+
+        /**
+         * @ticket 10959
+         * @ticket 11216
+         */
+        function test_page_templates() {
+                $theme = get_theme('Page Template Theme');
+                $this->assertFalse( empty($theme) );
+
+                switch_theme($theme['Template'], $theme['Stylesheet']);
+
+                $templates = get_page_templates();
+                $this->assertEquals(3, count($templates));
+                $this->assertEquals("template-top-level.php", $templates['Top Level']);
+                $this->assertEquals("subdir/template-sub-dir.php", $templates['Sub Dir']);
+                $this->assertEquals("template-header.php", $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>+<?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->current_user = get_current_user_id();
+                wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this->current_user );
+                parent::tearDown();
+        }
+
+        /**
+         * @ticket 21117
+         */
+        function test_content_post_type() {
+                register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
+
+                $admin_bar = new WP_Admin_Bar;
+
+                wp_admin_bar_new_content_menu( $admin_bar );
+
+                $nodes = $admin_bar->get_nodes();
+                $this->assertFalse( $nodes['new-content']->parent );
+                $this->assertEquals( 'new-content', $nodes['add-new-content']->parent );
+
+                _unregister_post_type( 'content' );
+        }
+
+        /**
+         * @ticket 21117
+         */
+        function test_merging_existing_meta_values() {
+                $admin_bar = new WP_Admin_Bar;
+
+                $admin_bar->add_node( array(
+                        'id' => 'test-node',
+                        'meta' => array( 'class' => 'test-class' ),
+                ) );
+                $node = $admin_bar->get_node( 'test-node' );
+                $this->assertEquals( array( 'class' => 'test-class' ), $node->meta );
+
+                $admin_bar->add_node( array(
+                        'id' => 'test-node',
+                        'meta' => array( 'some-meta' => 'value' ),
+                ) );
+
+                $node = $admin_bar->get_node( 'test-node' );
+                $this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node->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>+<?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->factory->post->create( array( 'post_status' => 'draft' ) );
+                $this->_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' => 1,
+                 'autosave' => 1
+                );
+                
+                // Make the request
+                try {
+                        $this->_handleAjax( 'nopriv_autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this->assertEquals( 1, (string) $xml->response[0]->autosave['id'] );
+                $this->assertEquals( 'nopriv_autosave_1', (string) $xml->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' => 1
+                );
+                
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'nopriv_autosave' );
+        }
+        
+        /**
+         * Test autosaving a post
+         * @return void
+         */
+        public function test_autosave_post() {
+
+                // Become an admin
+                $this->_setRole( 'administrator' );
+                        
+                // Set up the $_POST request
+                $md5 = md5( uniqid() );
+                $_POST = array(
+                 'post_ID' => $this->_post->ID,
+                 'autosavenonce' => wp_create_nonce( 'autosave' ),
+                 'post_content' => $this->_post->post_content . PHP_EOL . $md5,
+                 'autosave' => 1
+                );
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this->assertEquals( $this->_post->ID, (int) $xml->response[0]->autosave['id'] );
+                $this->assertEquals( 'autosave_' . $this->_post->ID, (string) $xml->response['action']);
+                
+                // Check that the edit happened
+                $post = get_post( $this->_post->ID) ;
+                $this->assertGreaterThanOrEqual( 0, strpos( $post->post_content, $md5 ) );
+        }
+
+        /**
+         * Test with an invalid nonce
+         * @return void
+         */
+        public function test_with_invalid_nonce( ) {
+                
+                // Become an administrator                
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST = array(
+                 'post_ID' => $this->_post->ID,
+                 'autosavenonce' => md5( uniqid() ),
+                 'autosave' => 1
+                );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'autosave' );
+        }
+        
+        /**
+         * Test with a bad post id
+         * @return void
+         */
+        public function test_with_invalid_post_id( ) {
+                
+                // Become an administrator        
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST = array(
+                 'post_ID' => 0,
+                 'autosavenonce' => wp_create_nonce( 'autosave' ),
+                 'autosave' => 1
+                );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', 'You are not allowed to edit this post.' );
+                $this->_handleAjax( 'autosave' );
+        }
+        
+        /**
+         * Test with a locked post
+         * @return void
+         */
+        public function test_locked_post() {
+
+                // Become an administrator                
+                $this->_setRole( 'administrator' );
+                
+                // Lock the post
+                wp_set_post_lock( $this->_post->ID );
+                
+                // Become a different administrator
+                $this->_setRole( 'administrator' );
+        
+                // Set up the $_POST request
+                $_POST = array(
+                 'post_ID' => $this->_post->ID,
+                 'autosavenonce' => wp_create_nonce( 'autosave' ),
+                 'autosave' => 1
+                );
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this->assertEquals( $this->_post->ID, (int) $xml->response[0]->autosave['id'] );
+                $this->assertEquals( 'autosave_' . $this->_post->ID, (string) $xml->response['action']);
+                $this->assertEquals( 'disable', (string) $xml->response[0]->autosave[0]->supplemental[0]->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->_setRole( 'administrator' );
+                        
+                // Set up the $_POST request
+                $_POST = array(
+                 'post_ID' => $this->_post->ID,
+                 'autosavenonce' => wp_create_nonce( 'autosave' ),
+                 'autosave' => 1
+                );
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'autosave' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Look for the warning
+                $this->assertRegExp( '/Your login has expired. Please open a new browser window/' , $this->_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>+<?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->logout();
+
+                // Set up a default request
+                $_GET['test'] = 1;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this->_handleAjax( 'wp-compression-test' );
+        }
+        
+        /**
+         * Fetch the test text
+         */
+        public function test_text() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 1;
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this->assertContains( 'wpCompressionTest', $this->_last_response );
+        }
+
+        /**
+         * Fetch the test text (gzdeflate)
+         */
+        public function test_gzdeflate() {
+
+                if ( !function_exists( 'gzdeflate' ) ) {
+                        $this->markTestSkipped( 'gzdeflate function not available' );
+                }
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this->assertContains( 'wpCompressionTest', gzinflate( $this->_last_response ) );
+        }
+
+        /**
+         * Fetch the test text (gzencode)
+         */
+        public function test_gzencode() {
+
+                if ( !function_exists('gzencode') ) {
+                        $this->markTestSkipped( 'gzencode function not available' );
+                }
+                
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Ensure we found the right match
+                $this->assertContains( 'wpCompressionTest', $this->_gzdecode( $this->_last_response ) );
+        }
+        
+        /**
+         * Fetch the test text (unknown encoding)
+         */
+        public function test_unknown_encoding() {
+                
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['test'] = 2;
+                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'wp-compression-test' );
+        }
+
+        /**
+         * Set the 'can_compress_scripts' site option to true
+         */
+        public function test_set_yes() {
+                
+                // Become an administrator
+                $this->_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->_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        unset( $e );
+                }
+                
+                // Check the site option
+                $this->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->_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->_handleAjax( 'wp-compression-test' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        unset( $e );
+                }
+                
+                // Check the site option
+                $this->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>+<?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->factory->post->create();
+                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
+                $this->_comments = array_map( 'get_comment', $this->_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->_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->_clear_post_action();
+                
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+                $_POST[$action] = 1;
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+                
+                // Make the request
+                try {
+                        $this->_handleAjax( 'delete-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+                
+                // Ensure everything is correct
+                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
+                $this->assertEquals( 'delete-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+                $this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+                $this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->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->total_comments;
+
+                // Check for either possible total
+                $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'subscriber' );
+
+                // Set up the $_POST request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+                $_POST[$action] = 1;
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST[$action] = 1;
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_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->_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->_handleAjax( 'delete-comment' );
+                        $this->fail( 'Expected exception: WPAjaxDieStopException' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        $this->assertEquals( 10, strlen( $e->getMessage() ) );
+                        $this->assertTrue( is_numeric( $e->getMessage() ) );
+                } catch ( Exception $e ) {
+                        $this->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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+                $_POST[$action] = 1;
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'delete-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                $this->_last_response = '';
+
+                // Force delete the comment
+                if ( 'delete' == $action ) {
+                        wp_delete_comment( $comment->comment_ID, true );
+                }
+
+                // Make the request again, look for a timestamp in the exception
+                try {
+                        $this->_handleAjax( 'delete-comment' );                        
+                        $this->fail( 'Expected exception: WPAjaxDieStopException' );
+                } catch ( WPAjaxDieStopException $e ) {
+                        $this->assertEquals( 10, strlen( $e->getMessage() ) );
+                        $this->assertTrue( is_numeric( $e->getMessage() ) );
+                } catch ( Exception $e ) {
+                        $this->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->_comments );
+                $this->_test_as_admin( $comment, 'trash' );
+                $this->_test_as_admin( $comment, 'untrash' );
+
+                // Test spam/unspam
+                $comment = array_pop( $this->_comments );
+                $this->_test_as_admin( $comment, 'spam' );
+                $this->_test_as_admin( $comment, 'unspam' );
+
+                // Test delete
+                $comment = array_pop( $this->_comments );
+                $this->_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->_comments );
+                $this->_test_as_subscriber( $comment, 'trash' );
+                $this->_test_as_subscriber( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this->_comments );
+                $this->_test_as_subscriber( $comment, 'spam' );
+                $this->_test_as_subscriber( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this->_comments );
+                $this->_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->_comments );
+                $this->_test_as_admin( $comment, 'trash' );
+                $this->_test_as_admin( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this->_comments );
+                $this->_test_as_admin( $comment, 'spam' );
+                $this->_test_as_admin( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this->_comments );
+                $this->_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->_comments );
+                $this->_test_with_bad_nonce( $comment, 'trash' );
+                $this->_test_with_bad_nonce( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this->_comments );
+                $this->_test_with_bad_nonce( $comment, 'spam' );
+                $this->_test_with_bad_nonce( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this->_comments );
+                $this->_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->_comments );
+                $this->_test_double_action( $comment, 'trash' );
+                $this->_test_double_action( $comment, 'untrash' );
+                
+                // Test spam/unspam
+                $comment = array_pop( $this->_comments );
+                $this->_test_double_action( $comment, 'spam' );
+                $this->_test_double_action( $comment, 'unspam' );
+                
+                // Test delete
+                $comment = array_pop( $this->_comments );
+                $this->_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>+<?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->factory->post->create();
+                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
+                $this->_comments = array_map( 'get_comment', $this->_comments );
+        }
+
+        /**
+         * Clear the POST actions in between requests
+         */
+        protected function _clear_post_action() {
+                unset($_POST['id']);
+                unset($_POST['new']);
+                $this->_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->_clear_post_action();
+                
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
+                $_POST['_total'] = count( $this->_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->comment_ID );
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'dim-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Ensure everything is correct
+                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
+                $this->assertEquals( 'dim-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+                $this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+                $this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+
+                // Check the status
+                $current = wp_get_comment_status( $comment->comment_ID );
+                if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
+                        $this->assertEquals( 'approved', $current );
+                } else {
+                        $this->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->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->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'subscriber' );
+
+                // Set up the $_POST request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id'] = $comment->comment_ID;
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST['_total'] = count( $this->_comments );
+                $_POST['_per_page'] = 100;
+                $_POST['_page'] = 1;
+                $_POST['_url'] = admin_url( 'edit-comments.php' );
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_clear_post_action();
+                
+                // Become a subscriber                
+                $this->_setRole( 'administrator' );
+
+                // Set up the $_POST request
+                $_POST['id'] = 12346789;
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'dim-comment_12346789' );
+                $_POST['_total'] = count( $this->_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->_handleAjax( 'dim-comment' );
+                        $this->fail( 'Expected exception: WPAjaxDieContinueException' );
+                } catch ( WPAjaxDieContinueException $e ) {
+
+                        // Get the response
+                        $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                        // Ensure everything is correct
+                        $this->assertEquals( '0', (string) $xml->response[0]->comment['id'] );
+                        $this->assertEquals( 'dim-comment_0', (string) $xml->response['action'] );
+                        $this->assertContains( 'Comment ' . $_POST['id'] . ' does not exist', $this->_last_response );
+
+                } catch ( Exception $e ) {
+                        $this->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->_comments );
+                $this->_test_as_admin( $comment );
+                $this->_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->_comments );
+                $this->_test_as_subscriber( $comment );
+        }
+
+        /**
+         * Dim a comment with no id
+         * @return void
+         */
+        public function test_ajax_dim_comment_no_id() {
+                $comment = array_pop( $this->_comments );
+                $this->_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->_comments );
+                $this->_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>+<?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->factory->post->create();
+                $this->factory->comment->create_post_comments( $post_id, 5 );
+                $this->_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->_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'edit-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this->assertEquals( -1, (string) $xml->response[0]->edit_comment['position'] );
+                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
+                $this->assertEquals( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+                
+                // Check the payload
+                $this->assertNotEmpty( (string) $xml->response[0]->edit_comment[0]->response_data );
+                
+                // And supplemental is empty
+                $this->assertEmpty( (string) $xml->response[0]->edit_comment[0]->supplemental );
+        }
+
+        /**
+         * Get comments as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become an administrator
+                $this->_setRole( 'subscriber' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'edit-comment' );
+        }
+
+        /**
+         * Get comments with a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                        'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+                
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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>+<?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->factory->post->create();
+                $this->factory->comment->create_post_comments( $post_id, 5 );
+                $this->_comment_post = get_post( $post_id );
+
+                $post_id = $this->factory->post->create();
+                $this->_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->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action'] = 'get-comments';
+                $_POST['p'] = $this->_comment_post->ID;
+                
+                // Make the request
+                try {
+                        $this->_handleAjax( 'get-comments' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this->assertEquals( 1, (string) $xml->response[0]->comments['position'] );
+                $this->assertEquals( 0, (string) $xml->response[0]->comments['id'] );
+                $this->assertEquals( 'get-comments_0', (string) $xml->response['action'] );
+                
+                // Check the payload
+                $this->assertNotEmpty( (string) $xml->response[0]->comments[0]->response_data );
+                
+                // And supplemental is empty
+                $this->assertEmpty( (string) $xml->response[0]->comments[0]->supplemental );
+        }
+
+        /**
+         * Get comments as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become a subscriber                
+                $this->_setRole( 'subscriber' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action'] = 'get-comments';
+                $_POST['p'] = $this->_comment_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'get-comments' );
+        }
+
+        /**
+         * Get comments with a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+                $_POST['action'] = 'get-comments';
+                $_POST['p'] = $this->_comment_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+                $_POST['action'] = 'get-comments';
+                $_POST['p'] = $this->_no_comment_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '1' );
+                $this->_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>+<?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->factory->post->create();
+                $this->factory->comment->create_post_comments( $post_id, 5 );
+                $this->_comment_post = get_post( $post_id );
+
+                $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
+                $this->_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->_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                 'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID'] = $this->_comment_post->ID;
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'replyto-comment' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+
+                // Get the response
+                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+                // Check the meta data
+                $this->assertEquals( -1, (string) $xml->response[0]->comment['position'] );
+                $this->assertGreaterThan( 0, (int) $xml->response[0]->comment['id'] );
+                $this->assertNotEmpty( (string) $xml->response['action'] );
+
+                // Check the payload
+                $this->assertNotEmpty( (string) $xml->response[0]->comment[0]->response_data );
+
+                // And supplemental is empty
+                $this->assertEmpty( (string) $xml->response[0]->comment[0]->supplemental );
+        }
+
+        /**
+         * Reply as a non-privileged user (subscriber)
+         * Expects test to fail
+         * @return void
+         */
+        public function test_as_subscriber() {
+
+                // Become an administrator
+                $this->_setRole( 'subscriber' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID'] = $this->_comment_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'replyto-comment' );
+        }
+
+        /**
+         * Reply using a bad nonce
+         * Expects test to fail
+         * @return void
+         */
+        public function test_bad_nonce() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Get a comment
+                $comments = get_comments( array(
+                 'post_id' => $this->_comment_post->ID
+                ) );
+                $comment = array_pop( $comments );
+
+                // Set up a default request
+                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+                $_POST['comment_ID'] = $comment->comment_ID;
+                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+                $_POST['comment_post_ID'] = $this->_comment_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'replyto-comment' );
+        }
+
+        /**
+         * Reply to an invalid post
+         * Expects test to fail
+         * @return void
+         */
+        public function test_invalid_post() {
+
+                // Become an administrator
+                $this->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'replyto-comment' );
+        }
+        
+        /**
+         * Reply to a draft post
+         * Expects test to fail
+         * @return void
+         */
+        public function test_with_draft_post() {
+
+                // Become an administrator
+                $this->_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->_draft_post->ID;
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
+                $this->_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->_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->_comment_post->ID;
+
+                // Block comments from being saved, simulate a DB error
+                add_filter( 'query', array( $this, '_block_comments' ) );
+
+                // Make the request
+                try {
+                        $wpdb->suppress_errors( true );
+                        $this->_handleAjax( 'replyto-comment' );
+                        $wpdb->suppress_errors( false );
+                        $this->fail();
+                } catch ( WPAjaxDieStopException $e ) {
+                        $wpdb->suppress_errors( false );
+                        $this->assertContains( '1', $e->getMessage() );
+                }
+        }
+        
+        /**
+         * Block comments from being saved
+         * @param string $sql
+         * @return string
+         */
+        public function _block_comments( $sql ) {
+                global $wpdb;
+                if ( false !== strpos( $sql, $wpdb->comments ) && 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>+<?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->_terms as $term )
+                        wp_insert_term( $term, 'post_tag' );
+        }
+
+        /**
+         * Test as an admin
+         */
+        public function test_post_tag() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q'] = 'chat';
+
+                // Make the request
+                try {
+                        $this->_handleAjax( 'ajax-tag-search' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Ensure we found the right match
+                $this->assertEquals( $this->_last_response, 'chattels' );
+        }
+
+        /**
+         * Test with no results
+         */
+        public function test_no_results() {
+
+                // Become an administrator
+                $this->_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->setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this->_handleAjax( 'ajax-tag-search' );
+        }
+
+        /**
+         * Test with commas
+         */
+        public function test_with_comma() {
+
+                // Become an administrator
+                $this->_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->_handleAjax( 'ajax-tag-search' );
+                } catch ( WPAjaxDieContinueException $e ) {
+                        unset( $e );
+                }
+                
+                // Ensure we found the right match
+                $this->assertEquals( $this->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_handleAjax( 'ajax-tag-search' );                
+        }
+
+        /**
+         * Test with an invalid taxonomy type
+         */
+        public function test_invalid_tax() {
+
+                // Become an administrator
+                $this->_setRole( 'administrator' );
+
+                // Set up a default request
+                $_GET['tax'] = 'invalid-taxonomy';
+                $_GET['q'] = 'chat';
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '0' );
+                $this->_handleAjax( 'ajax-tag-search' );                
+        }
+        
+        /**
+         * Test as an unprivileged user
+         */
+        public function test_unprivileged_user() {
+
+                // Become an administrator
+                $this->_setRole( 'subscriber' );
+
+                // Set up a default request
+                $_GET['tax'] = 'post_tag';
+                $_GET['q'] = 'chat';
+
+                // Make the request
+                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+                $this->_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>-<?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->logout();
-
-                // Set up a default request
-                $_GET['test'] = 1;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this->_handleAjax( 'wp-compression-test' );
-        }
-        
-        /**
-         * Fetch the test text
-         */
-        public function test_text() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 1;
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this->assertContains( 'wpCompressionTest', $this->_last_response );
-        }
-
-        /**
-         * Fetch the test text (gzdeflate)
-         */
-        public function test_gzdeflate() {
-
-                if ( !function_exists( 'gzdeflate' ) ) {
-                        $this->markTestSkipped( 'gzdeflate function not available' );
-                }
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this->assertContains( 'wpCompressionTest', gzinflate( $this->_last_response ) );
-        }
-
-        /**
-         * Fetch the test text (gzencode)
-         */
-        public function test_gzencode() {
-
-                if ( !function_exists('gzencode') ) {
-                        $this->markTestSkipped( 'gzencode function not available' );
-                }
-                
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Ensure we found the right match
-                $this->assertContains( 'wpCompressionTest', $this->_gzdecode( $this->_last_response ) );
-        }
-        
-        /**
-         * Fetch the test text (unknown encoding)
-         */
-        public function test_unknown_encoding() {
-                
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['test'] = 2;
-                $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'wp-compression-test' );
-        }
-
-        /**
-         * Set the 'can_compress_scripts' site option to true
-         */
-        public function test_set_yes() {
-                
-                // Become an administrator
-                $this->_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->_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        unset( $e );
-                }
-                
-                // Check the site option
-                $this->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->_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->_handleAjax( 'wp-compression-test' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        unset( $e );
-                }
-                
-                // Check the site option
-                $this->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>-<?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->factory->post->create();
-                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
-                $this->_comments = array_map( 'get_comment', $this->_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->_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->_clear_post_action();
-                
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
-                $_POST[$action] = 1;
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-                
-                // Make the request
-                try {
-                        $this->_handleAjax( 'delete-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-                
-                // Ensure everything is correct
-                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
-                $this->assertEquals( 'delete-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
-                $this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
-                $this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->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->total_comments;
-
-                // Check for either possible total
-                $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'subscriber' );
-
-                // Set up the $_POST request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
-                $_POST[$action] = 1;
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST[$action] = 1;
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_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->_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->_handleAjax( 'delete-comment' );
-                        $this->fail( 'Expected exception: WPAjaxDieStopException' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        $this->assertEquals( 10, strlen( $e->getMessage() ) );
-                        $this->assertTrue( is_numeric( $e->getMessage() ) );
-                } catch ( Exception $e ) {
-                        $this->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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
-                $_POST[$action] = 1;
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'delete-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                $this->_last_response = '';
-
-                // Force delete the comment
-                if ( 'delete' == $action ) {
-                        wp_delete_comment( $comment->comment_ID, true );
-                }
-
-                // Make the request again, look for a timestamp in the exception
-                try {
-                        $this->_handleAjax( 'delete-comment' );                        
-                        $this->fail( 'Expected exception: WPAjaxDieStopException' );
-                } catch ( WPAjaxDieStopException $e ) {
-                        $this->assertEquals( 10, strlen( $e->getMessage() ) );
-                        $this->assertTrue( is_numeric( $e->getMessage() ) );
-                } catch ( Exception $e ) {
-                        $this->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->_comments );
-                $this->_test_as_admin( $comment, 'trash' );
-                $this->_test_as_admin( $comment, 'untrash' );
-
-                // Test spam/unspam
-                $comment = array_pop( $this->_comments );
-                $this->_test_as_admin( $comment, 'spam' );
-                $this->_test_as_admin( $comment, 'unspam' );
-
-                // Test delete
-                $comment = array_pop( $this->_comments );
-                $this->_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->_comments );
-                $this->_test_as_subscriber( $comment, 'trash' );
-                $this->_test_as_subscriber( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this->_comments );
-                $this->_test_as_subscriber( $comment, 'spam' );
-                $this->_test_as_subscriber( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this->_comments );
-                $this->_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->_comments );
-                $this->_test_as_admin( $comment, 'trash' );
-                $this->_test_as_admin( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this->_comments );
-                $this->_test_as_admin( $comment, 'spam' );
-                $this->_test_as_admin( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this->_comments );
-                $this->_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->_comments );
-                $this->_test_with_bad_nonce( $comment, 'trash' );
-                $this->_test_with_bad_nonce( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this->_comments );
-                $this->_test_with_bad_nonce( $comment, 'spam' );
-                $this->_test_with_bad_nonce( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this->_comments );
-                $this->_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->_comments );
-                $this->_test_double_action( $comment, 'trash' );
-                $this->_test_double_action( $comment, 'untrash' );
-                
-                // Test spam/unspam
-                $comment = array_pop( $this->_comments );
-                $this->_test_double_action( $comment, 'spam' );
-                $this->_test_double_action( $comment, 'unspam' );
-                
-                // Test delete
-                $comment = array_pop( $this->_comments );
-                $this->_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>-<?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->factory->post->create();
-                $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
-                $this->_comments = array_map( 'get_comment', $this->_comments );
-        }
-
-        /**
-         * Clear the POST actions in between requests
-         */
-        protected function _clear_post_action() {
-                unset($_POST['id']);
-                unset($_POST['new']);
-                $this->_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->_clear_post_action();
-                
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
-                $_POST['_total'] = count( $this->_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->comment_ID );
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'dim-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
-                $this->assertEquals( 'dim-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
-                $this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
-                $this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
-
-                // Check the status
-                $current = wp_get_comment_status( $comment->comment_ID );
-                if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
-                        $this->assertEquals( 'approved', $current );
-                } else {
-                        $this->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->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->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'subscriber' );
-
-                // Set up the $_POST request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id'] = $comment->comment_ID;
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST['_total'] = count( $this->_comments );
-                $_POST['_per_page'] = 100;
-                $_POST['_page'] = 1;
-                $_POST['_url'] = admin_url( 'edit-comments.php' );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_clear_post_action();
-                
-                // Become a subscriber                
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST['id'] = 12346789;
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'dim-comment_12346789' );
-                $_POST['_total'] = count( $this->_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->_handleAjax( 'dim-comment' );
-                        $this->fail( 'Expected exception: WPAjaxDieContinueException' );
-                } catch ( WPAjaxDieContinueException $e ) {
-
-                        // Get the response
-                        $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                        // Ensure everything is correct
-                        $this->assertEquals( '0', (string) $xml->response[0]->comment['id'] );
-                        $this->assertEquals( 'dim-comment_0', (string) $xml->response['action'] );
-                        $this->assertContains( 'Comment ' . $_POST['id'] . ' does not exist', $this->_last_response );
-
-                } catch ( Exception $e ) {
-                        $this->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->_comments );
-                $this->_test_as_admin( $comment );
-                $this->_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->_comments );
-                $this->_test_as_subscriber( $comment );
-        }
-
-        /**
-         * Dim a comment with no id
-         * @return void
-         */
-        public function test_ajax_dim_comment_no_id() {
-                $comment = array_pop( $this->_comments );
-                $this->_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->_comments );
-                $this->_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>-<?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->factory->post->create();
-                $this->factory->comment->create_post_comments( $post_id, 5 );
-                $this->_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->_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'edit-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this->assertEquals( -1, (string) $xml->response[0]->edit_comment['position'] );
-                $this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
-                $this->assertEquals( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
-                
-                // Check the payload
-                $this->assertNotEmpty( (string) $xml->response[0]->edit_comment[0]->response_data );
-                
-                // And supplemental is empty
-                $this->assertEmpty( (string) $xml->response[0]->edit_comment[0]->supplemental );
-        }
-
-        /**
-         * Get comments as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become an administrator
-                $this->_setRole( 'subscriber' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'edit-comment' );
-        }
-
-        /**
-         * Get comments with a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                        'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-                
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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>-<?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->factory->post->create();
-                $this->factory->comment->create_post_comments( $post_id, 5 );
-                $this->_comment_post = get_post( $post_id );
-
-                $post_id = $this->factory->post->create();
-                $this->_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->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action'] = 'get-comments';
-                $_POST['p'] = $this->_comment_post->ID;
-                
-                // Make the request
-                try {
-                        $this->_handleAjax( 'get-comments' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this->assertEquals( 1, (string) $xml->response[0]->comments['position'] );
-                $this->assertEquals( 0, (string) $xml->response[0]->comments['id'] );
-                $this->assertEquals( 'get-comments_0', (string) $xml->response['action'] );
-                
-                // Check the payload
-                $this->assertNotEmpty( (string) $xml->response[0]->comments[0]->response_data );
-                
-                // And supplemental is empty
-                $this->assertEmpty( (string) $xml->response[0]->comments[0]->supplemental );
-        }
-
-        /**
-         * Get comments as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become a subscriber                
-                $this->_setRole( 'subscriber' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action'] = 'get-comments';
-                $_POST['p'] = $this->_comment_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'get-comments' );
-        }
-
-        /**
-         * Get comments with a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
-                $_POST['action'] = 'get-comments';
-                $_POST['p'] = $this->_comment_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
-                $_POST['action'] = 'get-comments';
-                $_POST['p'] = $this->_no_comment_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '1' );
-                $this->_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>-<?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->factory->post->create();
-                $this->factory->comment->create_post_comments( $post_id, 5 );
-                $this->_comment_post = get_post( $post_id );
-
-                $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
-                $this->_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->_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                 'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID'] = $this->_comment_post->ID;
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'replyto-comment' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Check the meta data
-                $this->assertEquals( -1, (string) $xml->response[0]->comment['position'] );
-                $this->assertGreaterThan( 0, (int) $xml->response[0]->comment['id'] );
-                $this->assertNotEmpty( (string) $xml->response['action'] );
-
-                // Check the payload
-                $this->assertNotEmpty( (string) $xml->response[0]->comment[0]->response_data );
-
-                // And supplemental is empty
-                $this->assertEmpty( (string) $xml->response[0]->comment[0]->supplemental );
-        }
-
-        /**
-         * Reply as a non-privileged user (subscriber)
-         * Expects test to fail
-         * @return void
-         */
-        public function test_as_subscriber() {
-
-                // Become an administrator
-                $this->_setRole( 'subscriber' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID'] = $this->_comment_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'replyto-comment' );
-        }
-
-        /**
-         * Reply using a bad nonce
-         * Expects test to fail
-         * @return void
-         */
-        public function test_bad_nonce() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Get a comment
-                $comments = get_comments( array(
-                 'post_id' => $this->_comment_post->ID
-                ) );
-                $comment = array_pop( $comments );
-
-                // Set up a default request
-                $_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
-                $_POST['comment_ID'] = $comment->comment_ID;
-                $_POST['content'] = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
-                $_POST['comment_post_ID'] = $this->_comment_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'replyto-comment' );
-        }
-
-        /**
-         * Reply to an invalid post
-         * Expects test to fail
-         * @return void
-         */
-        public function test_invalid_post() {
-
-                // Become an administrator
-                $this->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'replyto-comment' );
-        }
-        
-        /**
-         * Reply to a draft post
-         * Expects test to fail
-         * @return void
-         */
-        public function test_with_draft_post() {
-
-                // Become an administrator
-                $this->_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->_draft_post->ID;
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
-                $this->_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->_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->_comment_post->ID;
-
-                // Block comments from being saved, simulate a DB error
-                add_filter( 'query', array( $this, '_block_comments' ) );
-
-                // Make the request
-                try {
-                        $wpdb->suppress_errors( true );
-                        $this->_handleAjax( 'replyto-comment' );
-                        $wpdb->suppress_errors( false );
-                        $this->fail();
-                } catch ( WPAjaxDieStopException $e ) {
-                        $wpdb->suppress_errors( false );
-                        $this->assertContains( '1', $e->getMessage() );
-                }
-        }
-        
-        /**
-         * Block comments from being saved
-         * @param string $sql
-         * @return string
-         */
-        public function _block_comments( $sql ) {
-                global $wpdb;
-                if ( false !== strpos( $sql, $wpdb->comments ) && 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>-<?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->factory->post->create( array( 'post_status' => 'draft' ) );
-                $this->_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' => 1,
-                 'autosave' => 1
-                );
-                
-                // Make the request
-                try {
-                        $this->_handleAjax( 'nopriv_autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this->assertEquals( 1, (string) $xml->response[0]->autosave['id'] );
-                $this->assertEquals( 'nopriv_autosave_1', (string) $xml->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' => 1
-                );
-                
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'nopriv_autosave' );
-        }
-        
-        /**
-         * Test autosaving a post
-         * @return void
-         */
-        public function test_autosave_post() {
-
-                // Become an admin
-                $this->_setRole( 'administrator' );
-                        
-                // Set up the $_POST request
-                $md5 = md5( uniqid() );
-                $_POST = array(
-                 'post_ID' => $this->_post->ID,
-                 'autosavenonce' => wp_create_nonce( 'autosave' ),
-                 'post_content' => $this->_post->post_content . PHP_EOL . $md5,
-                 'autosave' => 1
-                );
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this->assertEquals( $this->_post->ID, (int) $xml->response[0]->autosave['id'] );
-                $this->assertEquals( 'autosave_' . $this->_post->ID, (string) $xml->response['action']);
-                
-                // Check that the edit happened
-                $post = get_post( $this->_post->ID) ;
-                $this->assertGreaterThanOrEqual( 0, strpos( $post->post_content, $md5 ) );
-        }
-
-        /**
-         * Test with an invalid nonce
-         * @return void
-         */
-        public function test_with_invalid_nonce( ) {
-                
-                // Become an administrator                
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST = array(
-                 'post_ID' => $this->_post->ID,
-                 'autosavenonce' => md5( uniqid() ),
-                 'autosave' => 1
-                );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'autosave' );
-        }
-        
-        /**
-         * Test with a bad post id
-         * @return void
-         */
-        public function test_with_invalid_post_id( ) {
-                
-                // Become an administrator        
-                $this->_setRole( 'administrator' );
-
-                // Set up the $_POST request
-                $_POST = array(
-                 'post_ID' => 0,
-                 'autosavenonce' => wp_create_nonce( 'autosave' ),
-                 'autosave' => 1
-                );
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', 'You are not allowed to edit this post.' );
-                $this->_handleAjax( 'autosave' );
-        }
-        
-        /**
-         * Test with a locked post
-         * @return void
-         */
-        public function test_locked_post() {
-
-                // Become an administrator                
-                $this->_setRole( 'administrator' );
-                
-                // Lock the post
-                wp_set_post_lock( $this->_post->ID );
-                
-                // Become a different administrator
-                $this->_setRole( 'administrator' );
-        
-                // Set up the $_POST request
-                $_POST = array(
-                 'post_ID' => $this->_post->ID,
-                 'autosavenonce' => wp_create_nonce( 'autosave' ),
-                 'autosave' => 1
-                );
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Get the response
-                $xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
-
-                // Ensure everything is correct
-                $this->assertEquals( $this->_post->ID, (int) $xml->response[0]->autosave['id'] );
-                $this->assertEquals( 'autosave_' . $this->_post->ID, (string) $xml->response['action']);
-                $this->assertEquals( 'disable', (string) $xml->response[0]->autosave[0]->supplemental[0]->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->_setRole( 'administrator' );
-                        
-                // Set up the $_POST request
-                $_POST = array(
-                 'post_ID' => $this->_post->ID,
-                 'autosavenonce' => wp_create_nonce( 'autosave' ),
-                 'autosave' => 1
-                );
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'autosave' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-
-                // Look for the warning
-                $this->assertRegExp( '/Your login has expired. Please open a new browser window/' , $this->_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>-<?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->_terms as $term )
-                        wp_insert_term( $term, 'post_tag' );
-        }
-
-        /**
-         * Test as an admin
-         */
-        public function test_post_tag() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q'] = 'chat';
-
-                // Make the request
-                try {
-                        $this->_handleAjax( 'ajax-tag-search' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Ensure we found the right match
-                $this->assertEquals( $this->_last_response, 'chattels' );
-        }
-
-        /**
-         * Test with no results
-         */
-        public function test_no_results() {
-
-                // Become an administrator
-                $this->_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->setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this->_handleAjax( 'ajax-tag-search' );
-        }
-
-        /**
-         * Test with commas
-         */
-        public function test_with_comma() {
-
-                // Become an administrator
-                $this->_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->_handleAjax( 'ajax-tag-search' );
-                } catch ( WPAjaxDieContinueException $e ) {
-                        unset( $e );
-                }
-                
-                // Ensure we found the right match
-                $this->assertEquals( $this->_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->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_handleAjax( 'ajax-tag-search' );                
-        }
-
-        /**
-         * Test with an invalid taxonomy type
-         */
-        public function test_invalid_tax() {
-
-                // Become an administrator
-                $this->_setRole( 'administrator' );
-
-                // Set up a default request
-                $_GET['tax'] = 'invalid-taxonomy';
-                $_GET['q'] = 'chat';
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '0' );
-                $this->_handleAjax( 'ajax-tag-search' );                
-        }
-        
-        /**
-         * Test as an unprivileged user
-         */
-        public function test_unprivileged_user() {
-
-                // Become an administrator
-                $this->_setRole( 'subscriber' );
-
-                // Set up a default request
-                $_GET['tax'] = 'post_tag';
-                $_GET['q'] = 'chat';
-
-                // Make the request
-                $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
-                $this->_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>+<?php
+
+/**
+ * just make sure the test framework is working
+ *
+ * @group testsuite
+ */
+class Tests_Basic extends WP_UnitTestCase {
+        var $val;
+
+        function setUp() {
+                parent::setUp();
+                $this->val = true;
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $this->val = false;
+        }
+
+        function test_true() {
+                $this->assertTrue($this->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->assertEquals($test_foo, array(0=>'foo', 2=>'baz'));
+                $this->assertEquals($test_foo, $GLOBALS['test_foo']);
+        }
+
+        function test_globals_bar() {
+                global $test_bar;
+                $test_bar = array('a', 'b', 'c');
+                $this->assertEquals($test_bar, $GLOBALS['test_bar']);
+        }
+
+        // test some helper utility functions
+
+        function test_strip_ws() {
+                $this->assertEquals('', strip_ws(''));
+                $this->assertEquals('foo', strip_ws('foo'));
+                $this->assertEquals('', strip_ws("\r\n\t \n\r\t"));
+
+                $in = "asdf\n";
+                $in .= "asdf asdf\n";
+                $in .= "asdf asdf\n";
+                $in .= "\tasdf\n";
+                $in .= "\tasdf\t\n";
+                $in .= "\t\tasdf\n";
+                $in .= "foo bar\n\r\n";
+                $in .= "foo\n";
+
+                $expected = "asdf\n";
+                $expected .= "asdf asdf\n";
+                $expected .= "asdf asdf\n";
+                $expected .= "asdf\n";
+                $expected .= "asdf\n";
+                $expected .= "asdf\n";
+                $expected .= "foo bar\n";
+                $expected .= "foo";
+
+                $this->assertEquals($expected, strip_ws($in));
+
+        }
+
+        function test_mask_input_value() {
+                $in = <<<EOF
+<h2>Assign Authors</h2>
+<p>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 <code>admin</code>s entries.</p>
+<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
+ <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="855ae98911" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
+EOF;
+                // _wpnonce value should be replaced with 'xxx'
+                $expected = <<<EOF
+<h2>Assign Authors</h2>
+<p>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 <code>admin</code>s entries.</p>
+<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
+ <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="***" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
+EOF;
+                $this->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>+<?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->cache =& $this->init_cache();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $this->flush_cache();
+        }
+
+        function &init_cache() {
+                $cache = new WP_Object_Cache();
+                return $cache;
+        }
+
+        function test_miss() {
+                $this->assertEquals(NULL, $this->cache->get(rand_str()));
+        }
+
+        function test_add_get() {
+                $key = rand_str();
+                $val = rand_str();
+
+                $this->cache->add($key, $val);
+                $this->assertEquals($val, $this->cache->get($key));
+        }
+
+        function test_add_get_0() {
+                $key = rand_str();
+                $val = 0;
+
+                // you can store zero in the cache
+                $this->cache->add($key, $val);
+                $this->assertEquals($val, $this->cache->get($key));
+        }
+
+        function test_add_get_null() {
+                $key = rand_str();
+                $val = null;
+
+                $this->assertTrue( $this->cache->add($key, $val) );
+                // null is converted to empty string
+                $this->assertEquals( '', $this->cache->get($key) );
+        }
+
+        function test_add() {
+                $key = rand_str();
+                $val1 = rand_str();
+                $val2 = rand_str();
+
+                // add $key to the cache
+                $this->assertTrue($this->cache->add($key, $val1));
+                $this->assertEquals($val1, $this->cache->get($key));
+                // $key is in the cache, so reject new calls to add()
+                $this->assertFalse($this->cache->add($key, $val2));
+                $this->assertEquals($val1, $this->cache->get($key));
+        }
+
+        function test_replace() {
+                $key = rand_str();
+                $val = rand_str();
+
+                // memcached rejects replace() if the key does not exist
+                $this->assertFalse($this->cache->replace($key, $val));
+                $this->assertFalse($this->cache->get($key));
+        }
+
+        function test_set() {
+                $key = rand_str();
+                $val = rand_str();
+
+                // memcached accepts set() if the key does not exist
+                $this->assertTrue($this->cache->set($key, $val));
+                $this->assertEquals($val, $this->cache->get($key));
+        }
+
+        function test_flush() {
+                $key = rand_str();
+                $val = rand_str();
+
+                $this->cache->add($key, $val);
+                // item is visible to both cache objects
+                $this->assertEquals($val, $this->cache->get($key));
+                $this->cache->flush();
+                // If there is no value get returns false.
+                $this->assertFalse($this->cache->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->foo = 'alpha';
+                $this->cache->set( $key, $object_a );
+                $object_a->foo = 'bravo';
+                $object_b = $this->cache->get( $key );
+                $this->assertEquals( 'alpha', $object_b->foo );
+                $object_b->foo = 'charlie';
+                $this->assertEquals( 'bravo', $object_a->foo );
+
+                $key = rand_str();
+                $object_a = new stdClass;
+                $object_a->foo = 'alpha';
+                $this->cache->add( $key, $object_a );
+                $object_a->foo = 'bravo';
+                $object_b = $this->cache->get( $key );
+                $this->assertEquals( 'alpha', $object_b->foo );
+                $object_b->foo = 'charlie';
+                $this->assertEquals( 'bravo', $object_a->foo );
+        }
+
+        function test_incr() {
+                $key = rand_str();
+
+                $this->assertFalse( $this->cache->incr( $key ) );
+
+                $this->cache->set( $key, 0 );
+                $this->cache->incr( $key );
+                $this->assertEquals( 1, $this->cache->get( $key ) );
+
+                $this->cache->incr( $key, 2 );
+                $this->assertEquals( 3, $this->cache->get( $key ) );
+        }
+
+        function test_decr() {
+                $key = rand_str();
+
+                $this->assertFalse( $this->cache->decr( $key ) );
+
+                $this->cache->set( $key, 0 );
+                $this->cache->decr( $key );
+                $this->assertEquals( 0, $this->cache->get( $key ) );
+
+                $this->cache->set( $key, 3 );
+                $this->cache->decr( $key );
+                $this->assertEquals( 2, $this->cache->get( $key ) );
+
+                $this->cache->decr( $key, 2 );
+                $this->assertEquals( 0, $this->cache->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>+<?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->add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule
+                $wp_rewrite->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' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
+                        array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
+                        array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' => '/ccr/uncategorized/sort/desc/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc', 'year' => '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>+<?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&p=1', '/?p=1' ),
+
+                        // Strip an existing but incorrect post_type arg
+                        array( '/?post_type=page&page_id=1', '/?p=1' ),
+
+                        array( '/?p=358 ', array('url' => '/?p=358', 'qv' => array('p' => '358') ) ), // Trailing spaces
+                        array( '/?p=358%20', array('url' => '/?p=358', 'qv' => array('p' => '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&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>+<?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->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
+                update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
+                $wp_rewrite->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>+<?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->structure );
+                create_initial_taxonomies();
+                $GLOBALS['wp_rewrite']->init();
+                flush_rewrite_rules();
+
+                $this->old_current_user = get_current_user_id();
+                $this->author_id = $this->factory->user->create( array( 'user_login' => 'canonical-author' ) );
+                wp_set_current_user( $this->author_id );
+
+                // Already created by install defaults:
+                // $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
+
+                $this->term_ids = array();
+
+                $this->factory->post->create( array( 'import_id' => 587, 'post_title' => 'post-format-test-audio', 'post_date' => '2008-06-02 00:00:00' ) );
+                $post_id = $this->factory->post->create( array( 'post_title' => 'post-format-test-gallery', 'post_date' => '2008-06-10 00:00:00' ) );
+                $this->factory->post->create( array( 'import_id' => 611, 'post_type' => 'attachment', 'post_title' => 'canola2', 'post_parent' => $post_id ) );
+
+                $this->factory->post->create( array(
+                        'post_title' => 'images-test',
+                        'post_date' => '2008-09-03 00:00:00',
+                        'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3'
+                ) );
+
+                $post_id = $this->factory->post->create( array( 'import_id' => 149, 'post_title' => 'comment-test', 'post_date' => '2008-03-03 00:00:00' ) );
+                $this->factory->comment->create_post_comments( $post_id, 15 );
+
+                $this->factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );
+
+                $this->factory->post->create( array( 'import_id' => 123 ) );
+                $this->factory->post->create( array( 'import_id' => 1 ) );
+                $this->factory->post->create( array( 'import_id' => 358 ) );
+
+                $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'sample-page' ) );
+                $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
+                $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $this->factory->post->create(
+                        array( 'import_id' => 144, 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id,
+                ) );
+
+                $this->term_ids['/category/parent/'] = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'parent' ) );
+                $this->term_ids['/category/parent/child-1/'] = $this->factory->term->create( array(
+                        'taxonomy' => 'category', 'name' => 'child-1', 'parent' => $this->term_ids['/category/parent/'],
+                ) );
+                $this->term_ids['/category/parent/child-1/child-2/'] = $this->factory->term->create( array(
+                        'taxonomy' => 'category', 'name' => 'child-2', 'parent' => $this->term_ids['/category/parent/child-1/'],
+                ) );
+
+                $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
+                $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
+
+                $this->factory->term->create( array( 'name' => 'post-formats' ) );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                wp_set_current_user( $this->old_current_user );
+
+                $GLOBALS['wp_rewrite']->init();
+        }
+
+        // URL's are relative to the site "front", 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->knownWPBug( $ticket );
+
+                $ticket_ref = ($ticket > 0) ? 'Ticket #' . $ticket : null;
+
+                if ( is_string($expected) )
+                        $expected = array('url' => $expected);
+                elseif ( is_array($expected) && !isset($expected['url']) && !isset($expected['qv']) )
+                        $expected = array( 'qv' => $expected );
+
+                if ( !isset($expected['url']) && !isset($expected['qv']) )
+                        $this->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->author_id );
+                        if ( false !== strpos( $test_url, '?cat=%d' ) )
+                                $test_url = sprintf( $test_url, $this->term_ids[ $expected['url'] ] );
+                }
+
+                $this->go_to( home_url( $test_url ) );
+
+                // Does the redirect match what's expected?
+                $can_url = $this->get_canonical( $test_url );
+                $parsed_can_url = parse_url($can_url);
+
+                // Just test the Path and Query if present
+                if ( isset($expected['url']) )
+                        $this->assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
+
+                if ( ! isset($expected['qv']) )
+                        return;
+
+                // "make" that the request and check the query is correct
+                $this->go_to( $can_url );
+
+                // Are all query vars accounted for, And correct?
+                global $wp;
+
+                $query_vars = array_diff($wp->query_vars, $wp->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->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->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 "proper" 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' => '/category/uncategorized/', 'qv' => array( 'category_name' => 'uncategorized' ) ) ),
+                        array( '/category/uncategorized/page/2/', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
+                        array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
+                        array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
+                        array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
+                        array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
+
+                        // Categories & Intersections with other vars
+                        array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
+                        array( '/?category_name=cat-a,cat-b', array( 'url' => '/?category_name=cat-a,cat-b', 'qv' => array( 'category_name' => '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&year=2008', array( 'url' => '/category/uncategorized/page/2/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2, 'year' => 2008) ), 17661 ),
+//                        array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
+                        array( '/2008/04/?cat=1', array( 'url' => '/category/uncategorized/?year=2008&monthnum=04', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
+//                        array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
+                        array( '/2008/?category_name=cat-a', array( 'url' => '/category/cat-a/?year=2008', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ), 20386 ),
+//                        array( '/category/uncategorized/?year=2008', array( 'url' => '/2008/?category_name=uncategorized', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
+                        array( '/category/uncategorized/?year=2008', array( 'url' => '/category/uncategorized/?year=2008', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
+
+                        // Pages
+                        array( '/sample%20page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 17653 ), // Page rules always set 'page'
+                        array( '/sample------page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 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' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/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&year=2008', '/2008/?author=3'),
+                        array( '/?author=%d&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&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>+<?php
+
+/**
+ * @group compat
+ */
+class Tests_Compat extends WP_UnitTestCase {
+        function test_mb_substr() {
+                $this->assertEquals('баб', _mb_substr('баба', 0, 3));
+                $this->assertEquals('баб', _mb_substr('баба', 0, -1));
+                $this->assertEquals('баб', _mb_substr('баба', 0, -1));
+                $this->assertEquals('I am your б', _mb_substr('I am your баба', 0, 11));
+        }
+
+        function test_hash_hmac_simple() {
+                $this->assertEquals('140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac('md5', 'simple', 'key'));
+                $this->assertEquals('993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac('sha1', 'simple', 'key'));
+        }
+
+        function test_hash_hmac_padding() {
+                $this->assertEquals('3c1399103807cf12ec38228614416a8c', _hash_hmac('md5', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+                $this->assertEquals('4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac('sha1', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+        }
+
+        function test_hash_hmac_output() {
+                $this->assertEquals(array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
+                $this->assertEquals(array( 1 => '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>+<?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->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // it's a non recurring event
+                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this->assertEquals( false, wp_next_scheduled($hook) );
+                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                // it's a non recurring event
+                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
+                // it's a recurring event
+                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                // these don't match so return nothing
+                $this->assertEquals( false, wp_next_scheduled($hook) );
+                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+                // now unschedule it and make sure it's gone
+                wp_unschedule_event( $timestamp, $hook );
+                $this->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->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->assertTrue( wp_next_scheduled($hook) > 0 );
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+                // clear the schedule for the no args events and make sure it's gone
+                wp_clear_scheduled_hook($hook);
+                $this->assertFalse( wp_next_scheduled($hook) );
+                // the args events should still be there
+                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->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->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->assertEquals( $ts2, wp_next_scheduled($hook, $args) );
+                wp_unschedule_event( $ts2, $hook, $args );
+                // following event should be there too
+                $this->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(&$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_single_event( $timestamp, $hook, $args );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+
+                // run cron jobs
+                $this->_do_cron();
+
+                // our action should have been called once with the correct args
+                $this->assertEquals( 1, $a->get_call_count() );
+                $this->assertEquals( array($args), $a->get_args() );
+
+                // it shouldn't appear in the schedule anymore
+                $this->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(&$a, 'action'));
+
+                // schedule an event for 1 second ago
+                wp_schedule_event( $timestamp, $recur, $hook, $args );
+                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+                // run cron jobs
+                $this->_do_cron();
+
+                // our action should have been called once with the correct args
+                $this->assertEquals( 1, $a->get_call_count() );
+                $this->assertEquals( array($args), $a->get_args() );
+
+                // it should appear in the schedule to run again in an hour's time
+                $this->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>+<?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->_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->_queries[] = $sql;
+                return $sql;
+        }
+
+        /**
+         * Test that floats formatted as "0,700" 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->markTestSkipped( 'No European languages available for testing' );
+
+                // Try an update query
+                $wpdb->suppress_errors( true );
+                $wpdb->update(
+                        'test_table',
+                        array( 'float_column' => 0.7 ),
+                        array( 'meta_id' => 5 ),
+                        array( '%f' ),
+                        array( '%d' )
+                );
+                $wpdb->suppress_errors( false );
+
+                // Ensure the float isn't 0,700
+                $this->assertContains( '0.700', array_pop( $this->_queries ) );
+
+                // Try a prepare
+                $sql = $wpdb->prepare( "UPDATE test_table SET float_column = %f AND meta_id = %d", 0.7, 5 );
+                $this->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>+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class TestWP_Scripts extends WP_UnitTestCase {
+        var $old_wp_scripts;
+
+        function setUp() {
+                parent::setUp();
+                $this->old_wp_scripts = $GLOBALS['wp_scripts'];
+                remove_action( 'wp_default_scripts', 'wp_default_scripts' );
+                $GLOBALS['wp_scripts'] = new WP_Scripts();
+                $GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
+
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_scripts'] = $this->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 = "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
+                $expected .= "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
+                $expected .= "<script type='text/javascript' src='http://example.com?ver=1.2'></script>\n";
+                $expected .= "<script type='text/javascript' src='http://example.com'></script>\n";
+
+                $this->assertEquals($expected, get_echo('wp_print_scripts'));
+
+                // No scripts left to print
+                $this->assertEquals("", 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->base_url;
+                $wp_scripts->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 .= "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+                // Try with an HTTPS reference
+                wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected .= "<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+                // Try with an automatic protocol reference (//)
+                wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected .= "<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+                // Try with a local resource and an automatic protocol reference (//)
+                $url = '//my_plugin/script.js';
+                wp_enqueue_script( 'plugin-script', $url );
+                $expected .= "<script type='text/javascript' src='$url?ver=$ver'></script>\n";
+
+                // Try with a bad protocol
+                wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+                $expected .= "<script type='text/javascript' src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+                // Go!
+                $this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
+
+                // No scripts left to print
+                $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
+
+                // Cleanup
+                $wp_scripts->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>+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class TestWP_Styles extends WP_UnitTestCase {
+        var $old_wp_styles;
+
+        function setUp() {
+                parent::setUp();
+                $this->old_wp_styles = $GLOBALS['wp_styles'];
+                remove_action( 'wp_default_styles', 'wp_default_styles' );
+                $GLOBALS['wp_styles'] = new WP_Styles();
+                $GLOBALS['wp_styles']->default_version = get_bloginfo( 'version' );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_styles'] = $this->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 = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' type='text/css' media='all' />\n";
+                $expected .= "<link rel='stylesheet' id='no-deps-version-css' href='http://example.com?ver=1.2' type='text/css' media='all' />\n";
+                $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' href='http://example.com' type='text/css' media='all' />\n";
+                $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' href='http://example.com' type='text/css' media='print' />\n";
+
+                $this->assertEquals($expected, get_echo('wp_print_styles'));
+
+                // No styles left to print
+                $this->assertEquals("", 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->base_url;
+                $wp_styles->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 .= "<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' />\n";
+
+                // Try with an HTTPS reference
+                wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected .= "<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' />\n";
+
+                // Try with an automatic protocol reference (//)
+                wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected .= "<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' />\n";
+
+                // Try with a local resource and an automatic protocol reference (//)
+                $url = '//my_plugin/style.css';
+                wp_enqueue_style( 'plugin-style', $url );
+                $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' type='text/css' media='all' />\n";
+
+                // Try with a bad protocol
+                wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+                $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
+
+                // Go!
+                $this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+                // No styles left to print
+                $this->assertEquals( '', get_echo( 'wp_print_styles' ) );
+
+                // Cleanup
+                $wp_styles->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>+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies extends WP_UnitTestCase {
+        function test_add() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'one' ));
+                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
+
+                //Cannot reuse names
+                $this->assertFalse($dep->add( 'one', '' ));
+        }
+
+        function test_remove() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $dep->remove( 'one' );
+
+                $this->assertFalse($dep->query( 'one'));
+                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
+
+        }
+
+        function test_enqueue() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $dep->enqueue('one');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertFalse($dep->query( 'two', 'queue' ));
+
+                $dep->enqueue('two');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+        }
+
+        function test_dequeue() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $dep->enqueue('one');
+                $dep->enqueue('two');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+
+                $dep->dequeue('one');
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+
+                $dep->dequeue('two');
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $this->assertFalse($dep->query( 'two', 'queue' ));
+        }
+
+        function test_enqueue_args() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $dep->enqueue('one?arg');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertFalse($dep->query( 'two', 'queue' ));
+                $this->assertEquals('arg', $dep->args['one']);
+
+                $dep->enqueue('two?arg');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+                $this->assertEquals('arg', $dep->args['two']);
+        }
+
+        function test_dequeue_args() {
+                // Create a new object
+                $dep = new WP_Dependencies;
+
+                $this->assertTrue($dep->add( 'one', '' ));
+                $this->assertTrue($dep->add( 'two', '' ));
+
+                $dep->enqueue('one?arg');
+                $dep->enqueue('two?arg');
+                $this->assertTrue($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+                $this->assertEquals('arg', $dep->args['one']);
+                $this->assertEquals('arg', $dep->args['two']);
+
+                $dep->dequeue('one');
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $this->assertTrue($dep->query( 'two', 'queue' ));
+                $this->assertFalse(isset($dep->args['one']));
+
+                $dep->dequeue('two');
+                $this->assertFalse($dep->query( 'one', 'queue' ));
+                $this->assertFalse($dep->query( 'two', 'queue' ));
+                $this->assertFalse(isset($dep->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>+<?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->factory->post->create_many( 25 );
+
+                $this->post_count = get_option('posts_per_rss');
+                $this->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->go_to('/feed/');
+                $feed = $this->do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get the rss element
+                $rss = xml_find($xml, 'rss');
+
+                // there should only be one rss element
+                $this->assertEquals(1, count($rss));
+
+                $this->assertEquals('2.0', $rss[0]['attributes']['version']);
+                $this->assertEquals('http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content']);
+                $this->assertEquals('http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw']);
+                $this->assertEquals('http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc']);
+
+                // rss should have exactly one child element (channel)
+                $this->assertEquals(1, count($rss[0]['child']));
+        }
+
+        function test_channel() {
+                $this->go_to('/feed/');
+                $feed = $this->do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get the rss -> channel element
+                $channel = xml_find($xml, 'rss', 'channel');
+
+                $this->assertTrue(empty($channel[0]['attributes']));
+
+                $title = xml_find($xml, 'rss', 'channel', 'title');
+                $this->assertEquals(get_option('blogname'), $title[0]['content']);
+
+                $desc = xml_find($xml, 'rss', 'channel', 'description');
+                $this->assertEquals(get_option('blogdescription'), $desc[0]['content']);
+
+                $link = xml_find($xml, 'rss', 'channel', 'link');
+                $this->assertEquals(get_option('siteurl'), $link[0]['content']);
+
+                $pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
+                $this->assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
+        }
+
+        /**
+         * @ticket UT32
+         */
+        function test_items() {
+                $this->go_to('/feed/');
+                $feed = $this->do_rss2();
+                $xml = xml_to_array($feed);
+
+                // get all the rss -> channel -> item elements
+                $items = xml_find($xml, 'rss', 'channel', 'item');
+                $posts = get_posts('numberposts='.$this->post_count);
+
+                // check each of the items against the known post data
+                for ($i=0; $i < $this->post_count; $i++) {
+
+                        // title
+                        $title = xml_find($items[$i]['child'], 'title');
+                        $this->assertEquals($posts[$i]->post_title, $title[0]['content']);
+
+                        // link
+                        $link = xml_find($items[$i]['child'], 'link');
+                        $this->assertEquals(get_permalink($posts[$i]->ID), $link[0]['content']);
+
+                        // comment link
+                        $comments_link = xml_find($items[$i]['child'], 'comments');
+                        $this->assertEquals(get_permalink($posts[$i]->ID) . '#comments', $comments_link[0]['content']);
+
+                        // pub date
+                        $pubdate = xml_find($items[$i]['child'], 'pubDate');
+                        $this->assertEquals(strtotime($posts[$i]->post_date), strtotime($pubdate[0]['content']));
+
+                        // author
+                        $creator = xml_find($items[$i]['child'], 'dc:creator');
+                        $this->assertEquals($this->author->user_nicename, $creator[0]['content']);
+
+                        // categories (perhaps multiple)
+                        $categories = xml_find($items[$i]['child'], 'category');
+                        $cat_ids = wp_get_post_categories($post->ID);
+                        if (empty($cat_ids))        $cat_ids = array(1);
+                        // should be the same number of categories
+                        $this->assertEquals(count($cat_ids), count($categories));
+                        // ..with the same names
+                        for ($j=0; $j < count($cat_ids); $j++)
+                                $this->assertEquals(get_cat_name($cat_ids[$j]), $categories[$j]['content']);
+
+                        // GUID
+                        $guid = xml_find($items[$i]['child'], 'guid');
+                        $this->assertEquals('false', $guid[0]['attributes']['isPermaLink']);
+                        $this->assertEquals($posts[$i]->guid, $guid[0]['content']);
+
+                        // description/excerpt
+                        $description = xml_find($items[$i]['child'], 'description');
+                        $this->assertEquals(trim($posts[$i]->post_excerpt), trim($description[0]['content']));
+
+                        // post content
+                        if (!$this->excerpt_only) {
+                                $content = xml_find($items[$i]['child'], 'content:encoded');
+                                $this->assertEquals(trim(apply_filters('the_content', $posts[$i]->post_content)), trim($content[0]['content']));
+                        }
+
+                        // comment rss
+                        $comment_rss = xml_find($items[$i]['child'], 'wfw:commentRss');
+                        $this->assertEquals(html_entity_decode(get_post_comments_feed_link($posts[$i]->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>+<?php
+
+class Tests_File extends WP_UnitTestCase {
+
+        function setUp() {
+                $this->dir = dirname(tempnam('/tmp', 'foo'));
+
+                $this->badchars = '"\'[]*&?$';
+        }
+
+        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->dir, rand_str() . '.txt' );
+
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+                unlink($this->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->dir, $name . '.txt' );
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename1) );
+                $filename2 = wp_unique_filename( $this->dir, $name . '.txt' );
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename2) );
+
+                // the two should be different
+                $this->assertNotEquals( $filename1, $filename2 );
+
+                unlink($this->dir . DIRECTORY_SEPARATOR . $filename1);
+                unlink($this->dir . DIRECTORY_SEPARATOR . $filename2);
+        }
+
+        function test_unique_filename_is_sanitized() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' );
+
+                // make sure the bad characters were all stripped out
+                $this->assertEquals( $name . '.txt', $filename );
+
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_with_slashes() {
+                $name = rand_str();
+                // "foo/foo.txt"
+                $filename = wp_unique_filename( $this->dir, $name . '/' . $name . '.txt' );
+
+                // the slash should be removed, i.e. "foofoo.txt"
+                $this->assertEquals( $name . $name . '.txt', $filename );
+
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_multiple_ext() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this->dir, $name . '.php.txt' );
+
+                // "foo.php.txt" becomes "foo.php_.txt"
+                $this->assertEquals( $name . '.php_.txt', $filename );
+
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+        }
+
+        function test_unique_filename_no_ext() {
+                $name = rand_str();
+                $filename = wp_unique_filename( $this->dir, $name );
+
+                $this->assertEquals( $name, $filename );
+
+                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+                unlink($this->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>+<?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(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // only one event occurred for the hook, with empty args
+                $this->assertEquals(1, $a->get_call_count());
+                // only our hook was called
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                $args = array_pop($a->get_args());
+                $this->assertEquals(array($val), $args);
+        }
+
+        function test_remove_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter($tag, array(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter($tag, array(&$a, 'filter'));
+                $this->assertEquals($val, apply_filters($tag, $val));
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+        }
+
+        function test_has_filter() {
+                        $tag = rand_str();
+                        $func = rand_str();
+
+                        $this->assertFalse( has_filter($tag, $func) );
+                        $this->assertFalse( has_filter($tag) );
+                        add_filter($tag, $func);
+                        $this->assertEquals( 10, has_filter($tag, $func) );
+                        $this->assertTrue( has_filter($tag) );
+                        remove_filter($tag, $func);
+                        $this->assertFalse( has_filter($tag, $func) );
+                        $this->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(&$a1, 'filter'));
+                add_filter($tag, array(&$a2, 'filter'));
+
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // both filters called once each
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(1, $a2->get_call_count());
+        }
+
+        function test_filter_args_1() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+                $arg1 = rand_str();
+
+                add_filter($tag, array(&$a, 'filter'), 10, 2);
+                // call the filter with a single argument
+                $this->assertEquals($val, apply_filters($tag, $val, $arg1));
+
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($val, $arg1), array_pop($a->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(&$a1, 'filter'), 10, 3);
+                add_filter($tag, array(&$a2, 'filter'));
+                // call the filter with two arguments
+                $this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
+
+                // a1 should be called with both args
+                $this->assertEquals(1, $a1->get_call_count());
+                $this->assertEquals(array($val, $arg1, $arg2), array_pop($a1->get_args()));
+
+                // a2 should be called with one only
+                $this->assertEquals(1, $a2->get_call_count());
+                $this->assertEquals(array($val), array_pop($a2->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(&$a, 'filter'), 10);
+                add_filter($tag, array(&$a, 'filter2'), 9);
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // there should be two events, one per filter
+                $this->assertEquals(2, $a->get_call_count());
+
+                $expected = array (
+                        // filter2 is called first because it has priority 9
+                        array (
+                                'filter' => 'filter2',
+                                'tag' => $tag,
+                                'args' => array($val)
+                        ),
+                        // filter 1 is called second
+                        array (
+                                'filter' => 'filter',
+                                'tag' => $tag,
+                                'args' => array($val)
+                        ),
+                );
+
+                $this->assertEquals($expected, $a->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(&$a, 'filterall'));
+                // do some filters
+                $this->assertEquals($val, apply_filters($tag1, $val));
+                $this->assertEquals($val, apply_filters($tag2, $val));
+                $this->assertEquals($val, apply_filters($tag1, $val));
+                $this->assertEquals($val, apply_filters($tag1, $val));
+
+                // our filter should have been called once for each apply_filters call
+                $this->assertEquals(4, $a->get_call_count());
+                // the right hooks should have been called in order
+                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
+
+                remove_filter('all', array(&$a, 'filterall'));
+                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
+
+        }
+
+        function test_remove_all_filter() {
+                $a = new MockAction();
+                $tag = rand_str();
+                $val = rand_str();
+
+                add_filter('all', array(&$a, 'filterall'));
+                $this->assertTrue( has_filter('all') );
+                $this->assertEquals( 10, has_filter('all', array(&$a, 'filterall')) );
+                $this->assertEquals($val, apply_filters($tag, $val));
+
+                // make sure our hook was called correctly
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+
+                // now remove the filter, do it again, and make sure it's not called this time
+                remove_filter('all', array(&$a, 'filterall'));
+                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
+                $this->assertFalse( has_filter('all') );
+                $this->assertEquals($val, apply_filters($tag, $val));
+                // call cound should remain at 1
+                $this->assertEquals(1, $a->get_call_count());
+                $this->assertEquals(array($tag), $a->get_tags());
+        }
+
+        /**
+         * @ticket 9886
+         */
+        function test_filter_ref_array() {
+                $obj = new stdClass();
+                $a = new MockAction();
+                $tag = rand_str();
+
+                add_action($tag, array(&$a, 'filter'));
+
+                apply_filters_ref_array($tag, array(&$obj));
+
+                $args = $a->get_args();
+                $this->assertSame($args[0][0], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][0]->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(&$a, 'filter_append'), 10, 2);
+                add_action($tag, array(&$b, 'filter_append'), 10, 2);
+
+                $result = apply_filters_ref_array($tag, array('string', &$obj));
+
+                $this->assertEquals($result, 'string_append_append');
+
+                $args = $a->get_args();
+                $this->assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][1]->foo) );
+
+                $args = $b->get_args();
+                $this->assertSame($args[0][1], $obj);
+                // just in case we don't trust assertSame
+                $obj->foo = true;
+                $this->assertFalse( empty($args[0][1]->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>+<?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. <div><div>Test</div></div>
+        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->basic_single_tags as $tag ) {
+                        $this->assertEquals( "<$tag />", balanceTags( "<$tag>", 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->single_tags as $tag ) {
+                        $this->assertEquals( "<$tag />", balanceTags( "<$tag>", 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->basic_single_tags as $tag ) {
+                        $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", 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->single_tags as $tag ) {
+                        $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", true ) );
+                }
+        }
+
+        /**
+         * @ticket 1597
+         */
+        function test_closes_unknown_single_tags_with_closing_tag() {
+
+                $inputs = array(
+                        '<strong/>',
+                        '<em />',
+                        '<p class="main1"/>',
+                        '<p class="main2" />',
+                );
+                $expected = array(
+                        '<strong></strong>',
+                        '<em></em>',
+                        '<p class="main1"></p>',
+                        '<p class="main2"></p>',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_closes_unclosed_single_tags_having_attributes() {
+                $inputs = array(
+                        '<img src="/images/example.png">',
+                        '<input type="text" name="example">'
+                );
+                $expected = array(
+                        '<img src="/images/example.png"/>',
+                        '<input type="text" name="example"/>'
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_allows_validly_closed_single_tags() {
+                $inputs = array(
+                        '<br />',
+                        '<hr />',
+                        '<img src="/images/example.png" />',
+                        '<input type="text" name="example" />'
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_balances_nestable_tags() {
+                $inputs = array(
+                        '<q>Test<q>Test</q>',
+                        '<div><div>Test',
+                        '<div>Test</div></div>',
+                );
+                $expected = array(
+                        '<q>Test<q>Test</q></q>',
+                        '<div><div>Test</div></div>',
+                        '<div>Test</div>',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_allows_adjacent_nestable_tags() {
+                $inputs = array(
+                        '<blockquote><blockquote>Example quote</blockquote></blockquote>',
+                        '<div class="container"><div>This is allowed></div></div>',
+                        '<span><span><span>Example in spans</span></span></span>',
+                        '<blockquote>Main quote<blockquote>Example quote</blockquote> more text</blockquote>',
+                        '<q><q class="inner-q">Inline quote</q></q>',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        /**
+         * @ticket 20401
+         */
+        function test_allows_immediately_nested_object_tags() {
+
+                $object = '<object id="obj1"><param name="param1"/><object id="obj2"><param name="param2"/></object></object>';
+                $this->assertEquals( $object, balanceTags( $object, true ) );
+        }
+
+        function test_balances_nested_non_nestable_tags() {
+                $inputs = array(
+                        '<b><b>This is bold</b></b>',
+                        '<b>Some text here <b>This is bold</b></b>',
+                );
+                $expected = array(
+                        '<b></b><b>This is bold</b>',
+                        '<b>Some text here </b><b>This is bold</b>',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_fixes_improper_closing_tag_sequence() {
+                $inputs = array(
+                        '<p>Here is a <strong class="part">bold <em>and emphasis</p></em></strong>',
+                        '<ul><li>Aaa</li><li>Bbb</ul></li>',
+                );
+                $expected = array(
+                        '<p>Here is a <strong class="part">bold <em>and emphasis</em></strong></p>',
+                        '<ul><li>Aaa</li><li>Bbb</li></ul>',
+                );
+
+                foreach ($inputs as $key => $input) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_adds_missing_closing_tags() {
+                $inputs = array(
+                        '<b><i>Test</b>',
+                        '<p>Test',
+                        '<p>Test test</em> test</p>',
+                        '</p>Test',
+                        '<p>Here is a <strong class="part">Test</p>',
+                );
+                $expected = array(
+                        '<b><i>Test</i></b>',
+                        '<p>Test</p>',
+                        '<p>Test test test</p>',
+                        'Test',
+                        '<p>Here is a <strong class="part">Test</strong></p>',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+                }
+        }
+
+        function test_removes_extraneous_closing_tags() {
+                $inputs = array(
+                        '<b>Test</b></b>',
+                        '<div>Test</div></div><div>Test',
+                        '<p>Test test</em> test</p>',
+                        '</p>Test',
+                );
+                $expected = array(
+                        '<b>Test</b>',
+                        '<div>Test</div><div>Test</div>',
+                        '<p>Test test test</p>',
+                        'Test',
+                );
+
+                foreach ( $inputs as $key => $input ) {
+                        $this->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>+<?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->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
+                        return;
+                }
+
+                $class = "WP_HTTP_" . $this->transport;
+                if ( !call_user_func( array($class, 'test') ) ) {
+                        $this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
+                }
+
+                // Disable all transports aside from this one.
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( "use_{$t}_transport", '__return_false' ); // Just strip them all
+                        if ( $t != $this->transport )
+                                add_filter( "use_{$t}_transport", '__return_false' ); // and add it back if need be..
+                }
+        }
+
+        function tearDown() {
+                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+                        remove_filter( "use_{$t}_transport", '__return_false' );
+                }
+        }
+
+        function test_redirect_on_301() {
+                // 5 : 5 & 301
+                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        function test_redirect_on_302() {
+                // 5 : 5 & 302
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 5) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_301_no_redirect() {
+                // 5 > 0 & 301
+                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 0) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals(301, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_302_no_redirect() {
+                // 5 > 0 & 302
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals(302, (int)$res['response']['code'] );
+        }
+
+        function test_redirections_equal() {
+                // 5 - 5
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals(200, (int)$res['response']['code'] );
+        }
+
+        function test_no_head_redirections() {
+                // No redirections on HEAD request:
+                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 1, array('method' => 'HEAD') );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals( 302, (int)$res['response']['code'] );
+        }
+
+        /**
+         * @ticket 16855
+         */
+        function test_redirect_on_head() {
+                // Redirections on HEAD request when Requested
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5, 'method' => 'HEAD') );
+                $this->assertFalse( is_wp_error($res) );
+                $this->assertEquals( 200, (int)$res['response']['code'] );
+        }
+
+        function test_redirections_greater() {
+                // 10 > 5
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) );
+                $this->assertTrue( is_wp_error($res), print_r($res, true) );
+        }
+
+        function test_redirections_greater_edgecase() {
+                // 6 > 5 (close edgecase)
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) );
+                $this->assertTrue( is_wp_error($res) );
+        }
+
+        function test_redirections_less_edgecase() {
+                // 4 < 5 (close edgecase)
+                $res = wp_remote_request($this->redirection_script . '?rt=' . 4, array('redirection' => 5) );
+                $this->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->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+                $this->assertFalse( is_wp_error($res) );
+                $this->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->redirection_script . '?200-location=true' );
+                $this->assertEquals( 'PASS', $res['body']);
+        }
+
+        /**
+         * @ticket 11888
+         */
+        function test_send_headers() {
+                // Test that the headers sent are recieved by the server
+                $headers = array('test1' => 'test', 'test2' => 0, 'test3' => '');
+                $res = wp_remote_request( $this->redirection_script . '?header-check', array('headers' => $headers) );
+
+                $this->assertFalse( is_wp_error($res) );
+
+                $headers = array();
+                foreach ( explode("\n", $res['body']) as $key => $value ) {
+                        if ( empty($value) )
+                                continue;
+                        $parts = explode(':', $value,2);
+                        unset($heaers[$key]);
+                        $headers[ $parts[0] ] = $parts[1];
+                }
+
+                $this->assertTrue( isset($headers['test1']) && 'test' == $headers['test1'] );
+                $this->assertTrue( isset($headers['test2']) && '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->assertTrue( isset($headers['test3']) && '' === $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' => true, 'timeout' => 30 ) ); //Auto generate the filename.
+
+                $this->assertFalse( is_wp_error( $res ) );
+                $this->assertEquals( '', $res['body'] ); // The body should be empty.
+                $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
+                $this->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>+<?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->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()" );
+                        return;
+                }
+
+                $actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
+                $this->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>+<?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' => 'classname',
+                        'id' => 'id',
+                        'style' => 'color: red;',
+                        'title' => 'title',
+                );
+
+                foreach ( $attributes as $name => $value ) {
+                        $string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
+                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        /**
+         * @ticket 20210
+         */
+        function test_wp_filter_post_kses_a() {
+                global $allowedposttags;
+
+                $attributes = array(
+                        'class' => 'classname',
+                        'id' => 'id',
+                        'style' => 'color: red;',
+                        'title' => 'title',
+                        'href' => 'http://example.com',
+                        'rel' => 'related',
+                        'rev' => 'revision',
+                        'name' => 'name',
+                        'target' => '_blank',
+                );
+
+                foreach ( $attributes as $name => $value ) {
+                        $string = "<a $name='$value'>I link this</a>";
+                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        /**
+         * @ticket 20210
+         */
+        function test_wp_filter_post_kses_abbr() {
+                global $allowedposttags;
+
+                $attributes = array(
+                        'class' => 'classname',
+                        'id' => 'id',
+                        'style' => 'color: red;',
+                        'title' => 'title',
+                );
+
+                foreach ( $attributes as $name => $value ) {
+                        $string = "<abbr $name='$value'>WP</abbr>";
+                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
+                }
+        }
+
+        function test_feed_links() {
+                global $allowedposttags;
+
+                $content = <<<EOF
+<a href="feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="javascript:feed:alert(1)">CLICK ME</a>
+<a href="javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:http:alert(1)">CLICK ME</a>
+EOF;
+
+                $expected = <<<EOF
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:alert(1)">CLICK ME</a>
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+EOF;
+
+        $this->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>+<?php
+
+/**
+ * @group media
+ * @group shortcode
+ */
+class Tests_Media extends WP_UnitTestCase {
+
+ function setUp() {
+ $this->caption = 'A simple caption.';
+ $this->html_content = <<<CAP
+A <strong class='classy'>bolded</strong> <em>caption</em> with a <a href="#">link</a>.
+CAP;
+ $this->img_content = <<<CAP
+<img src="pic.jpg" id='anId' alt="pic"/>
+CAP;
+ }
+
+ function test_img_caption_shortcode_added() {
+ global $shortcode_tags;
+ $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
+ $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
+ }
+
+ function test_img_caption_shortcode_with_empty_params() {
+ $result = img_caption_shortcode( array() );
+ $this->assertNull( $result );
+ }
+
+ function test_img_caption_shortcode_with_bad_attr() {
+ $result = img_caption_shortcode( array(), 'content' );
+ $this->assertEquals( 'content', 'content' );
+ }
+
+ function test_img_caption_shortcode_with_old_format() {
+ $result = img_caption_shortcode(
+ array( 'width' => 20, 'caption' => $this->caption )
+ );
+ $this->assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "/width: 30/", $result, $_r ) );
+ }
+
+ function test_img_caption_shortcode_with_old_format_id_and_align() {
+ $result = img_caption_shortcode(
+ array(
+ 'width' => 20,
+ 'caption' => $this->caption,
+ 'id' => '"myId',
+ 'align' => '&myAlignment'
+ )
+ );
+ $this->assertEquals( 1, preg_match_all( '/wp-caption &amp;myAlignment/', $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( '/id="&quot;myId"/', $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+ }
+
+ function test_new_img_caption_shortcode_with_html_caption() {
+ $result = img_caption_shortcode(
+ array( 'width' => 20, 'caption' => $this->html_content )
+ );
+ $our_preg = preg_quote( $this->html_content );
+
+ $this->assertEquals( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
+ }
+
+ function test_new_img_caption_shortcode_new_format() {
+ $result = img_caption_shortcode(
+ array( 'width' => 20 ),
+ $this->img_content . $this->html_content
+ );
+ $img_preg = preg_quote( $this->img_content );
+ $content_preg = preg_quote( $this->html_content );
+
+ $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+ }
+
+ function test_new_img_caption_shortcode_new_format_and_linked_image() {
+ $linked_image = "<a href='#'>{$this->img_content}</a>";
+ $result = img_caption_shortcode(
+ array( 'width' => 20 ),
+ $linked_image . $this->html_content
+ );
+ $img_preg = preg_quote( $linked_image );
+ $content_preg = preg_quote( $this->html_content );
+
+ $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+ }
+
+ function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
+ $linked_image = "<a href='#'>{$this->img_content}</a>";
+ $result = img_caption_shortcode(
+ array( 'width' => 20 ),
+ $linked_image . "\n\n" . $this->html_content
+ );
+ $img_preg = preg_quote( $linked_image );
+ $content_preg = preg_quote( $this->html_content );
+
+ $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+ $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $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>+<?php
+
+/**
+ * @group meta
+ */
+class Tests_Meta extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this->author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+                $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' );
+                $this->delete_meta_id = add_metadata( 'user', $this->author->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->assertEquals( 'unsanitized', $meta );
+
+                register_meta( 'post', 'some_meta', array( &$this, '_meta_sanitize_cb' ) );
+                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
+                $this->assertEquals( 'sanitized', $meta );
+        }
+
+        function test_delete_metadata_by_mid() {
+                // Let's try and delete a non-existing ID, non existing meta
+                $this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
+                $this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this->delete_meta_id ) );
+
+                // Now let's delete the real meta data
+                $this->assertTrue( delete_metadata_by_mid( 'user', $this->delete_meta_id ) );
+
+                // And make sure it's been deleted
+                $this->assertFalse( get_metadata_by_mid( 'user', $this->delete_meta_id ) );
+
+                // Make sure the caches are cleared
+                $this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
+        }
+
+        function test_update_metadata_by_mid() {
+                // Setup
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+
+                // Update the meta value
+                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+                $this->assertEquals( 'meta_new_value', $meta->meta_value );
+
+                // Update the meta value
+                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+                $this->assertEquals( 'meta_new_key', $meta->meta_key );
+
+                // Update the key and value
+                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+                $this->assertEquals( 'meta_key', $meta->meta_key );
+                $this->assertEquals( 'meta_value', $meta->meta_value );
+
+                // Update the value that has to be serialized
+                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+                $this->assertEquals( array( 'first', 'second' ), $meta->meta_value );
+
+                // Let's try some invalid meta data
+                $this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
+                $this->assertFalse( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', array('invalid', 'key' ) ) );
+
+                // Let's see if caches get cleared after updates.
+                $meta = get_metadata_by_mid( 'user', $this->meta_id );
+                $first = get_user_meta( $meta->user_id, $meta->meta_key );
+                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'other_meta_value' ) );
+                $second = get_user_meta( $meta->user_id, $meta->meta_key );
+                $this->assertFalse( $first === $second );
+        }
+
+        function test_metadata_exists() {
+                $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'foobarbaz' ) );
+                $this->assertTrue( metadata_exists( 'user', $this->author->ID, 'meta_key' ) );
+                $this->assertFalse( metadata_exists( 'user', 1234567890, 'foobarbaz' ) );
+                $this->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->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
+                $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) );
+                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value ) );
+                $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value ) );
+                $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) );
+                $this->assertEquals( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
+
+                // Test overslashing
+                $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) );
+                $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+                $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) );
+                $this->assertEquals( $expected2, get_metadata( 'user', $this->author->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>+<?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->factory->blog->create_many( 4 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this->assertInternalType( 'int', $blog_id );
+                        $prefix = $wpdb->get_blog_prefix( $blog_id );
+
+                        foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+                                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+                                $this->assertNotEmpty( $table_fields );
+                                $result = $wpdb->get_results( "SELECT * FROM $prefix$table LIMIT 1" );
+                                if ( 'commentmeta' == $table )
+                                        $this->assertEmpty( $result );
+                                else
+                                        $this->assertNotEmpty( $result );
+                        }
+                }
+
+                // update the blog count cache to use get_blog_count()
+                wp_update_network_counts();
+                $this->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->get_blog_prefix( $blog_id );
+                        foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+                                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+                                if ( $drop_tables )
+                                        $this->assertEmpty( $table_fields );
+                                else
+                                        $this->assertNotEmpty( $table_fields, $prefix . $table );
+                        }
+                }
+
+                // update the blog count cache to use get_blog_count()
+                wp_update_network_counts();
+                $this->assertEquals( 1, get_blog_count() );
+        }
+
+        function test_get_blogs_of_user() {
+                global $current_site;
+
+                // Logged out users don't have blogs.
+                $this->assertEquals( array(), get_blogs_of_user( 0 ) );
+
+                $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $blog_ids = $this->factory->blog->create_many( 10, array( 'user_id' => $user1_id ) );
+
+                foreach ( $blog_ids as $blog_id )
+                        $this->assertInternalType( 'int', $blog_id );
+
+                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
+                sort( $blogs_of_user );
+                $this->assertEquals ( array_merge( array( 1 ), $blog_ids), $blogs_of_user );
+
+                $this->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->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->assertFalse( $user->exists(), 'WP_User->exists' );
+                $this->assertEquals( array(), get_blogs_of_user( $user1_id ) );
+        }
+
+        function test_is_blog_user() {
+                global $current_site, $wpdb;
+
+                $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+                $old_current = get_current_user_id();
+                wp_set_current_user( $user1_id );
+
+                $this->assertTrue( is_blog_user() );
+                $this->assertTrue( is_blog_user( $wpdb->blogid ) );
+
+                $blog_ids = array();
+
+                $blog_ids = $this->factory->blog->create_many( 5 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this->assertInternalType( 'int', $blog_id );
+                        $this->assertTrue( is_blog_user( $blog_id ) );
+                        $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+                        $this->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->factory->user->create( array( 'role' => 'administrator' ) );
+
+                $old_current = get_current_user_id();
+                wp_set_current_user( $user1_id );
+
+                $this->assertTrue( is_user_member_of_blog() );
+                $this->assertTrue( is_user_member_of_blog( 0, 0 ) );
+                $this->assertTrue( is_user_member_of_blog( 0, $wpdb->blogid ) );
+                $this->assertTrue( is_user_member_of_blog( $user1_id ) );
+                $this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) );
+
+                $blog_ids = $this->factory->blog->create_many( 5 );
+                foreach ( $blog_ids as $blog_id ) {
+                        $this->assertInternalType( 'int', $blog_id );
+                        $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) );
+                        $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+                        $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) );
+                }
+
+                wpmu_delete_user( $user1_id );
+                $user = new WP_User( $user1_id );
+                $this->assertFalse( $user->exists(), 'WP_User->exists' );
+                $this->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 = "hello.php";
+
+                // local activate, should be invisible for the network
+                activate_plugin($path); // $network_wide = false
+                $active_plugins = wp_get_active_network_plugins();
+                $this->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->assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins );
+
+                //deactivate the plugin
+                deactivate_plugins($path);
+                $active_plugins = wp_get_active_network_plugins();
+                $this->assertEquals( Array(), $active_plugins );
+
+                $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
+
+                activate_plugin($path, '', $network_wide = true);
+                deactivate_plugins($path, true); // silent
+
+                $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
+        }
+
+        function _helper_deactivate_hook() {
+                $this->plugin_hook_count++;
+        }
+
+        function test_get_user_count() {
+                // Refresh the cache
+                wp_update_network_counts();
+                $start_count = get_user_count();
+
+                $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+                $count = get_user_count(); // No change, cache not refreshed
+                $this->assertEquals( $start_count, $count );
+
+                wp_update_network_counts(); // Magic happens here
+
+                $count = get_user_count();
+                $this->assertEquals( $start_count + 1, $count );
+        }
+
+        function test_wp_schedule_update_network_counts() {
+                $this->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->assertInternalType('int', wp_next_scheduled('update_network_counts'));
+        }
+
+        function test_users_can_register_signup_filter() {
+
+                $registration = get_site_option('registration');
+                $this->assertFalse( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'all');
+                $this->assertTrue( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'user');
+                $this->assertTrue( users_can_register_signup_filter() );
+
+                update_site_option('registration', 'none');
+                $this->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->assertEquals( 1, $dashboard_blog->blog_id );
+
+                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
+                $this->assertInternalType( 'int', $blog_id );
+
+                // set the dashboard blog to another one
+                update_site_option( 'dashboard_blog', $blog_id );
+                $dashboard_blog = get_dashboard_blog();
+                $this->assertEquals( $blog_id, $dashboard_blog->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->get_col( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE '" . $ip . "'" );
+                $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog )-1 ] );
+        }
+
+        /**
+         * @ticket 18119
+         */
+        function test_upload_is_user_over_quota() {
+                $default_space_allowed = 50;
+                $echo = false;
+
+                $this->assertFalse( upload_is_user_over_quota( $echo ) );
+                $this->assertTrue( is_upload_space_available() );
+
+                update_site_option('upload_space_check_disabled', true);
+                $this->assertFalse( upload_is_user_over_quota( $echo ) );
+                $this->assertTrue( is_upload_space_available() );
+
+                update_site_option( 'blog_upload_space', 0 );
+                $this->assertFalse( upload_is_user_over_quota( $echo ) );
+                $this->assertEquals( $default_space_allowed, get_space_allowed() );
+                $this->assertTrue( is_upload_space_available() );
+
+                update_site_option('upload_space_check_disabled', false);
+                $this->assertFalse( upload_is_user_over_quota( $echo ) );
+                $this->assertTrue( is_upload_space_available() );
+
+                if ( ! file_exists( BLOGSUPLOADDIR ) )
+                        $this->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, < 0 is returned as 0.
+                */
+
+                update_site_option( 'blog_upload_space', -1 );
+                $this->assertTrue( upload_is_user_over_quota( $echo ) );
+                $this->assertEquals( -1, get_space_allowed() );
+                $this->assertFalse( is_upload_space_available() );
+
+                update_option( 'blog_upload_space', 0 );
+                $this->assertFalse( upload_is_user_over_quota( $echo ) );
+                $this->assertEquals( $default_space_allowed, get_space_allowed() );
+                $this->assertTrue( is_upload_space_available() );
+
+                update_option( 'blog_upload_space', -1 );
+                $this->assertTrue( upload_is_user_over_quota( $echo ) );
+                $this->assertEquals( -1, get_space_allowed() );
+                $this->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 < 2
+                $blog = get_blog_details( $wpdb->blogid );
+                $current_time = time();
+                $time_difference = $current_time - strtotime( $blog->last_updated );
+                $this->assertLessThan( 2, $time_difference );
+        }
+
+        function test_getters(){
+                global $current_site;
+
+                $blog_id = get_current_blog_id();
+                $blog = get_blog_details( $blog_id );
+                $this->assertEquals( $blog_id, $blog->blog_id );
+                $this->assertEquals( $current_site->domain, $blog->domain );
+                $this->assertEquals( '/', $blog->path );
+
+                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogname', 'title' => 'Test Title' ) );
+                $this->assertInternalType( 'int', $blog_id );
+
+                $this->assertEquals( 'http://' . DOMAIN_CURRENT_SITE . PATH_CURRENT_SITE . 'test_blogname/', get_blogaddress_by_name('test_blogname') );
+
+                $this->assertEquals( $blog_id, get_id_from_blogname('test_blogname') );
+        }
+
+        function test_update_blog_details() {
+                global $current_site;
+
+                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
+                $this->assertInternalType( 'int', $blog_id );
+
+                $result = update_blog_details( $blog_id, array('domain' => 'example.com', 'path' => 'my_path/') );
+                $this->assertTrue( $result );
+
+                $blog = get_blog_details( $blog_id );
+                $this->assertEquals( 'example.com', $blog->domain );
+                $this->assertEquals( 'my_path/', $blog->path );
+                $this->assertEquals( '0', $blog->spam );
+
+                $result = update_blog_details( $blog_id, array('domain' => 'example2.com','spam' => 1) );
+                $this->assertTrue( $result );
+                $blog = get_blog_details( $blog_id );
+                $this->assertEquals( 'example2.com', $blog->domain );
+                $this->assertEquals( 'my_path/', $blog->path );
+                $this->assertEquals( '1', $blog->spam );
+
+                $result = update_blog_details( $blog_id );
+                $this->assertFalse( $result );
+                $blog = get_blog_details( $blog_id );
+                $this->assertEquals( 'example2.com', $blog->domain );
+                $this->assertEquals( 'my_path/', $blog->path );
+                $this->assertEquals( '1', $blog->spam );
+                $this->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>+<?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->assertFalse( get_blog_option( 1, 'doesnotexist' ) );
+                $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
+
+                $this->assertTrue( add_blog_option( 1, $key, $value ) );
+                // Assert all values of $blog_id that means the current or main blog (the same here).
+                $this->assertEquals( $value, get_blog_option( 1, $key ) );
+                $this->assertEquals( $value, get_blog_option( null, $key ) );
+                $this->assertEquals( $value, get_blog_option( '1', $key ) );
+                $this->assertEquals( $value, get_option( $key ) ); // check get_option()
+
+                $this->assertFalse( add_blog_option( 1, $key, $value ) ); // Already exists
+                $this->assertFalse( update_blog_option( 1, $key, $value ) ); // Value is the same
+                $this->assertTrue( update_blog_option( 1, $key, $value2 ) );
+                $this->assertEquals( $value2, get_blog_option( 1, $key ) );
+                $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+                $this->assertFalse( add_blog_option( 1, $key, $value ) );
+                $this->assertEquals( $value2, get_blog_option( 1, $key ) );
+                $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+
+                $this->assertTrue( delete_blog_option( 1, $key ) );
+                $this->assertFalse( get_blog_option( 1, $key ) );
+                $this->assertFalse( get_option( $key ) ); // check get_option()
+                $this->assertFalse( delete_blog_option( 1, $key ) );
+                $this->assertTrue( update_blog_option( 1, $key2, $value2 ) );
+                $this->assertEquals( $value2, get_blog_option( 1, $key2 ) );
+                $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
+                $this->assertTrue( delete_blog_option( 1, $key2 ) );
+                $this->assertFalse( get_blog_option( 1, $key2 ) );
+                $this->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>+<?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->assertFalse( get_option( 'doesnotexist' ) );
+                $this->assertTrue( add_option( $key, $value ) );
+                $this->assertEquals( $value, get_option( $key ) );
+                $this->assertFalse( add_option( $key, $value ) ); // Already exists
+                $this->assertFalse( update_option( $key, $value ) ); // Value is the same
+                $this->assertTrue( update_option( $key, $value2 ) );
+                $this->assertEquals( $value2, get_option( $key ) );
+                $this->assertFalse( add_option( $key, $value ) );
+                $this->assertEquals( $value2, get_option( $key ) );
+                $this->assertTrue( delete_option( $key ) );
+                $this->assertFalse( get_option( $key ) );
+                $this->assertFalse( delete_option( $key ) );
+
+                $this->assertTrue( update_option( $key2, $value2 ) );
+                $this->assertEquals( $value2, get_option( $key2 ) );
+                $this->assertTrue( delete_option( $key2 ) );
+                $this->assertFalse( get_option( $key2 ) );
+        }
+
+        function test_default_filter() {
+                $random = rand_str();
+
+                $this->assertFalse( get_option( 'doesnotexist' ) );
+
+                // Default filter overrides $default arg.
+                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this->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->assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
+
+                // Once the option exists, the $default arg and the default filter are ignored.
+                add_option( 'doesnotexist', $random );
+                $this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+
+                // Cleanup
+                $this->assertTrue( delete_option( 'doesnotexist' ) );
+                $this->assertFalse( get_option( 'doesnotexist' ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' => true, 'bar' => true );
+
+                $this->assertTrue( add_option( $key, $value ) );
+                $this->assertEquals( $value, get_option( $key ) );
+
+                $value = (object) $value;
+                $this->assertTrue( update_option( $key, $value ) );
+                $this->assertEquals( $value, get_option( $key ) );
+                $this->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>+<?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->assertFalse( get_site_option( 'doesnotexist' ) );
+                $this->assertTrue( add_site_option( $key, $value ) );
+                $this->assertEquals( $value, get_site_option( $key ) );
+                $this->assertFalse( add_site_option( $key, $value ) ); // Already exists
+                $this->assertFalse( update_site_option( $key, $value ) ); // Value is the same
+                $this->assertTrue( update_site_option( $key, $value2 ) );
+                $this->assertEquals( $value2, get_site_option( $key ) );
+                $this->assertFalse( add_site_option( $key, $value ) );
+                $this->assertEquals( $value2, get_site_option( $key ) );
+                $this->assertTrue( delete_site_option( $key ) );
+                $this->assertFalse( get_site_option( $key ) );
+                $this->assertFalse( delete_site_option( $key ) );
+
+                $this->assertTrue( update_site_option( $key2, $value2 ) );
+                $this->assertEquals( $value2, get_site_option( $key2 ) );
+                $this->assertTrue( delete_site_option( $key2 ) );
+                $this->assertFalse( get_site_option( $key2 ) );
+        }
+
+        function test_default_filter() {
+                $random = rand_str();
+
+                $this->assertFalse( get_site_option( 'doesnotexist' ) );
+
+                // Default filter overrides $default arg.
+                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this->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->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->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+                $this->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+
+                // Cleanup
+                $this->assertTrue( delete_site_option( 'doesnotexist' ) );
+                $this->assertFalse( get_site_option( 'doesnotexist' ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' => true, 'bar' => true );
+
+                $this->assertTrue( add_site_option( $key, $value ) );
+                $this->assertEquals( $value, get_site_option( $key ) );
+
+                $value = (object) $value;
+                $this->assertTrue( update_site_option( $key, $value ) );
+                $this->assertEquals( $value, get_site_option( $key ) );
+                $this->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->assertTrue( update_site_option( $key, $value ) );
+                wp_cache_flush(); // ensure we're getting the value from the DB
+                $this->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->assertEquals( get_site_option( $option, $default ), $default );
+                $this->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>+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SiteTransient extends WP_UnitTestCase {
+
+        function test_the_basics() {
+                $key = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this->assertFalse( get_site_transient( 'doesnotexist' ) );
+                $this->assertTrue( set_site_transient( $key, $value ) );
+                $this->assertEquals( $value, get_site_transient( $key ) );
+                $this->assertFalse( set_site_transient( $key, $value ) );
+                $this->assertTrue( set_site_transient( $key, $value2 ) );
+                $this->assertEquals( $value2, get_site_transient( $key ) );
+                $this->assertTrue( delete_site_transient( $key ) );
+                $this->assertFalse( get_site_transient( $key ) );
+                $this->assertFalse( delete_site_transient( $key ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' => true, 'bar' => true );
+
+                $this->assertTrue( set_site_transient( $key, $value ) );
+                $this->assertEquals( $value, get_site_transient( $key ) );
+
+                $value = (object) $value;
+                $this->assertTrue( set_site_transient( $key, $value ) );
+                $this->assertEquals( $value, get_site_transient( $key ) );
+                $this->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>+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_Transient extends WP_UnitTestCase {
+
+        function test_the_basics() {
+                $key = rand_str();
+                $value = rand_str();
+                $value2 = rand_str();
+
+                $this->assertFalse( get_transient( 'doesnotexist' ) );
+                $this->assertTrue( set_transient( $key, $value ) );
+                $this->assertEquals( $value, get_transient( $key ) );
+                $this->assertFalse( set_transient( $key, $value ) );
+                $this->assertTrue( set_transient( $key, $value2 ) );
+                $this->assertEquals( $value2, get_transient( $key ) );
+                $this->assertTrue( delete_transient( $key ) );
+                $this->assertFalse( get_transient( $key ) );
+                $this->assertFalse( delete_transient( $key ) );
+        }
+
+        function test_serialized_data() {
+                $key = rand_str();
+                $value = array( 'foo' => true, 'bar' => true );
+
+                $this->assertTrue( set_transient( $key, $value ) );
+                $this->assertEquals( $value, get_transient( $key ) );
+
+                $value = (object) $value;
+                $this->assertTrue( set_transient( $key, $value ) );
+                $this->assertEquals( $value, get_transient( $key ) );
+                $this->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>+<?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 = <<<EOF
+<foobar>no such tag</foobar>
+EOF;
+
+                $expected = <<<EOF
+no such tag
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->post_content );
+        }
+
+        // a simple test to make sure unbalanced tags are fixed
+        function test_post_content_unbalanced_tag() {
+
+                $content = <<<EOF
+<i>italics
+EOF;
+
+                $expected = <<<EOF
+<i>italics</i>
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->post_content );
+        }
+
+        // test kses filtering of disallowed attribute
+        function test_post_content_disallowed_attr() {
+
+                $content = <<<EOF
+<img src='foo' width='500' href='shlorp' />
+EOF;
+
+                $expected = <<<EOF
+<img src='foo' width='500' />
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->post_content );
+        }
+
+        /**
+         * test kses bug. xhtml does not require space before closing empty element
+         * @ticket 12394
+         */
+        function test_post_content_xhtml_empty_elem() {
+                $content = <<<EOF
+<img src='foo' width='500' height='300'/>
+EOF;
+
+                $expected = <<<EOF
+<img src='foo' width='500' height='300' />
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span a --more-- tag
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_more() {
+                $content = <<<EOF
+<em>some text<!--more-->
+that's continued after the jump</em>
+EOF;
+
+                $expected = <<<EOF
+<em>some text</em><!--more-->
+that's continued after the jump
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->post_content );
+        }
+
+        /**
+         * make sure unbalanced tags are fixed when they span a --nextpage-- tag
+         * @ticket 6297
+         */
+        function test_post_content_unbalanced_nextpage() {
+                $content = <<<EOF
+<em>some text<!--nextpage-->
+that's continued after the jump</em>
+EOF;
+
+                $expected = <<<EOF
+<em>some text</em><!--nextpage-->
+that's continued after the jump
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->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 = <<<EOF
+<em>some text<!--more-->
+that's continued after the jump</em>
+<!--nextpage-->
+<p>and the next page
+<!--nextpage-->
+breaks the graf</p>
+EOF;
+
+                $expected = <<<EOF
+<em>some text</em><!--more-->
+that's continued after the jump
+<!--nextpage-->
+<p>and the next page
+</p><!--nextpage-->
+breaks the graf
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->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 = <<<EOF
+<em>some text<!--nextpage-->
+that's continued after the jump</em>
+<!--more-->
+<p>and the next page
+<!--nextpage-->
+breaks the graf</p>
+EOF;
+
+                $expected = <<<EOF
+<em>some text</em><!--nextpage-->
+that's continued after the jump
+<!--more-->
+<p>and the next page
+</p><!--nextpage-->
+breaks the graf
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $expected, $post->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 = <<<EOF
+<em>some text<!--nextpage-->
+that's continued after the jump</em>
+<!--more-->
+<p>and the next page
+<!--nextpage-->
+breaks the graf</p>
+EOF;
+
+                $id = $this->factory->post->create( array( 'post_content' => $content ) );
+                $post = get_post($id);
+
+                $this->assertEquals( $content, $post->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>+<?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->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
+                $cat_b = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
+                $cat_c = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-c' ) );
+
+                $this->factory->post->create( array( 'post_title' => 'cats-a-b-c', 'post_date' => '2008-12-01 00:00:00', 'post_category' => array( $cat_a, $cat_b, $cat_c ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cats-a-and-b', 'post_date' => '2009-01-01 00:00:00', 'post_category' => array( $cat_a, $cat_b ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cats-b-and-c', 'post_date' => '2009-02-01 00:00:00', 'post_category' => array( $cat_b, $cat_c ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cats-a-and-c', 'post_date' => '2009-03-01 00:00:00', 'post_category' => array( $cat_a, $cat_c ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cat-a', 'post_date' => '2009-04-01 00:00:00', 'post_category' => array( $cat_a ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cat-b', 'post_date' => '2009-05-01 00:00:00', 'post_category' => array( $cat_b ) ) );
+                $this->factory->post->create( array( 'post_title' => 'cat-c', 'post_date' => '2009-06-01 00:00:00', 'post_category' => array( $cat_c ) ) );
+                $this->factory->post->create( array( 'post_title' => 'lorem-ipsum', 'post_date' => '2009-07-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'comment-test', 'post_date' => '2009-08-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'one-trackback', 'post_date' => '2009-09-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'many-trackbacks', 'post_date' => '2009-10-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'no-comments', 'post_date' => '2009-10-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'one-comment', 'post_date' => '2009-11-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'contributor-post-approved', 'post_date' => '2009-12-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'embedded-video', 'post_date' => '2010-01-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'simple-markup-test', 'post_date' => '2010-02-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'raw-html-code', 'post_date' => '2010-03-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tags-a-b-c', 'tags_input' => array( 'tag-a', 'tag-b', 'tag-c' ), 'post_date' => '2010-04-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tag-a', 'tags_input' => array( 'tag-a' ), 'post_date' => '2010-05-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tag-b', 'tags_input' => array( 'tag-b' ), 'post_date' => '2010-06-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tag-c', 'tags_input' => array( 'tag-c' ), 'post_date' => '2010-07-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tags-a-and-b', 'tags_input' => array( 'tag-a', 'tag-b' ), 'post_date' => '2010-08-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tags-b-and-c', 'tags_input' => array( 'tag-b', 'tag-c' ), 'post_date' => '2010-09-01 00:00:00' ) );
+                $this->factory->post->create( array( 'post_title' => 'tags-a-and-c', 'tags_input' => array( 'tag-a', 'tag-c' ), 'post_date' => '2010-10-01 00:00:00' ) );
+
+                unset( $this->q );
+                $this->q = new WP_Query();
+        }
+
+        function test_query_default() {
+                $posts = $this->q->query('');
+
+                // the output should be the most recent 10 posts as listed here
+                $expected = array(
+                        0 => 'tags-a-and-c',
+                        1 => 'tags-b-and-c',
+                        2 => 'tags-a-and-b',
+                        3 => 'tag-c',
+                        4 => 'tag-b',
+                        5 => 'tag-a',
+                        6 => 'tags-a-b-c',
+                        7 => 'raw-html-code',
+                        8 => 'simple-markup-test',
+                        9 => 'embedded-video',
+                );
+
+                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_tag_a() {
+                $posts = $this->q->query('tag=tag-a');
+
+                // there are 4 posts with Tag A
+                $this->assertCount( 4, $posts );
+                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+                $this->assertEquals( 'tag-a', $posts[2]->post_name );
+                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+        }
+
+        function test_query_tag_b() {
+                $posts = $this->q->query('tag=tag-b');
+
+                // there are 4 posts with Tag A
+                $this->assertCount( 4, $posts );
+                $this->assertEquals( 'tags-b-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+                $this->assertEquals( 'tag-b', $posts[2]->post_name );
+                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+        }
+
+        function test_query_tag_id() {
+                $tag = tag_exists('tag-a');
+                $posts = $this->q->query("tag_id={$tag[term_id]}");
+
+                // there are 4 posts with Tag A
+                $this->assertCount( 4, $posts );
+                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+                $this->assertEquals( 'tag-a', $posts[2]->post_name );
+                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+        }
+
+        function test_query_tag_slug__in() {
+                $posts = $this->q->query("tag_slug__in[]=tag-b&tag_slug__in[]=tag-c");
+
+                // there are 4 posts with either Tag B or Tag C
+                $this->assertCount( 6, $posts );
+                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
+                $this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
+                $this->assertEquals( 'tag-c', $posts[3]->post_name );
+                $this->assertEquals( 'tag-b', $posts[4]->post_name );
+                $this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
+        }
+
+
+        function test_query_tag__in() {
+                $tag_a = tag_exists('tag-a');
+                $tag_b = tag_exists('tag-b');
+                $posts = $this->q->query("tag__in[]={$tag_a[term_id]}&tag__in[]={$tag_b[term_id]}");
+
+                // there are 6 posts with either Tag A or Tag B
+                $this->assertCount( 6, $posts );
+                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
+                $this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
+                $this->assertEquals( 'tag-b', $posts[3]->post_name );
+                $this->assertEquals( 'tag-a', $posts[4]->post_name );
+                $this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
+        }
+
+        function test_query_tag__not_in() {
+                $tag_a = tag_exists('tag-a');
+                $posts = $this->q->query("tag__not_in[]={$tag_a[term_id]}");
+
+                // the most recent 10 posts with Tag A excluded
+                // (note the different between this and test_query_default)
+                $expected = array (
+                        0 => 'tags-b-and-c',
+                        1 => 'tag-c',
+                        2 => 'tag-b',
+                        3 => 'raw-html-code',
+                        4 => 'simple-markup-test',
+                        5 => 'embedded-video',
+                        6 => 'contributor-post-approved',
+                        7 => 'one-comment',
+                        8 => 'no-comments',
+                        9 => 'many-trackbacks',
+                );
+
+                $this->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->q->query("tag__in[]={$tag_a[term_id]}&tag__not_in[]={$tag_b[term_id]}");
+
+                // there are 4 posts with Tag A, only 2 when we exclude Tag B
+                $this->assertCount( 2, $posts );
+                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+                $this->assertEquals( 'tag-a', $posts[1]->post_name );
+        }
+
+
+
+        function test_query_category_name() {
+                $posts = $this->q->query('category_name=cat-a');
+
+                // there are 4 posts with Cat A, we'll check for them by name
+                $this->assertCount( 4, $posts );
+                $this->assertEquals( 'cat-a', $posts[0]->post_name );
+                $this->assertEquals( 'cats-a-and-c', $posts[1]->post_name );
+                $this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
+                $this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
+        }
+
+        function test_query_cat() {
+                $cat = category_exists('cat-b');
+                $posts = $this->q->query("cat=$cat");
+
+                // there are 4 posts with Cat B
+                $this->assertCount( 4, $posts );
+                $this->assertEquals( 'cat-b', $posts[0]->post_name );
+                $this->assertEquals( 'cats-b-and-c', $posts[1]->post_name );
+                $this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
+                $this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
+        }
+
+        function test_query_posts_per_page() {
+                $posts = $this->q->query('posts_per_page=5');
+
+                $expected = array (
+                        0 => 'tags-a-and-c',
+                        1 => 'tags-b-and-c',
+                        2 => 'tags-a-and-b',
+                        3 => 'tag-c',
+                        4 => 'tag-b',
+                );
+
+                $this->assertCount( 5, $posts );
+                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_offset() {
+                $posts = $this->q->query('offset=2');
+
+                $expected = array (
+                        0 => 'tags-a-and-b',
+                        1 => 'tag-c',
+                        2 => 'tag-b',
+                        3 => 'tag-a',
+                        4 => 'tags-a-b-c',
+                        5 => 'raw-html-code',
+                        6 => 'simple-markup-test',
+                        7 => 'embedded-video',
+                        8 => 'contributor-post-approved',
+                        9 => 'one-comment',
+                );
+
+                $this->assertCount( 10, $posts );
+                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_paged() {
+                $posts = $this->q->query('paged=2');
+
+                $expected = array (
+                        0 => 'contributor-post-approved',
+                        1 => 'one-comment',
+                        2 => 'no-comments',
+                        3 => 'many-trackbacks',
+                        4 => 'one-trackback',
+                        5 => 'comment-test',
+                        6 => 'lorem-ipsum',
+                        7 => 'cat-c',
+                        8 => 'cat-b',
+                        9 => 'cat-a',
+                );
+
+                $this->assertCount( 10, $posts );
+                $this->assertTrue( $this->q->is_paged() );
+                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        function test_query_paged_and_posts_per_page() {
+                $posts = $this->q->query('paged=4&posts_per_page=4');
+
+                $expected = array (
+                        0 => 'no-comments',
+                        1 => 'many-trackbacks',
+                        2 => 'one-trackback',
+                        3 => 'comment-test',
+                );
+
+                $this->assertCount( 4, $posts );
+                $this->assertTrue( $this->q->is_paged() );
+                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+        }
+
+        /**
+         * @ticket 18897
+         */
+        function test_query_offset_and_paged() {
+                $posts = $this->q->query('paged=2&offset=3');
+
+                $expected = array (
+                        0 => 'many-trackbacks',
+                        1 => 'one-trackback',
+                        2 => 'comment-test',
+                        3 => 'lorem-ipsum',
+                        4 => 'cat-c',
+                        5 => 'cat-b',
+                        6 => 'cat-a',
+                        7 => 'cats-a-and-c',
+                        8 => 'cats-b-and-c',
+                        9 => 'cats-a-and-b',
+                );
+
+                $this->assertCount( 10, $posts );
+                $this->assertTrue( $this->q->is_paged() );
+                $this->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>+<?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']->init();
+                flush_rewrite_rules();
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                $GLOBALS['wp_rewrite']->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->$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->assertTrue( $passed, $message );
+        }
+
+        function test_home() {
+                $this->go_to('/');
+                $this->assertQueryTrue('is_home');
+        }
+
+        function test_404() {
+                $this->go_to('/'.rand_str());
+                $this->assertQueryTrue('is_404');
+        }
+
+        function test_permalink() {
+                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+                $this->go_to( get_permalink( $post_id ) );
+                $this->assertQueryTrue('is_single', 'is_singular');
+        }
+
+        function test_post_comments_feed() {
+                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+                $this->factory->comment->create_post_comments( $post_id, 2 );
+                $this->go_to( get_post_comments_feed_link( $post_id ) );
+                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+
+        function test_post_comments_feed_with_no_comments() {
+                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+                $this->go_to( get_post_comments_feed_link( $post_id ) );
+                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+        }
+
+        function test_page() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
+                $this->go_to( get_permalink( $page_id ) );
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_parent_page() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $this->go_to( get_permalink( $page_id ) );
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_1() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $this->go_to( get_permalink( $page_id ) );
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        function test_child_page_2() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+                $this->go_to( get_permalink( $page_id ) );
+
+                $this->assertQueryTrue('is_page','is_singular');
+        }
+
+        // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
+        function test_page_trackback() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $url = get_permalink( $page_id );
+                        $this->go_to("{$url}trackback/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page','is_singular','is_trackback');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+        function test_page_feed() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $this->factory->comment->create_post_comments( $page_id, 2 );
+                        $url = get_permalink( $page_id );
+                        $this->go_to("{$url}feed/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        function test_page_feed_with_no_comments() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $url = get_permalink( $page_id );
+                        $this->go_to("{$url}feed/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+        function test_page_feed_atom() {
+                $page_ids = array();
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+                foreach ( $page_ids as $page_id ) {
+                        $this->factory->comment->create_post_comments( $page_id, 2 );
+
+                        $url = get_permalink( $page_id );
+                        $this->go_to("{$url}feed/atom/");
+
+                        // make sure the correct wp_query flags are set
+                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+                        // make sure the correct page was fetched
+                        global $wp_query;
+                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+                }
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
+        function test_page_page_2() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+                $this->go_to("/about/page/2/");
+
+                // make sure the correct wp_query flags are set
+                $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+        }
+
+        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
+        function test_page_page_2_no_slash() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+                $this->go_to("/about/page2/");
+
+                // make sure the correct wp_query flags are set
+                $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+        }
+
+        // FIXME: what is this for?
+        // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
+        function test_pagination_of_posts_page() {
+                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+                update_option( 'show_on_front', 'page' );
+                update_option( 'page_for_posts', $page_id );
+
+                $this->go_to('/about/2/');
+
+                $this->assertQueryTrue( 'is_home', 'is_posts_page' );
+
+                // make sure the correct page was fetched
+                global $wp_query;
+                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+        }
+
+        // FIXME: no tests for these yet
+        // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+
+        // 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+        // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+        function test_main_feed_2() {
+                $this->factory->post->create(); // @test_404
+                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+
+                // long version
+                foreach ($feeds as $feed) {
+                        $this->go_to("/feed/{$feed}/");
+                        $this->assertQueryTrue('is_feed');
+                }
+
+                // short version
+                foreach ($feeds as $feed) {
+                        $this->go_to("/{$feed}/");
+                        $this->assertQueryTrue('is_feed');
+                }
+
+        }
+
+        function test_main_feed() {
+                $this->factory->post->create(); // @test_404
+                $types = array('rss2', 'rss', 'atom');
+                foreach ($types as $type) {
+                        $this->go_to(get_feed_link($type));
+                        $this->assertQueryTrue('is_feed');
+                }
+        }
+
+        // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
+        function test_paged() {
+                $this->factory->post->create_many( 15 );
+                for ( $i = 2; $i <= 3; $i++ ) {
+                        $this->go_to("/page/{$i}/");
+                        $this->assertQueryTrue('is_home', 'is_paged');
+                }
+        }
+
+        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+        // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+        function test_main_comments_feed() {
+                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+                $this->factory->comment->create_post_comments( $post_id, 2 );
+
+                // check the url as generated by get_post_comments_feed_link()
+                $this->go_to( get_post_comments_feed_link( $post_id ) );
+                $this->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->go_to("/comments/feed/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/comments/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
+                }
+
+        }
+
+        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+        function test_search_feed() {
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/search/test/feed/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_search');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/search/test/{$type}");
+                                $this->assertQueryTrue('is_feed', 'is_search');
+                }
+        }
+
+        // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
+        function test_search_paged() {
+                $this->factory->post->create_many( 10, array( 'post_title' => 'test' ) );
+                $this->go_to('/search/test/page/2/');
+                $this->assertQueryTrue('is_search', 'is_paged');
+        }
+
+        // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
+        function test_search() {
+                $this->go_to('/search/test/');
+                $this->assertQueryTrue('is_search');
+        }
+
+        /**
+         * @ticket 13961
+         */
+        function test_search_encoded_chars() {
+                $this->go_to('/search/F%C3%BCnf%2Bbar/');
+                $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' );
+        }
+
+        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+        function test_category_feed() {
+                $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/category/cat-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/category/cat-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+                }
+        }
+
+        // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
+        function test_category_paged() {
+                $this->factory->post->create_many( 10 );
+                $this->go_to('/category/uncategorized/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
+        }
+
+        // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
+        function test_category() {
+                $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
+                $this->go_to('/category/cat-a/');
+                $this->assertQueryTrue('is_archive', 'is_category');
+        }
+
+        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+        function test_tag_feed() {
+                $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/tag/tag-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/tag/tag-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+                }
+        }
+
+        // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
+        function test_tag_paged() {
+                $post_ids = $this->factory->post->create_many( 10 );
+                foreach ( $post_ids as $post_id )
+                        $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
+                $this->go_to('/tag/tag-a/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
+        }
+
+        // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
+        function test_tag() {
+                $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
+                $this->go_to('/tag/tag-a/');
+                $this->assertQueryTrue('is_archive', 'is_tag');
+        }
+
+        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+        function test_author_feed() {
+                $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/author/user-a/feed/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+
+                // check the short form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/author/user-a/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+                }
+        }
+
+        // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
+        function test_author_paged() {
+                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+                $this->factory->post->create_many( 10, array( 'post_author' => $user_id ) );
+                $this->go_to('/author/user-a/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
+        }
+
+        // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
+        function test_author() {
+                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+                $this->factory->post->create( array( 'post_author' => $user_id ) );
+                $this->go_to('/author/user-a/');
+                $this->assertQueryTrue('is_archive', 'is_author');
+        }
+
+        function test_author_with_no_posts() {
+                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+                $this->go_to('/author/user-a/');
+                $this->assertQueryTrue('is_archive', 'is_author');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+        function test_ymd_feed() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/2007/09/04/feed/{$type}");
+                                $this->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->go_to("/2007/09/04/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
+        function test_ymd_paged() {
+                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/09/04/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
+        function test_ymd() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/09/04/');
+                $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+        function test_ym_feed() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/2007/09/feed/{$type}");
+                                $this->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->go_to("/2007/09/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
+        function test_ym_paged() {
+                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/09/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
+        function test_ym() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/09/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
+        }
+
+        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+        function test_y_feed() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                // check the long form
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("/2007/feed/{$type}");
+                                $this->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->go_to("/2007/{$type}");
+                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+                }
+        }
+
+        // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
+        function test_y_paged() {
+                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/page/2/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
+        }
+
+        // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
+        function test_y() {
+                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+                $this->go_to('/2007/');
+                $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
+        function test_post_trackback() {
+                $post_id = $this->factory->post->create();
+                $permalink = get_permalink( $post_id );
+                $this->go_to("{$permalink}trackback/");
+                $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+        function test_post_comment_feed() {
+                $post_id = $this->factory->post->create();
+                $permalink = get_permalink( $post_id );
+
+                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+                foreach ($types as $type) {
+                                $this->go_to("{$permalink}feed/{$type}");
+                                $this->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->go_to("{$permalink}{$type}");
+                                $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+                }
+        }
+
+        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
+        function test_post_paged_short() {
+                $post_id = $this->factory->post->create( array(
+                        'post_date' => '2007-09-04 00:00:00',
+                        'post_title' => 'a-post-with-multiple-pages',
+                        'post_content' => 'Page 1 <!--nextpage--> Page 2'
+                ) );
+                $this->go_to( get_permalink( $post_id ) . '2/' );
+                // should is_paged be true also?
+                $this->assertQueryTrue('is_single', 'is_singular');
+
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        function test_post_attachment() {
+                $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
+                $permalink = get_attachment_link( $post_id );
+                $this->go_to($permalink);
+                $this->assertQueryTrue('is_single', 'is_attachment', 'is_singular');
+        }
+
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&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>+<?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(&$this, '_shortcode_tag'));
+
+                foreach ( $this->shortcodes as $shortcode )
+                        add_shortcode( $shortcode, array( $this, '_shortcode_' . $shortcode ) );
+
+                $this->atts = null;
+                $this->content = null;
+                $this->tagname = null;
+
+        }
+
+        function tearDown() {
+                global $shortcode_tags;
+                parent::tearDown();
+                foreach ( $this->shortcodes as $shortcode )
+                        unset( $shortcode_tags[ $shortcode ] );
+                unset( $shortcode_tags['test-shortcode-tag'] );
+        }
+
+        // [footag foo="bar"]
+        function _shortcode_footag( $atts ) {
+                return @"foo = {$atts['foo']}";
+        }
+
+        // [bartag foo="bar"]
+        function _shortcode_bartag( $atts ) {
+                extract(shortcode_atts(array(
+                        'foo' => 'no foo',
+                        'baz' => 'default baz',
+                ), $atts));
+
+                return "foo = {$foo}";
+        }
+
+        // [baztag]content[/baztag]
+        function _shortcode_baztag( $atts, $content = '' ) {
+                return 'content = '.do_shortcode($content);
+        }
+
+        function _shortcode_dumptag( $atts ) {
+                $out = '';
+                foreach ($atts as $k=>$v)
+                        $out .= "$k = $v\n";
+                return $out;
+        }
+
+        function _shortcode_tag($atts, $content=NULL, $tagname=NULL) {
+                $this->atts = $atts;
+                $this->content = $content;
+                $this->tagname = $tagname;
+        }
+
+        function test_noatts() {
+                do_shortcode('[test-shortcode-tag /]');
+                $this->assertEquals( '', $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_one_att() {
+                do_shortcode('[test-shortcode-tag foo="asdf" /]');
+                $this->assertEquals( array('foo' => 'asdf'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_not_a_tag() {
+                $out = do_shortcode('[not-a-shortcode-tag]');
+                $this->assertEquals( '[not-a-shortcode-tag]', $out );
+        }
+
+        function test_two_atts() {
+                do_shortcode('[test-shortcode-tag foo="asdf" bar="bing" /]');
+                $this->assertEquals( array('foo' => 'asdf', 'bar' => 'bing'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_noatts_enclosing() {
+                do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]');
+                $this->assertEquals( '', $this->atts );
+                $this->assertEquals( 'content', $this->content );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_one_att_enclosing() {
+                do_shortcode('[test-shortcode-tag foo="bar"]content[/test-shortcode-tag]');
+                $this->assertEquals( array('foo' => 'bar'), $this->atts );
+                $this->assertEquals( 'content', $this->content );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_two_atts_enclosing() {
+                do_shortcode('[test-shortcode-tag foo="bar" baz="bing"]content[/test-shortcode-tag]');
+                $this->assertEquals( array('foo' => 'bar', 'baz' => 'bing'), $this->atts );
+                $this->assertEquals( 'content', $this->content );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_unclosed() {
+                $out = do_shortcode('[test-shortcode-tag]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( '', $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_positional_atts_num() {
+                $out = do_shortcode('[test-shortcode-tag 123]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( array(0=>'123'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_positional_atts_url() {
+                $out = do_shortcode('[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( array(0=>'http://www.youtube.com/watch?v=eBGIQ7ZuuiU'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_positional_atts_quotes() {
+                $out = do_shortcode('[test-shortcode-tag "something in quotes" "something else"]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( array(0=>'something in quotes', 1=>'something else'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_positional_atts_mixed() {
+                $out = do_shortcode('[test-shortcode-tag 123 http://wordpress.com/ 0 "foo" bar]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( array(0=>'123', 1=>'http://wordpress.com/', 2=>'0', 3=>'foo', 4=>'bar'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_positional_and_named_atts() {
+                $out = do_shortcode('[test-shortcode-tag 123 url=http://wordpress.com/ foo bar="baz"]');
+                $this->assertEquals( '', $out );
+                $this->assertEquals( array(0=>'123', 'url' => 'http://wordpress.com/', 1=>'foo', 'bar' => 'baz'), $this->atts );
+                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
+        }
+
+        function test_footag_default() {
+                $out = do_shortcode('[footag]');
+                $this->assertEquals('foo = ', $out);
+        }
+
+        function test_footag_val() {
+                $val = rand_str();
+                $out = do_shortcode('[footag foo="'.$val.'"]');
+                $this->assertEquals('foo = '.$val, $out);
+        }
+
+        function test_nested_tags() {
+                $out = do_shortcode('[baztag][dumptag abc="foo" def=123 http://wordpress.com/][/baztag]');
+                $expected = "content = abc = foo\ndef = 123\n0 = http://wordpress.com\n";
+                $this->assertEquals($expected, $out);
+        }
+
+        /**
+         * @ticket 6518
+         */
+        function test_tag_escaped() {
+                $out = do_shortcode('[[footag]] [[bartag foo="bar"]]');
+                $this->assertEquals('[footag] [bartag foo="bar"]', $out);
+
+                $out = do_shortcode('[[footag /]] [[bartag foo="bar" /]]');
+                $this->assertEquals('[footag /] [bartag foo="bar" /]', $out);
+
+                $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]]');
+                $this->assertEquals('[baztag foo="bar"]the content[/baztag]', $out);
+
+                // double escaped
+                $out = do_shortcode('[[[footag]]] [[[bartag foo="bar"]]]');
+                $this->assertEquals('[[footag]] [[bartag foo="bar"]]', $out);
+        }
+
+        function test_tag_not_escaped() {
+                // these have square brackets on either end but aren't actually escaped
+                $out = do_shortcode('[[footag] [bartag foo="bar"]]');
+                $this->assertEquals('[foo = foo = bar]', $out);
+
+                $out = do_shortcode('[[footag /] [bartag foo="bar" /]]');
+                $this->assertEquals('[foo = foo = bar]', $out);
+
+                $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]');
+                $this->assertEquals('[content = the content', $out);
+
+                $out = do_shortcode('[[not-a-tag]]');
+                $this->assertEquals('[[not-a-tag]]', $out);
+
+                $out = do_shortcode('[[[footag] [bartag foo="bar"]]]');
+                $this->assertEquals('[[foo = foo = bar]]', $out);
+        }
+
+        function test_mixed_tags() {
+                $in = <<<EOF
+So this is a post with [footag foo="some stuff"] and a bunch of tags.
+
+[bartag]
+
+[baztag]
+Here's some content
+on more than one line
+[/baztag]
+
+[bartag foo=1] [baztag] [footag foo="2"] [baztag]
+
+[baztag]
+more content
+[/baztag]
+
+EOF;
+                $expected = <<<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->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("[test-shortcode-tag foo=\"bar\" \x00\xA0baz=\"123\"]");
+                $this->assertEquals( array('foo' => 'bar', 'baz' => '123'), $this->atts );
+                $this->assertEquals( '', $this->content );
+        }
+
+        /**
+         * @ticket 6562
+         *
+         * @TODO Review this test as it may be incorrect
+         */
+        function test_utf8_whitespace_2() {
+                do_shortcode("[test-shortcode-tag foo=\"bar\" \x20\x0babc=\"def\"]");
+                $this->assertEquals( array('foo' => 'bar', 'abc' => 'def'), $this->atts );
+                $this->assertEquals( '', $this->content );
+        }
+
+        function test_shortcode_unautop() {
+                // a blank line is added at the end, so test with it already there
+                $test_string = <<<EOF
+[footag]
+
+EOF;
+
+                $this->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 = <<<EOF
+[footag]
+[footag]
+
+EOF;
+
+                $actual = shortcode_unautop( wpautop( $test_string ) );
+                $this->assertEquals( $test_string, $actual );
+        }
+
+        /**
+         * @ticket 10326
+         */
+        function test_strip_shortcodes() {
+                $this->assertEquals('before', strip_shortcodes('before[gallery]'));
+                $this->assertEquals('after', strip_shortcodes('[gallery]after'));
+                $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_no_posts() {
-                $this->make_user_by_role( 'author' );
-
-                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-        }
-
-        function test_no_editable_posts() {
-                $this->make_user_by_role( 'author' );
-                $editor = $this->make_user_by_role( 'editor' );
-                $this->factory->post->create( array( 'post_author' => $editor ) );
-
-                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 0, count( $result ) );
-        }
-
-        function test_date() {
-                $this->make_user_by_role( 'author' );
-
-                $this->factory->post->create();
-
-                $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
-                $this->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->post_date, false ), 'Ymd\TH:i:s' ) );
-
-                        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                        $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-
-                        $this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
-                        $this->assertEquals( $date_gmt, $result['date_created_gmt']->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_editPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $post = array();
-                $result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_edit_own_post() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' => $new_title );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $new_title, $out->post_title );
-        }
-
-        function test_capable_edit_others_post() {
-                $this->make_user_by_role( 'editor' );
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' => $new_title );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $new_title, $out->post_title );
-        }
-
-        function test_incapable_edit_others_post() {
-                $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $original_title = 'Post test';
-                $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'title' => $new_title );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $original_title, $out->post_title );
-        }
-
-        function test_capable_reassign_author() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'wp_author_id' => $author_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $author_id, $out->post_author );
-        }
-
-        function test_incapable_reassign_author() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'wp_author_id' => $author_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $contributor_id, $out->post_author );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $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' => $attachment_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->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' => 'Updated post' );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create another attachment
-                $attachment2 = array_merge( $attachment, array( 'title' => 'Post Thumbnail 2' ) );
-                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
-
-                // change the post's post_thumbnail
-                $post4 = array( 'wp_post_thumbnail' => $attachment2_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // unset the post's post_thumbnail
-                $post5 = array( 'wp_post_thumbnail' => '' );
-                $result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_edit_basic_post_info() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Title', 'post_content' => 'Content', 'post_excerpt' => 'Excerpt', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'title' => 'New Title', 'post_author' => $contributor_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $post2['title'], $out->post_title );
-
-                $post3 = array( 'description' => 'New Content', 'post_author' => $contributor_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $post2['title'], $out->post_title );
-                $this->assertEquals( $post3['description'], $out->post_content );
-
-                $post4 = array( 'mt_excerpt' => 'New Excerpt', 'post_author' => $contributor_id );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $post2['title'], $out->post_title );
-                $this->assertEquals( $post3['description'], $out->post_content );
-                $this->assertEquals( $post4['mt_excerpt'], $out->post_excerpt );
-        }
-
-        // Not allowed since [19914]
-        function test_change_post_type() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Title', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_type' => 'page' );
-                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $result->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>-<?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->make_user_by_role( 'author' );
-                $this->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => $author_id,
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'subscriber', 'subscriber' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        /**
-         * @ticket 20336
-         */
-        function test_invalid_postid() {
-                $result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post' );
-                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this->assertInternalType( 'string', $result['userid'] );
-                $this->assertInternalType( 'int', $result['postid'] );
-                $this->assertInternalType( 'string', $result['description'] );
-                $this->assertInternalType( 'string', $result['title'] );
-                $this->assertInternalType( 'string', $result['link'] );
-                $this->assertInternalType( 'string', $result['permaLink'] );
-                $this->assertInternalType( 'array', $result['categories'] );
-                $this->assertInternalType( 'string', $result['mt_excerpt'] );
-                $this->assertInternalType( 'string', $result['mt_text_more'] );
-                $this->assertInternalType( 'string', $result['wp_more_text'] );
-                $this->assertInternalType( 'int', $result['mt_allow_comments'] );
-                $this->assertInternalType( 'int', $result['mt_allow_pings'] );
-                $this->assertInternalType( 'string', $result['mt_keywords'] );
-                $this->assertInternalType( 'string', $result['wp_slug'] );
-                $this->assertInternalType( 'string', $result['wp_password'] );
-                $this->assertInternalType( 'string', $result['wp_author_id'] );
-                $this->assertInternalType( 'string', $result['wp_author_display_name'] );
-                $this->assertInternalType( 'string', $result['post_status'] );
-                $this->assertInternalType( 'array', $result['custom_fields'] );
-                $this->assertInternalType( 'string', $result['wp_post_format'] );
-                $this->assertInternalType( 'bool', $result['sticky'] );
-
-
-                // Check expected values
-                $this->assertStringMatchesFormat( '%d', $result['userid'] );
-                $this->assertEquals( $this->post_data['post_title'], $result['title'] );
-                $this->assertEquals( 'draft', $result['post_status'] );
-                $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-                $this->assertEquals( $this->post_data['post_excerpt'], $result['mt_excerpt'] );
-                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
-
-                $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
-
-                set_post_thumbnail( $this->post_id, $attachment_id );
-
-                $fields = array( 'post' );
-                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
-                $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
-                $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_date() {
-                $fields = array( 'post' );
-                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
-
-                $this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
-                $this->assertEquals( $this->post_date_ts, $result['date_modified']->getTimestamp() );
-
-                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->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->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this->assertEquals( $post_date_gmt, $result['date_created_gmt']->getTimestamp() );
-                $this->assertEquals( $post_modified_gmt, $result['date_modified_gmt']->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>-<?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->make_user_by_role( 'author' );
-                $this->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => $author_id,
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_no_editable_posts() {
-                wp_delete_post( $this->post_id );
-
-                $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 0, count( $result ) );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post' );
-                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $post = get_post( $result['postid'] );
-
-                        // Check data types
-                        $this->assertInternalType( 'string', $result['userid'] );
-                        $this->assertInternalType( 'string', $result['postid'] );
-                        $this->assertInternalType( 'string', $result['description'] );
-                        $this->assertInternalType( 'string', $result['title'] );
-                        $this->assertInternalType( 'string', $result['link'] );
-                        $this->assertInternalType( 'string', $result['permaLink'] );
-                        $this->assertInternalType( 'array', $result['categories'] );
-                        $this->assertInternalType( 'string', $result['mt_excerpt'] );
-                        $this->assertInternalType( 'string', $result['mt_text_more'] );
-                        $this->assertInternalType( 'string', $result['wp_more_text'] );
-                        $this->assertInternalType( 'int', $result['mt_allow_comments'] );
-                        $this->assertInternalType( 'int', $result['mt_allow_pings'] );
-                        $this->assertInternalType( 'string', $result['mt_keywords'] );
-                        $this->assertInternalType( 'string', $result['wp_slug'] );
-                        $this->assertInternalType( 'string', $result['wp_password'] );
-                        $this->assertInternalType( 'string', $result['wp_author_id'] );
-                        $this->assertInternalType( 'string', $result['wp_author_display_name'] );
-                        $this->assertInternalType( 'string', $result['post_status'] );
-                        $this->assertInternalType( 'array', $result['custom_fields'] );
-                        $this->assertInternalType( 'string', $result['wp_post_format'] );
-
-                        // Check expected values
-                        $this->assertStringMatchesFormat( '%d', $result['userid'] );
-                        $this->assertStringMatchesFormat( '%d', $result['postid'] );
-                        $this->assertEquals( $post->post_title, $result['title'] );
-                        $this->assertEquals( 'draft', $result['post_status'] );
-                        $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-                        $this->assertEquals( $post->post_excerpt, $result['mt_excerpt'] );
-                        $this->assertEquals( url_to_postid( $result['link'] ), $post->ID );
-
-                        $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
-                set_post_thumbnail( $this->post_id, $attachment_id );
-
-                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( $this->post_id, 'author', 'author' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
-                        $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
-
-                        if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this->post_id ) {
-                                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
-
-                                $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
-                        }
-                }
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_date() {
-                $this->make_user_by_role( 'editor' );
-
-                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
-                $this->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->post_date, false ), 'Ymd\TH:i:s' ) );
-                        $date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_modified, false ), 'Ymd\TH:i:s' ) );
-
-                        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                        $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                        $this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
-                        $this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
-
-                        $this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
-                        $this->assertEquals( $date_gmt, $result['date_created_gmt']->getTimestamp() );
-                        $this->assertEquals( strtotime( $post->post_date ), $result['date_modified']->getTimestamp() );
-                        $this->assertEquals( $date_modified_gmt, $result['date_modified_gmt']->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_mw_newPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $post = array();
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $post = array();
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_no_content() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array();
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
-        }
-
-        function test_basic_content() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_ignore_id() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test', 'ID' => 103948 );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertNotEquals( '103948', $result );
-        }
-
-        function test_capable_publish() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test', 'post_status' => 'publish' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_publish() {
-                $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'title' => 'Test', 'post_status' => 'publish' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_other_author() {
-                $this->make_user_by_role( 'editor' );
-                $other_author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_other_author() {
-                $this->make_user_by_role( 'contributor' );
-                $other_author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        /**
-         * @ticket 20356
-         */
-        function test_invalid_author() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-        }
-
-        function test_empty_author() {
-                $my_author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this->assertEquals( $my_author_id, $out->post_author );
-                $this->assertEquals( 'Test', $out->post_title );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
-
-                $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_incapable_set_post_type_as_page() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'title' => 'Test', 'post_type' => 'page' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_set_post_type_as_page() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'title' => 'Test', 'post_type' => 'page' );
-                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this->assertEquals( 'Test', $out->post_title );
-                $this->assertEquals( 'page', $out->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_deletePost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_invalid_post() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-                $post_id = $this->factory->post->create();
-
-                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_post_deleted() {
-                $this->make_user_by_role( 'editor' );
-                $post_id = $this->factory->post->create();
-
-                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue( $result );
-
-                $post = get_post( $post_id );
-                $this->assertEquals( 'trash', $post->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_deleteTerm extends WP_XMLRPC_UnitTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_empty_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_invalid_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-                $this->assertEquals( __('Invalid term ID'), $result->message );
-        }
-
-        function test_term_deleted() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertInternalType( 'boolean', $result );
-        }
-}
</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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_editPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_edit_own_post() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' => $new_title );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $new_title, $out->post_title );
-        }
-
-        function test_capable_edit_others_post() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' => $new_title );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $new_title, $out->post_title );
-        }
-
-        function test_incapable_edit_others_post() {
-                $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $original_title = 'Post test';
-                $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $new_title = 'Post test (updated)';
-                $post2 = array( 'post_title' => $new_title );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $original_title, $out->post_title );
-        }
-
-        function test_capable_reassign_author() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_author' => $author_id );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $author_id, $out->post_author );
-        }
-
-        function test_incapable_reassign_author() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
-                $post_id = wp_insert_post( $post );
-
-                $post2 = array( 'post_author' => $author_id );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $contributor_id, $out->post_author );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
-                $post_id = wp_insert_post( $post );
-
-                $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $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' => $attachment_id );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // fetch the post to verify that it appears
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertArrayHasKey( 'post_thumbnail', $result );
-                $this->assertInternalType( 'array', $result['post_thumbnail'] );
-                $this->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' => 'Updated post' );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // create another attachment
-                $attachment2 = array_merge( $attachment, array( 'post_title' => 'Post Thumbnail 2' ) );
-                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
-
-                // change the post's post_thumbnail
-                $post4 = array( 'post_thumbnail' => $attachment2_id );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // unset the post's post_thumbnail
-                $post5 = array( 'post_thumbnail' => '' );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
-
-                // use invalid ID
-                $post6 = array( 'post_thumbnail' => 398420983409 );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_edit_custom_fields() {
-                $contributor_id = $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Post test', 'post_author' => $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' => $new_title,
-                        'custom_fields' =>
-                                array(
-                                        array( 'id' => $mid_delete ),
-                                        array( 'id' => $mid_edit, 'key' => 'custom_field_key', 'value' => '87654321' ),
-                                        array( 'key' => 'custom_field_to_create', 'value' => '12345678' )
-                                )
-                );
-
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue($result);
-
-                $out = wp_get_single_post( $post_id );
-                $this->assertEquals( $new_title, $out->post_title );
-
-                $edited_object = get_metadata_by_mid( 'post', $mid_edit );
-                $this->assertEquals( '87654321', $edited_object->meta_value );
-                $this->assertFalse( get_metadata_by_mid( 'post', $mid_delete ) );
-
-                $created_object = get_post_meta( $post_id, 'custom_field_to_create', true );
-                $this->assertEquals( $created_object, '12345678' );
-        }
-
-        function test_capable_unsticky() {
-                $editor_id = $this->make_user_by_role( 'editor' );
-
-                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
-                stick_post( $post_id );
-
-                $post2 = array( 'sticky' => false );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->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->make_user_by_role( 'editor' );
-                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
-                stick_post( $post_id );
-
-                $post2 = array( 'post_password' => 'foobar', 'sticky' => false );
-                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->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>-<?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->parent_term = wp_insert_term( 'parent' . rand_str() , 'category' );
-                $this->child_term = wp_insert_term( 'child' . rand_str() , 'category' );
-                $this->post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'not_existing' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'category' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to edit terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_term_not_exists() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-                $this->assertEquals( __( 'Invalid term ID' ), $result->message );
-        }
-
-        function test_empty_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_empty_term_name() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->parent_term['term_id'], array( 'taxonomy' => 'category', 'name' => '' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
-        }
-
-        function test_parent_for_nonhierarchical() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->post_tag['term_id'], array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term['term_id'] ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( "This taxonomy is not hierarchical so you can't set a parent." ), $result->message );
-        }
-
-        function test_parent_empty() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_parent_invalid() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-        }
-
-        function test_parent_not_existing() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
-        }
-
-        function test_parent_duplicate_slug() {
-                $this->make_user_by_role( 'editor' );
-
-                $parent_term = get_term_by( 'id', $this->parent_term['term_id'], 'category' );
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( htmlspecialchars( sprintf( __('The slug &#8220;%s&#8221; is already in use by another term'), $parent_term->slug ) ), $result->message );
-        }
-
-        function test_edit_all_fields() {
-                $this->make_user_by_role( 'editor' );
-
-                $fields = array( 'taxonomy' => 'category', 'name' => 'Child 2', 'parent' => $this->parent_term['term_id'], 'description' => 'Child term', 'slug' => 'child_2' );
-                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], $fields ) );
-
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->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>-<?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->post_id = $this->factory->post->create();
-
-                $this->parent_comment_data = array(
-                        'comment_post_ID' => $this->post_id,
-                        'comment_author' => 'Test commenter',
-                        'comment_author_url' => 'http://example.com/',
-                        'comment_author_email' => 'example@example.com',
-                        'comment_content' => rand_str( 100 ),
-                );
-                $this->parent_comment_id = wp_insert_comment( $this->parent_comment_data );
-
-                $this->child_comment_data = array(
-                        'comment_post_ID' => $this->post_id,
-                        'comment_author' => 'Test commenter 2',
-                        'comment_author_url' => 'http://example.org/',
-                        'comment_author_email' => 'example@example.org',
-                        'comment_parent' => $this->parent_comment_id,
-                        'comment_content' => rand_str( 100 )
-                );
-                $this->child_comment_id = wp_insert_comment( $this->child_comment_data );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', $this->parent_comment_id ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'contributor' );
-
-                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', $this->parent_comment_id ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_valid_comment() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->parent_comment_id ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this->assertInternalType( 'string', $result['user_id'] );
-                $this->assertInternalType( 'string', $result['comment_id'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this->assertInternalType( 'string', $result['parent'] );
-                $this->assertInternalType( 'string', $result['status'] );
-                $this->assertInternalType( 'string', $result['content'] );
-                $this->assertInternalType( 'string', $result['link'] );
-                $this->assertInternalType( 'string', $result['post_id'] );
-                $this->assertInternalType( 'string', $result['post_title'] );
-                $this->assertInternalType( 'string', $result['author'] );
-                $this->assertInternalType( 'string', $result['author_url'] );
-                $this->assertInternalType( 'string', $result['author_email'] );
-                $this->assertInternalType( 'string', $result['author_ip'] );
-                $this->assertInternalType( 'string', $result['type'] );
-
-                // Check expected values
-                $this->assertStringMatchesFormat( '%d', $result['user_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['comment_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['parent'] );
-                $this->assertStringMatchesFormat( '%d', $result['post_id'] );
-                $this->assertEquals( $this->parent_comment_id, $result['comment_id'] );
-                $this->assertEquals( 0, $result['parent'] );
-                $this->assertEquals( $this->parent_comment_data['comment_content'], $result['content'] );
-                $this->assertEquals( $this->post_id, $result['post_id'] );
-                $this->assertEquals( $this->parent_comment_data['comment_author'], $result['author'] );
-                $this->assertEquals( $this->parent_comment_data['comment_author_url'], $result['author_url'] );
-                $this->assertEquals( $this->parent_comment_data['comment_author_email'], $result['author_email'] );
-        }
-
-        function test_valid_child_comment() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->child_comment_id ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertEquals( $this->child_comment_id, $result['comment_id'] );
-                $this->assertEquals( $this->parent_comment_id, $result['parent'] );
-        }
-
-        function test_invalid_id() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getComments extends WP_XMLRPC_UnitTestCase {
-        var $post_id;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->post_id = $this->factory->post->create();
-                $this->factory->comment->create_post_comments( $this->post_id, 15 );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'contributor' );
-
-                $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_user() {
-                $this->make_user_by_role( 'editor' );
-
-                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $comment = get_comment( $result['comment_id'], ARRAY_A );
-                        $this->assertEquals( $comment['comment_post_ID'], $result['post_id'] );
-                }
-        }
-
-        function test_post_filter() {
-                $this->make_user_by_role( 'editor' );
-
-                $filter = array(
-                        'post_id' => $this->post_id
-                );
-                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $this->assertEquals( $this->post_id, $result['post_id'] );
-                }
-        }
-
-        function test_number_filter() {
-                $this->make_user_by_role( 'editor' );
-
-                $filter = array(
-                        'post_id' => $this->post_id,
-                );
-                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                // if no 'number' filter is specified, default should be 10
-                $this->assertEquals( 10, count( $results ) );
-
-                // explicitly set a 'number' filter and verify that only that many are returned
-                $filter['number'] = 5;
-                $results2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
-                $this->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>-<?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->post_id = wp_insert_post( array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str(),
-                        'post_status' => '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->attachment_data = array(
-                        'post_title' => basename( $upload['file'] ),
-                        'post_content' => '',
-                        'post_type' => 'attachment',
-                        'post_parent' => $this->post_id,
-                        'post_mime_type' => $mime['type'],
-                        'guid' => $upload[ 'url' ]
-                );
-
-                $id = wp_insert_attachment( $this->attachment_data, $upload[ 'file' ], $this->post_id );
-                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
-                $this->attachment_id = $id;
-
-                set_post_thumbnail( $this->post_id, $this->attachment_id );
-        }
-
-        function tearDown() {
-                remove_theme_support( 'post-thumbnails' );
-
-                parent::tearDown();
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_valid_media_item() {
-                $this->make_user_by_role( 'author' );
-
-                $fields = array( 'post' );
-                $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this->assertInternalType( 'string', $result['attachment_id'] );
-                $this->assertInternalType( 'int', $result['parent'] );
-                $this->assertInternalType( 'string', $result['title'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-                $this->assertInternalType( 'string', $result['caption'] );
-                $this->assertInternalType( 'string', $result['description'] );
-                $this->assertInternalType( 'string', $result['link'] );
-                $this->assertInternalType( 'string', $result['thumbnail'] );
-                $this->assertInternalType( 'array', $result['metadata'] );
-
-                // Check expected values
-                $this->assertStringMatchesFormat( '%d', $result['attachment_id'] );
-                $this->assertEquals( $this->attachment_data['post_title'], $result['title'] );
-                $this->assertEquals( wp_get_attachment_url( $this->attachment_id ), $result['link'] );
-                $this->assertEquals( wp_get_attachment_thumb_url( $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getOptions extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_valid_username_password() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
-                $this->assertInternalType( 'array', $result );
-                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
-        }
-
-        function test_option_value() {
-                $this->make_user_by_role( 'administrator' );
-
-                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
-                $this->assertInternalType( 'array', $result );
-
-                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this->assertFalse( $result['default_comment_status']['readonly'] );
-        }
-
-        /**
-         * @ticket 20201
-         */
-        function test_option_values_subscriber() {
-                global $wp_version;
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
-                $this->assertInternalType( 'array', $result );
-
-                // Read Only options
-                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
-                $this->assertTrue( $result['software_name']['readonly'] );
-
-                $this->assertEquals( $wp_version, $result['software_version']['value'] );
-                $this->assertTrue( $result['software_version']['readonly'] );
-
-                /* TODO: Gives junk data in Test Environment
-                $this->assertEquals( get_site_url(), $result['site-url']['value'] );
-                $this->assertTrue( $result['site-url']['readonly'] );
-                */
-
-                $this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
-                $this->assertTrue( $result['image_default_link_type']['readonly'] );
-
-                $this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
-                $this->assertTrue( $result['image_default_size']['readonly'] );
-
-                $this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
-                $this->assertTrue( $result['image_default_align']['readonly'] );
-
-                $this->assertEquals( get_template(), $result['template']['value'] );
-                $this->assertTrue( $result['template']['readonly'] );
-
-                $this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
-                $this->assertTrue( $result['stylesheet']['readonly'] );
-
-                $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
-                $this->assertTrue( $result['post_thumbnail']['readonly'] );
-
-                // Updatable options
-                $this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
-                $this->assertTrue( $result['time_zone']['readonly'] );
-
-                $this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
-                $this->assertTrue( $result['blog_title']['readonly'] );
-
-                $this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
-                $this->assertTrue( $result['blog_tagline']['readonly'] );
-
-                $this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
-                $this->assertTrue( $result['date_format']['readonly'] );
-
-                $this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
-                $this->assertTrue( $result['time_format']['readonly'] );
-
-                $this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
-                $this->assertTrue( $result['users_can_register']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
-                $this->assertTrue( $result['thumbnail_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
-                $this->assertTrue( $result['thumbnail_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
-                $this->assertTrue( $result['thumbnail_crop']['readonly'] );
-
-                $this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
-                $this->assertTrue( $result['medium_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
-                $this->assertTrue( $result['medium_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
-                $this->assertTrue( $result['large_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
-                $this->assertTrue( $result['large_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this->assertTrue( $result['default_comment_status']['readonly'] );
-
-                $this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
-                $this->assertTrue( $result['default_ping_status']['readonly'] );
-        }
-
-        function test_option_values_admin() {
-                global $wp_version;
-
-                $this->make_user_by_role( 'administrator' );
-
-                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator' ) );
-                $this->assertInternalType( 'array', $result );
-
-                // Read Only options
-                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
-                $this->assertTrue( $result['software_name']['readonly'] );
-
-                $this->assertEquals( $wp_version, $result['software_version']['value'] );
-                $this->assertTrue( $result['software_version']['readonly'] );
-
-                /* TODO: Gives junk data in Test Environment
-                $this->assertEquals( get_site_url(), $result['site-url']['value'] );
-                $this->assertTrue( $result['site-url']['readonly'] );
-                */
-
-                $this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
-                $this->assertTrue( $result['image_default_link_type']['readonly'] );
-
-                $this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
-                $this->assertTrue( $result['image_default_size']['readonly'] );
-
-                $this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
-                $this->assertTrue( $result['image_default_align']['readonly'] );
-
-                $this->assertEquals( get_template(), $result['template']['value'] );
-                $this->assertTrue( $result['template']['readonly'] );
-
-                $this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
-                $this->assertTrue( $result['stylesheet']['readonly'] );
-
-                $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
-                $this->assertTrue( $result['post_thumbnail']['readonly'] );
-
-                // Updatable options
-                $this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
-                $this->assertFalse( $result['time_zone']['readonly'] );
-
-                $this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
-                $this->assertFalse( $result['blog_title']['readonly'] );
-
-                $this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
-                $this->assertFalse( $result['blog_tagline']['readonly'] );
-
-                $this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
-                $this->assertFalse( $result['date_format']['readonly'] );
-
-                $this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
-                $this->assertFalse( $result['time_format']['readonly'] );
-
-                $this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
-                $this->assertFalse( $result['users_can_register']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
-                $this->assertFalse( $result['thumbnail_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
-                $this->assertFalse( $result['thumbnail_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
-                $this->assertFalse( $result['thumbnail_crop']['readonly'] );
-
-                $this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
-                $this->assertFalse( $result['medium_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
-                $this->assertFalse( $result['medium_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
-                $this->assertFalse( $result['large_size_w']['readonly'] );
-
-                $this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
-                $this->assertFalse( $result['large_size_h']['readonly'] );
-
-                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
-                $this->assertFalse( $result['default_comment_status']['readonly'] );
-
-                $this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
-                $this->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>-<?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->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_type' => 'page',
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => $this->make_user_by_role( 'author' ),
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                wp_delete_post( $this->post_id );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        /**
-         * @ticket 20336
-         */
-        function test_invalid_pageid() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-        }
-
-        function test_valid_page() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this->assertInternalType( 'string', $result['userid'] );
-                $this->assertInternalType( 'int', $result['page_id'] );
-                $this->assertInternalType( 'string', $result['page_status'] );
-                $this->assertInternalType( 'string', $result['description'] );
-                $this->assertInternalType( 'string', $result['title'] );
-                $this->assertInternalType( 'string', $result['link'] );
-                $this->assertInternalType( 'string', $result['permaLink'] );
-                $this->assertInternalType( 'array', $result['categories'] );
-                $this->assertInternalType( 'string', $result['excerpt'] );
-                $this->assertInternalType( 'string', $result['text_more'] );
-                $this->assertInternalType( 'int', $result['mt_allow_comments'] );
-                $this->assertInternalType( 'int', $result['mt_allow_pings'] );
-                $this->assertInternalType( 'string', $result['wp_slug'] );
-                $this->assertInternalType( 'string', $result['wp_password'] );
-                $this->assertInternalType( 'string', $result['wp_author'] );
-                $this->assertInternalType( 'int', $result['wp_page_parent_id'] );
-                $this->assertInternalType( 'string', $result['wp_page_parent_title'] );
-                $this->assertInternalType( 'int', $result['wp_page_order'] );
-                $this->assertInternalType( 'string', $result['wp_author_id'] );
-                $this->assertInternalType( 'string', $result['wp_author_display_name'] );
-                $this->assertInternalType( 'array', $result['custom_fields'] );
-                $this->assertInternalType( 'string', $result['wp_page_template'] );
-
-                // Check expected values
-                $this->assertStringMatchesFormat( '%d', $result['userid'] );
-                $this->assertEquals( 'draft', $result['page_status'] );
-                $this->assertEquals( $this->post_data['post_title'], $result['title'] );
-                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
-                $this->assertEquals( $this->post_data['post_excerpt'], $result['excerpt'] );
-                $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
-        }
-
-        function test_date() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
-
-                $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
-                $this->assertEquals( $date_gmt, $result['date_created_gmt']->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>-<?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->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_type' => 'page',
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => $this->make_user_by_role( 'author' ),
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'contributor' );
-
-                $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_date() {
-                $this->make_user_by_role( 'editor' );
-
-                $results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $result ) {
-                        $page = get_post( $result->page_id );
-                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date, false ), 'Ymd\TH:i:s' ) );
-
-                        $this->assertInstanceOf( 'IXR_Date', $result->dateCreated );
-                        $this->assertInstanceOf( 'IXR_Date', $result->date_created_gmt );
-
-                        $this->assertEquals( strtotime( $page->post_date ), $result->dateCreated->getTimestamp() );
-                        $this->assertEquals( $date_gmt, $result->date_created_gmt->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>-<?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->post_date_ts = strtotime( '+1 day' );
- $this->post_data = array(
- 'post_type' => 'page',
- 'post_title' => rand_str(),
- 'post_content' => rand_str( 2000 ),
- 'post_excerpt' => rand_str( 100 ),
- 'post_author' => $this->make_user_by_role( 'administrator' ),
- 'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
- );
- $this->post_id = wp_insert_post( $this->post_data );
- $this->editor_id = $this->make_user_by_role( 'editor' );
- }
-
- function test_invalid_username_password() {
- $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) );
- $this->assertInstanceOf( 'IXR_Error', $result );
- $this->assertEquals( 403, $result->code );
- }
-
- function test_incapable_user() {
-                $this->make_user_by_role( 'contributor' );
-
- $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) );
- $this->assertInstanceOf( 'IXR_Error', $result );
- $this->assertEquals( 401, $result->code );
- }
-
- function test_capable_user() {
- $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) );
- $this->assertNotInstanceOf( 'IXR_Error', $results );
-
- foreach( $results as $result ) {
- $page = get_post( $result['page_id'] );
- $this->assertEquals( $page->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->editor_id && $args[0] == $this->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->myxmlrpcserver->wp_getPages( array( 1, 'editor', 'editor' ) );
- $this->assertNotInstanceOf( 'IXR_Error', $results );
-
- $found_incapable = false;
- foreach( $results as $result ) {
- // WP#20629
- $this->assertNotInstanceOf( 'IXR_Error', $result );
-
- if ( $result['page_id'] == $this->post_id ) {
- $found_incapable = true;
- break;
- }
- }
- $this->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>-<?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->post_date_ts = strtotime( '+1 day' );
-                $this->post_data = array(
-                        'post_title' => rand_str(),
-                        'post_content' => rand_str( 2000 ),
-                        'post_excerpt' => rand_str( 100 ),
-                        'post_author' => $this->make_user_by_role( 'author' ),
-                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
-                );
-                $this->post_id = wp_insert_post( $this->post_data );
-                $this->post_custom_field = array( 'key' => 'test_custom_field', 'value' => 12345678);
-                $this->post_custom_field['id'] = add_post_meta( $this->post_id, $this->post_custom_field['key'], $this->post_custom_field['value'] );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_valid_post() {
-                add_theme_support( 'post-thumbnails' );
-
-                $fields = array( 'post', 'custom_fields' );
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // Check data types
-                $this->assertInternalType( 'string', $result['post_id'] );
-                $this->assertInternalType( 'string', $result['post_title'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
-                $this->assertInternalType( 'string', $result['post_status'] );
-                $this->assertInternalType( 'string', $result['post_type'] );
-                $this->assertInternalType( 'string', $result['post_name'] );
-                $this->assertInternalType( 'string', $result['post_author'] );
-                $this->assertInternalType( 'string', $result['post_password'] );
-                $this->assertInternalType( 'string', $result['post_excerpt'] );
-                $this->assertInternalType( 'string', $result['post_content'] );
-                $this->assertInternalType( 'string', $result['link'] );
-                $this->assertInternalType( 'string', $result['comment_status'] );
-                $this->assertInternalType( 'string', $result['ping_status'] );
-                $this->assertInternalType( 'bool', $result['sticky'] );
-                $this->assertInternalType( 'string', $result['post_format'] );
-                $this->assertInternalType( 'array', $result['post_thumbnail'] );
-                $this->assertInternalType( 'array', $result['custom_fields'] );
-
-                // Check expected values
-                $this->assertStringMatchesFormat( '%d', $result['post_id'] );
-                $this->assertEquals( $this->post_data['post_title'], $result['post_title'] );
-                $this->assertEquals( 'draft', $result['post_status'] );
-                $this->assertEquals( 'post', $result['post_type'] );
-                $this->assertStringMatchesFormat( '%d', $result['post_author'] );
-                $this->assertEquals( $this->post_data['post_excerpt'], $result['post_excerpt'] );
-                $this->assertEquals( $this->post_data['post_content'], $result['post_content'] );
-                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
-                $this->assertEquals( $this->post_custom_field['id'], $result['custom_fields'][0]['id'] );
-                $this->assertEquals( $this->post_custom_field['key'], $result['custom_fields'][0]['key'] );
-                $this->assertEquals( $this->post_custom_field['value'], $result['custom_fields'][0]['value'] );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_no_fields() {
-                $fields = array();
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // when no fields are requested, only the IDs should be returned
-                $this->assertEquals( 1, count( $result ) );
-                $this->assertEquals( array( 'post_id' ), array_keys( $result ) );
-        }
-
-        function test_default_fields() {
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertArrayHasKey( 'post_id', $result );
-                $this->assertArrayHasKey( 'link', $result ); // random field from 'posts' group
-                $this->assertArrayHasKey( 'terms', $result );
-                $this->assertArrayHasKey( 'custom_fields', $result );
-        }
-
-        function test_date() {
-                $fields = array( 'post' );
-                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
-                $this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
-
-                $this->assertEquals( $this->post_date_ts, $result['post_date']->getTimestamp() );
-                $this->assertEquals( $this->post_date_ts, $result['post_modified']->getTimestamp() );
-
-                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->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->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
-
-                $this->assertEquals( $post_date_gmt, $result['post_date_gmt']->getTimestamp() );
-                $this->assertEquals( $post_modified_gmt, $result['post_modified_gmt']->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPostType extends WP_XMLRPC_UnitTestCase {
-        var $cpt_name;
-        var $cpt_args;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->cpt_name = 'post_type_test';
-                $this->cpt_args = array(
-                        'public' => false,
-                        'show_ui' => true,
-                        'show_in_menu' => true,
-                        'menu_position' => 7,
-                        'menu_icon' => 'cpt_icon.png',
-                        'taxonomies' => array( 'category', 'post_tag' ),
-                        'hierarchical' => true
-                );
-                register_post_type( $this->cpt_name, $this->cpt_args );
-        }
-
-        function tearDown() {
-                _unregister_post_type( $this->cpt_name );
-
-                parent::tearDown();
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'username', 'password', 'post' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_invalid_post_type_name() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_valid_post_type_name() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_valid_type() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // check data types
-                $this->assertInternalType( 'string', $result['name'] );
-                $this->assertInternalType( 'string', $result['label'] );
-                $this->assertInternalType( 'bool', $result['hierarchical'] );
-                $this->assertInternalType( 'bool', $result['public'] );
-                $this->assertInternalType( 'bool', $result['_builtin'] );
-                $this->assertInternalType( 'bool', $result['map_meta_cap'] );
-                $this->assertInternalType( 'bool', $result['has_archive'] );
-                $this->assertInternalType( 'bool', $result['show_ui'] );
-                $this->assertInternalType( 'int', $result['menu_position'] );
-                $this->assertInternalType( 'string', $result['menu_icon'] );
-                $this->assertInternalType( 'array', $result['labels'] );
-                $this->assertInternalType( 'array', $result['cap'] );
-                $this->assertInternalType( 'array', $result['taxonomies'] );
-                $this->assertInternalType( 'array', $result['supports'] );
-
-                // check label data types
-                $this->assertInternalType( 'string', $result['labels']['name'] );
-                $this->assertInternalType( 'string', $result['labels']['singular_name'] );
-                $this->assertInternalType( 'string', $result['labels']['add_new'] );
-                $this->assertInternalType( 'string', $result['labels']['add_new_item'] );
-                $this->assertInternalType( 'string', $result['labels']['edit_item'] );
-                $this->assertInternalType( 'string', $result['labels']['new_item'] );
-                $this->assertInternalType( 'string', $result['labels']['view_item'] );
-                $this->assertInternalType( 'string', $result['labels']['search_items'] );
-                $this->assertInternalType( 'string', $result['labels']['not_found'] );
-                $this->assertInternalType( 'string', $result['labels']['not_found_in_trash'] );
-                $this->assertInternalType( 'string', $result['labels']['parent_item_colon'] );
-                $this->assertInternalType( 'string', $result['labels']['all_items'] );
-                $this->assertInternalType( 'string', $result['labels']['menu_name'] );
-                $this->assertInternalType( 'string', $result['labels']['name_admin_bar'] );
-
-                // check cap data types
-                $this->assertInternalType( 'string', $result['cap']['edit_post'] );
-                $this->assertInternalType( 'string', $result['cap']['read_post'] );
-                $this->assertInternalType( 'string', $result['cap']['delete_post'] );
-                $this->assertInternalType( 'string', $result['cap']['edit_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['edit_others_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['publish_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['read_private_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['read'] );
-                $this->assertInternalType( 'string', $result['cap']['delete_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['delete_private_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['delete_published_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['delete_others_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['edit_private_posts'] );
-                $this->assertInternalType( 'string', $result['cap']['edit_published_posts'] );
-
-                // check taxonomy data types
-                foreach ( $result['taxonomies'] as $taxonomy ) {
-                        $this->assertInternalType( 'string', $taxonomy );
-                }
-
-                // check taxonomy data types
-                foreach ( $result['supports'] as $key => $value ) {
-                        $this->assertInternalType( 'string', $key );
-                        $this->assertInternalType( 'bool', $value );
-                }
-
-                // Check expected values
-                $this->assertEquals( $this->cpt_name, $result['name'] );
-                foreach ( $this->cpt_args as $key => $value ) {
-                        $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertInternalType( 'array', $result );
-                $this->assertEquals( 0, count( $result ) );
-        }
-
-        function test_capable_user() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertInternalType( 'array', $result );
-                $this->assertGreaterThan( 0, count( $result ) );
-        }
-
-        function test_simple_filter() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertInternalType( 'array', $result );
-
-                // verify that pages is in the result, and post is not
-                $result_names = wp_list_pluck( $result, 'name' );
-                $this->assertContains( 'page', $result_names );
-                $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getPosts extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        /**
-         * @ticket 20991
-         */
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $filter = array( 'post_type' => 'page' );
-                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_user() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_invalid_post_type() {
-                $this->make_user_by_role( 'editor' );
-
-                $filter = array( 'post_type' => 'invalid_post_type_name' );
-                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_filters() {
-                $this->make_user_by_role( 'editor' );
-
-                $cpt_name = 'test_wp_getposts_cpt';
-                register_post_type( $cpt_name, array(
-                        'taxonomies' => array( 'post_tag', 'category' ),
-                        'public' => true
-                ));
-
-                $num_posts = 17;
-                $post_ids = $this->factory->post->create_many( $num_posts, array( 'post_type' => $cpt_name ) );
-
-                // get them all
-                $filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 );
-                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertEquals( $num_posts, count( $results ) );
-
-                // page through results
-                $posts_found = array();
-                $filter['number'] = 5;
-                $filter['offset'] = 0;
-                do {
-                        $presults = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
-                        foreach( $presults as $post ) {
-                                $posts_found[] = $post['post_id'];
-                        }
-                        $filter['offset'] += $filter['number'];
-                } while ( count( $presults ) > 0 );
-                // verify that $post_ids matches $posts_found
-                $this->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->factory->comment->create_post_comments( $post, rand( 1, 20 ) );
-                }
-
-                // get results ordered by comment count
-                $filter2 = array( 'post_type' => $cpt_name, 'number' => $num_posts, 'orderby' => 'comment_count', 'order' => 'DESC' );
-                $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
-                $last_comment_count = 100;
-                foreach ( $results2 as $post ) {
-                        $comment_count = intval( get_comments_number( $post['post_id'] ) );
-                        $this->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->post_status = 'draft';
-                wp_update_post( $post );
-                $filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );
-                $results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
-                $this->assertEquals( 1, count( $results3 ) );
-                $this->assertEquals( $post->ID, $results3[0]['post_id'] );
-
-                _unregister_post_type( $cpt_name );
-        }
-
-        function test_fields() {
-                $this->make_user_by_role( 'editor' );
-                $this->factory->post->create();
-
-                // check default fields
-                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
-                $this->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->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->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
-                $expected_fields = array_merge( $fields, array( 'post_id' ) );
-                foreach ( array_keys( $results2[0] ) as $field ) {
-                        $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getTaxonomies extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_taxonomy_validated() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-}
</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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_taxonomy_validated() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_prepare_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
-                $taxonomy = get_taxonomy( 'category' );
-                $this->assertEquals( 'category', $result['name'], 'name' );
-                $this->assertEquals( true, $result['_builtin'], '_builtin' );
-                $this->assertEquals( $taxonomy->show_ui, $result['show_ui'], 'show_ui' );
-                $this->assertEquals( $taxonomy->public, $result['public'], 'public' );
-                $this->assertEquals( $taxonomy->hierarchical, $result['hierarchical'], 'hierarchical' );
-                $this->assertEquals( (array) $taxonomy->labels, $result['labels'], 'labels' );
-                $this->assertEquals( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
-                $this->assertEquals( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
-        }
-}
</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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getTerm extends WP_XMLRPC_UnitTestCase {
-        var $term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-
-        function test_empty_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( __('Empty Term'), $result->message );
-        }
-
-        function test_invalid_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-                $this->assertEquals( __('Invalid term ID'), $result->message );
-        }
-
-        function test_valid_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $term = get_term( $this->term['term_id'], 'category', ARRAY_A );
-
-                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
-
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $result, $term );
-
-                // Check DataTypes
-                $this->assertInternalType( 'string', $result['name'] );
-                $this->assertInternalType( 'string', $result['slug'] );
-                $this->assertInternalType( 'string', $result['taxonomy'] );
-                $this->assertInternalType( 'string', $result['description'] );
-                $this->assertInternalType( 'int', $result['count'] );
-
-                // We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
-                $this->assertStringMatchesFormat( '%d', $result['term_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['term_group'] );
-                $this->assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
-                $this->assertStringMatchesFormat( '%d', $result['parent'] );
-
-                // Check Data
-                $this->assertEquals( 0, $result['count'] );
-                $this->assertEquals( $term['name'], $result['name'] );
-                $this->assertEquals( $term['slug'], $result['slug'] );
-                $this->assertEquals( 'category', $result['taxonomy'] );
-                $this->assertEquals( $term['description'], $result['description'] );
-        }
-}
</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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_getTerms extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_valid_terms() {
-                $this->make_user_by_role( 'editor' );
-
-                // make sure there's at least one category
-                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
-
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                foreach( $results as $term ) {
-                        $this->assertInternalType( 'int', $term['count'] );
-
-                        // We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
-                        $this->assertStringMatchesFormat( '%d', $term['term_id'] );
-                        $this->assertStringMatchesFormat( '%d', $term['term_group'] );
-                        $this->assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
-                        $this->assertStringMatchesFormat( '%d', $term['parent'] );
-                }
-        }
-
-        function test_custom_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                // create a taxonomy and some terms for it
-                $tax_name = 'wp_getTerms_custom_taxonomy';
-                $num_terms = 12;
-                register_taxonomy( $tax_name, 'post' );
-                for( $i = 0; $i < $num_terms; $i++ )
-                        wp_insert_term( rand_str( 10 ), $tax_name );
-
-
-                // test fetching all terms
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-
-                $this->assertEquals( $num_terms, count( $results ) );
-                foreach ( $results as $term ) {
-                        $this->assertEquals( $tax_name, $term['taxonomy'] );
-                }
-
-                // test paged results
-                $filter = array( 'number' => 5 );
-                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertEquals( 5, count( $results2 ) );
-                $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
-
-                $filter['offset'] = 10;
-                $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
-                $this->assertEquals( $num_terms - 10, count( $results3 ) );
-                $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
-
-                // test hide_empty (since none have been attached to posts yet, all should be hidden
-                $filter = array( 'hide_empty' => true );
-                $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results4 );
-                $this->assertEquals( 0, count( $results4 ) );
-
-                unset($GLOBALS['wp_taxonomies'][$tax_name]);
-        }
-
-        function test_term_ordering() {
-                $this->make_user_by_role( 'editor' );
-
-                $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
-                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
-
-                $this->factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
-                $this->factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
-
-                $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertNotEquals( 0, count( $results ) );
-
-                foreach( $results as $term ) {
-                        if ( $term['term_id'] == $cat1 ) {
-                                break; // found cat1 first as expected
-                        }
-                        else if ( $term['term_id'] == $cat2 ) {
-                                $this->assertFalse( false, 'Incorrect category ordering.' );
-                        }
-                }
-        }
-
-        function test_terms_search() {
-                $this->make_user_by_role( 'editor' );
-
-                $name = rand_str( 30 );
-                $name_id = wp_create_category( $name );
-
-                // search by full name
-                $filter = array( 'search' => $name );
-                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results );
-                $this->assertEquals( 1, count( $results ) );
-                $this->assertEquals( $name, $results[0]['name'] );
-                $this->assertEquals( $name_id, $results[0]['term_id'] );
-
-                // search by partial name
-                $filter = array( 'search' => substr( $name, 0, 10 ) );
-                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
-                $this->assertEquals( 1, count( $results2 ) );
-                $this->assertEquals( $name, $results2[0]['name'] );
-                $this->assertEquals( $name_id, $results2[0]['term_id'] );
-        }
-}
</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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_newPost extends WP_XMLRPC_UnitTestCase {
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_no_content() {
-                $this->make_user_by_role( 'author' );
-
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-                $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
-        }
-
-        function test_basic_content() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Test' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_ignore_id() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Test', 'ID' => 103948 );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertNotEquals( '103948', $result );
-        }
-
-        function test_capable_publish() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_publish() {
-                $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_private() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_private() {
-                $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_other_author() {
-                $other_author_id = $this->make_user_by_role( 'author' );
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-        }
-
-        function test_incapable_other_author() {
-                $other_author_id = $this->make_user_by_role( 'author' );
-                $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_invalid_author() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_author' => 99999999 );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 404, $result->code );
-        }
-
-        function test_empty_author() {
-                $my_author_id = $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Test' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-
-                $out = wp_get_single_post( $result );
-                $this->assertEquals( $my_author_id, $out->post_author );
-                $this->assertEquals( 'Test', $out->post_title );
-        }
-
-        function test_post_thumbnail() {
-                add_theme_support( 'post-thumbnails' );
-
-                $this->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->assertTrue( empty( $upload['error'] ) );
-
-                $attachment = array(
-                        'post_title' => 'Post Thumbnail',
-                        'post_type' => 'attachment',
-                        'post_mime_type' => 'image/jpeg',
-                        'guid' => $upload['url']
-                );
-                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
-
-                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
-
-                remove_theme_support( 'post-thumbnails' );
-        }
-
-        function test_invalid_post_status() {
-                $this->make_user_by_role( 'author' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 'draft', get_post_status( $result ) );
-        }
-
-        function test_incapable_sticky() {
-                $this->make_user_by_role( 'contributor' );
-
-                $post = array( 'post_title' => 'Test', 'sticky' => true );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_capable_sticky() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'sticky' => true );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertTrue( is_sticky( $result ) );
-        }
-
-        function test_private_sticky() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-        }
-
-        function test_post_format() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_format' => 'quote' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 'quote', get_post_format( $result ) );
-        }
-
-        function test_invalid_post_format() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( '', get_post_format( $result ) );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array(
-                        'post_title' => 'Test',
-                        'terms' => array(
-                                'foobar_nonexistant' => array( 1 )
-                        )
-                );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-
-                $post2 = array(
-                        'post_title' => 'Test',
-                        'terms_names' => array(
-                                'foobar_nonexistant' => array( 1 )
-                        )
-                );
-                $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result2 );
-                $this->assertEquals( 401, $result2->code );
-        }
-
-        function test_invalid_term_id() {
-                $this->make_user_by_role( 'editor' );
-
-                $post = array(
-                        'post_title' => 'Test',
-                        'terms' => array(
-                                'post_tag' => array( 1390490823409 )
-                        )
-                );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_terms() {
-                $this->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' => 'Test',
-                        'terms' => array(
-                                'post_tag' => array( $tag2['term_id'], $tag3['term_id'] )
-                        )
-                );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' => 'ids' ) );
-                $this->assertNotContains( $tag1['term_id'], $post_tags );
-                $this->assertContains( $tag2['term_id'], $post_tags );
-                $this->assertContains( $tag3['term_id'], $post_tags );
-        }
-
-        function test_terms_names() {
-                $this->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' => 'Test',
-                        'terms_names' => array(
-                                'category' => array( $cat1_name, $cat2_name )
-                        )
-                );
-                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                // verify that cat2 was created
-                $cat2 = get_term_by( 'name', $cat2_name, 'category' );
-                $this->assertNotEmpty( $cat2 );
-                // check that both categories were set on the post
-                $post_cats = wp_get_object_terms( $result, 'category', array( 'fields' => 'ids' ) );
-                $this->assertContains( $cat1, $post_cats );
-                $this->assertContains( $cat2->term_id, $post_cats );
-
-                // create a second post attempting to use the ambiguous name
-                $post2 = array(
-                        'post_title' => 'Test',
-                        'terms_names' => array(
-                                'category' => array( $cat1_name, $ambiguous_name )
-                        )
-                );
-                $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
-                $this->assertInstanceOf( 'IXR_Error', $result2 );
-                $this->assertEquals( 401, $result2->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_newTerm extends WP_XMLRPC_UnitTestCase {
-        var $parent_term;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
-                $this->parent_term = $this->parent_term['term_id'];
-        }
-
-        function test_invalid_username_password() {
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-        }
-
-        function test_empty_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_invalid_taxonomy() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
-        }
-
-        function test_incapable_user() {
-                $this->make_user_by_role( 'subscriber' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 401, $result->code );
-                $this->assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result->message );
-        }
-
-        function test_empty_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
-        }
-
-        function test_parent_for_nonhierarchical() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message );
-        }
-
-        function test_parent_invalid() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 500, $result->code );
-        }
-
-        function test_parent_not_existing() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 403, $result->code );
-                $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
-        }
-
-
-        function test_add_term() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_add_term_with_parent() {
-                $this->make_user_by_role( 'editor' );
-
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->assertStringMatchesFormat( '%d', $result );
-        }
-
-        function test_add_term_with_all() {
-                $this->make_user_by_role( 'editor' );
-
-                $taxonomy = array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
-                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-                $this->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>-<?php
-
-/**
- * @group xmlrpc
- */
-class TestXMLRPCServer_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
-        function test_valid_attachment() {
-                $this->make_user_by_role( 'editor' );
-
-                // create attachment
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents( $filename );
-                $data = array(
-                        'name' => 'a2-small.jpg',
-                        'type' => 'image/jpeg',
-                        'bits' => base64_encode( $contents )
-                );
-
-
-                $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
-                $this->assertNotInstanceOf( 'IXR_Error', $result );
-
-                // check data types
-                $this->assertInternalType( 'string', $result['id'] );
-                $this->assertStringMatchesFormat( '%d', $result['id'] );
-                $this->assertInternalType( 'string', $result['file'] );
-                $this->assertInternalType( 'string', $result['url'] );
-                $this->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>-<?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(&$a, 'action'));
-                do_action($tag);
-
-                // only one event occurred for the hook, with empty args
-                $this->assertEquals(1, $a->get_call_count());
-                // only our hook was called
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                $args = array_pop($a->get_args());
-                $this->assertEquals(array(''), $args);
-        }
-
-        function test_remove_action() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'action'));
-                do_action($tag);
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the action, do it again, and make sure it's not called this time
-                remove_action($tag, array(&$a, 'action'));
-                do_action($tag);
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-        }
-
-        function test_has_action() {
-                        $tag = rand_str();
-                        $func = rand_str();
-
-                        $this->assertFalse( has_action($tag, $func) );
-                        $this->assertFalse( has_action($tag) );
-                        add_action($tag, $func);
-                        $this->assertEquals( 10, has_action($tag, $func) );
-                        $this->assertTrue( has_action($tag) );
-                        remove_action($tag, $func);
-                        $this->assertFalse( has_action($tag, $func) );
-                        $this->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(&$a1, 'action'));
-                add_action($tag, array(&$a2, 'action'));
-
-                do_action($tag);
-
-                // both actions called once each
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(1, $a2->get_call_count());
-        }
-
-        function test_action_args_1() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_action($tag, array(&$a, 'action'));
-                // call the action with a single argument
-                do_action($tag, $val);
-
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($val), array_pop($a->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(&$a1, 'action'), 10, 2);
-                add_action($tag, array(&$a2, 'action'));
-                // call the action with two arguments
-                do_action($tag, $val1, $val2);
-
-                // a1 should be called with both args
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(array($val1, $val2), array_pop($a1->get_args()));
-
-                // a2 should be called with one only
-                $this->assertEquals(1, $a2->get_call_count());
-                $this->assertEquals(array($val1), array_pop($a2->get_args()));
-        }
-
-        function test_action_priority() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'action'), 10);
-                add_action($tag, array(&$a, 'action2'), 9);
-                do_action($tag);
-
-                // two events, one per action
-                $this->assertEquals(2, $a->get_call_count());
-
-                $expected = array (
-                        // action2 is called first because it has priority 9
-                        array (
-                                'action' => 'action2',
-                                'tag' => $tag,
-                                'args' => array('')
-                        ),
-                        // action 1 is called second
-                        array (
-                                'action' => 'action',
-                                'tag' => $tag,
-                                'args' => array('')
-                        ),
-                );
-
-                $this->assertEquals($expected, $a->get_events());
-        }
-
-        function test_did_action() {
-                $tag1 = rand_str();
-                $tag2 = rand_str();
-
-                // do action tag1 but not tag2
-                do_action($tag1);
-                $this->assertEquals(1, did_action($tag1));
-                $this->assertEquals(0, did_action($tag2));
-
-                // do action tag2 a random number of times
-                $count = rand(0, 10);
-                for ($i=0; $i<$count; $i++)
-                        do_action($tag2);
-
-                // tag1's count hasn't changed, tag2 should be correct
-                $this->assertEquals(1, did_action($tag1));
-                $this->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(&$a, 'action'));
-                $this->assertEquals(10, has_filter('all', array(&$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->assertEquals(4, $a->get_call_count());
-                // only our hook was called
-                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
-
-                remove_action('all', array(&$a, 'action'));
-                $this->assertFalse(has_filter('all', array(&$a, 'action')));
-
-        }
-
-        function test_remove_all_action() {
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action('all', array(&$a, 'action'));
-                $this->assertEquals(10, has_filter('all', array(&$a, 'action')));
-                do_action($tag);
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the action, do it again, and make sure it's not called this time
-                remove_action('all', array(&$a, 'action'));
-                $this->assertFalse(has_filter('all', array(&$a, 'action')));
-                do_action($tag);
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-        }
-
-        function test_action_ref_array() {
-                $obj = new stdClass();
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'action'));
-
-                do_action_ref_array($tag, array(&$obj));
-
-                $args = $a->get_args();
-                $this->assertSame($args[0][0], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][0]->foo) );
-        }
-
-        /**
-         * @ticket 11241
-         */
-        function test_action_keyed_array() {
-                $a = new MockAction();
-
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'action'));
-
-                $context = array( rand_str() => rand_str() );
-                do_action($tag, $context);
-
-                $args = $a->get_args();
-                $this->assertSame($args[0][0], $context);
-
-                $context2 = array( rand_str() => rand_str(), rand_str() => rand_str() );
-                do_action($tag, $context2);
-
-                $args = $a->get_args();
-                $this->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>-<?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->assertSame( 10, has_action($tag, $closure) );
-
-                $context = array( rand_str(), rand_str() );
-                do_action($tag, $context[0], $context[1]);
-
-                $this->assertSame($GLOBALS[$context[0]], $context[1]);
-
-                $tag2 = rand_str();
-                $closure2 = function() { $GLOBALS['closure_no_args'] = true;};
-                add_action($tag2, $closure2);
-
-                $this->assertSame( 10, has_action($tag2, $closure2) );
-
-                do_action($tag2);
-
-                $this->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>-<?php
-
-/**
- * @group admin
- */
-class TestShortenUrl extends WP_UnitTestCase {
-        function test_shorten_url() {
-                $tests = array(
-                        // strip slashes
-                        'wordpress\.org/about/philosophy'
-                                => 'wordpress.org/about/philosophy', // strip slashes
-                        'http://wordpress.org/about/philosophy/'
-                                => 'wordpress.org/about/philosophy', // remove http, trailing slash
-                        'http://www.wordpress.org/about/philosophy/'
-                                => 'wordpress.org/about/philosophy', // remove http, www
-                        'http://wordpress.org/about/philosophy/#box'
-                                => 'wordpress.org/about/philosophy/#box', // don't shorten 35 characters
-                        'http://wordpress.org/about/philosophy/#decisions'
-                                => 'wordpress.org/about/philosophy/#...', // shorten to 32 if > 35 after cleaning
-                );
-                foreach ( $tests as $k => $v )
-                        $this->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>-<?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' => 'Hello Dolly',
-                        'Title' => '<a href="http://wordpress.org/#" title="Visit plugin homepage">Hello Dolly</a>',
-                        'PluginURI' => 'http://wordpress.org/#',
-                        'Description' => '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. <cite>By <a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>.</cite>',
-                        'Author' => '<a href="http://ma.tt/" title="Visit author homepage">Matt Mullenweg</a>',
-                        'AuthorURI' => 'http://ma.tt/',
-                        'Version' => '1.5.1',
-                        'TextDomain' => 'hello-dolly',
-                        'DomainPath' => ''
-                );
-
-                $this->assertTrue( is_array($data) );
-
-                foreach ($default_headers as $name => $value) {
-                        $this->assertTrue(isset($data[$name]));
-                        $this->assertEquals($value, $data[$name]);
-                }
-        }
-}
-
-/**
- * @group plugins
- * @group admin
- */
-class TestPluginMenus extends WP_UnitTestCase {
-
-        protected $current_user;
-
-        function setUp() {
-                parent::setUp();
-                $this->current_user = get_current_user_id();
-                // pages require manage_options, ensure we're an administrator
-                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                wp_set_current_user( $user_id );
-                update_option( 'siteurl', 'http://example.com' );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                wp_set_current_user( $this->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&#038;page=testpages';
-
-                foreach ($expected as $name => $value) {
-                        $this->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>-<?php
-
-/**
- * @group admin
- */
-class WPTestScreen extends WP_UnitTestCase {
-        var $core_screens = array(
-                'index.php' => array( 'base' => 'dashboard', 'id' => 'dashboard' ),
-                'edit.php' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post' ),
-                'post-new.php'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post' ),
-                'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
-                'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
-                'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
-                'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ),
-                'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
-                'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
-                'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),
-                'link-add.php' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link' ),
-                'edit-tags.php?taxonomy=link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category' ),
-                'edit-comments.php' => array( 'base' => 'edit-comments', 'id' => 'edit-comments' ),
-                'themes.php' => array( 'base' => 'themes', 'id' => 'themes' ),
-                'widgets.php' => array( 'base' => 'widgets', 'id' => 'widgets' ),
-                'nav-menus.php' => array( 'base' => 'nav-menus', 'id' => 'nav-menus' ),
-                'plugins.php' => array( 'base' => 'plugins', 'id' => 'plugins' ),
-                'users.php' => array( 'base' => 'users', 'id' => 'users' ),
-                'user-new.php' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user' ),
-                'profile.php' => array( 'base' => 'profile', 'id' => 'profile' ),
-                'tools.php' => array( 'base' => 'tools', 'id' => 'tools' ),
-                'import.php' => array( 'base' => 'import', 'id' => 'import' ),
-                'export.php' => array( 'base' => 'export', 'id' => 'export' ),
-                'options-general.php' => array( 'base' => 'options-general', 'id' => 'options-general' ),
-                'options-writing.php' => array( 'base' => 'options-writing', 'id' => '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->core_screens as $hook_name => $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->post_type ) )
-                                        $GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen->post_type;
-                        }
-
-                        $GLOBALS['hook_suffix'] = $hook['path'];
-                        set_current_screen();
-
-                        $this->assertEquals( $screen->id, $current_screen->id, $hook_name );
-                        $this->assertEquals( $screen->base, $current_screen->base, $hook_name );
-                        if ( isset( $screen->action ) )
-                                $this->assertEquals( $screen->action, $current_screen->action, $hook_name );
-                        if ( isset( $screen->post_type ) )
-                                $this->assertEquals( $screen->post_type, $current_screen->post_type, $hook_name );
-                        else
-                                $this->assertEmpty( $current_screen->post_type, $hook_name );
-                        if ( isset( $screen->taxonomy ) )
-                                $this->assertEquals( $screen->taxonomy, $current_screen->taxonomy, $hook_name );
-
-                        // With convert_to_screen(), the same ID should return the exact $current_screen.
-                        $this->assertSame( $current_screen, convert_to_screen( $screen->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->assertSame( $current_screen, convert_to_screen( $GLOBALS['hook_suffix'] ), $hook_name );
-                }
-        }
-
-        function test_post_type_as_hookname() {
-                $screen = convert_to_screen( 'page' );
-                $this->assertEquals( $screen->post_type, 'page' );
-                $this->assertEquals( $screen->base, 'post' );
-                $this->assertEquals( $screen->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->assertEquals( $screen->post_type, 'value-add' );
-                $this->assertEquals( $screen->base, 'post' );
-                $this->assertEquals( $screen->id, 'value-add' );
-
-                $screen = convert_to_screen( 'edit-value-add' ); // the -add part is key.
-                $this->assertEquals( $screen->post_type, 'value-add' );
-                $this->assertEquals( $screen->base, 'edit' );
-                $this->assertEquals( $screen->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->assertEquals( $screen->taxonomy, 'old-or-new' );
-                $this->assertEquals( $screen->base, 'edit-tags' );
-                $this->assertEquals( $screen->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->assertEquals( $screen->post_type, 'edit-some-thing' );
-                $this->assertEquals( $screen->base, 'post' );
-                $this->assertEquals( $screen->id, 'edit-some-thing' );
-
-                $screen = convert_to_screen( 'edit-edit-some-thing' );
-                $this->assertEquals( $screen->post_type, 'edit-some-thing' );
-                $this->assertEquals( $screen->base, 'edit' );
-                $this->assertEquals( $screen->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->assertEquals( $screen->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->assertEquals( $screen->base, 'post' );
-
-                // Core wins.
-                $screen = convert_to_screen( 'edit-tags' );
-                $this->assertEquals( $screen->base, 'edit-tags' );
-
-                $screen = convert_to_screen( 'tags' );
-                $this->assertEquals( $screen->base, 'post' );
-        }
-
-        function test_help_tabs() {
-                $tab = rand_str();
-                $tab_args = array(
-                        'id' => $tab,
-                        'title' => 'Help!',
-                        'content' => 'Some content',
-                        'callback' => false,
-                );
-
-                $screen = get_current_screen();
-                $screen->add_help_tab( $tab_args );
-                $this->assertEquals( $screen->get_help_tab( $tab ), $tab_args );
-
-                $tabs = $screen->get_help_tabs();
-                $this->assertArrayHasKey( $tab, $tabs );
-
-                $screen->remove_help_tab( $tab );
-                $this->assertNull( $screen->get_help_tab( $tab ) );
-
-                $screen->remove_help_tabs();
-                $this->assertEquals( $screen->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>-<?php
-/**
- * @group admin
- */
-class WPTestCheckedSelected extends WP_UnitTestCase {
-        function test_equal() {
-                $this->assertEquals(' selected=\'selected\'', selected('foo','foo',false));
-                $this->assertEquals(' checked=\'checked\'', checked('foo','foo',false));
-
-                $this->assertEquals(' selected=\'selected\'', selected('1',1,false));
-                $this->assertEquals(' checked=\'checked\'', checked('1',1,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected('1',true,false));
-                $this->assertEquals(' checked=\'checked\'', checked('1',true,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected(1,1,false));
-                $this->assertEquals(' checked=\'checked\'', checked(1,1,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected(1,true,false));
-                $this->assertEquals(' checked=\'checked\'', checked(1,true,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected(true,true,false));
-                $this->assertEquals(' checked=\'checked\'', checked(true,true,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected('0',0,false));
-                $this->assertEquals(' checked=\'checked\'', checked('0',0,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected(0,0,false));
-                $this->assertEquals(' checked=\'checked\'', checked(0,0,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected('',false,false));
-                $this->assertEquals(' checked=\'checked\'', checked('',false,false));
-
-                $this->assertEquals(' selected=\'selected\'', selected(false,false,false));
-                $this->assertEquals(' checked=\'checked\'', checked(false,false,false));
-        }
-
-        function test_notequal() {
-                $this->assertEquals('', selected('0','',false));
-                $this->assertEquals('', checked('0','',false));
-
-                $this->assertEquals('', selected(0,'',false));
-                $this->assertEquals('', checked(0,'',false));
-
-                $this->assertEquals('', selected(0,false,false));
-                $this->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>-<?php
-/**
- * @group themes
- */
-class TestPageTemplates extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this->theme_root = DIR_TESTDATA . '/themedir1';
-
-                $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
-                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
-
-                add_filter('theme_root', array(&$this, '_theme_root'));
-                add_filter( 'stylesheet_root', array(&$this, '_theme_root') );
-                add_filter( 'template_root', array(&$this, '_theme_root') );
-
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
-                remove_filter('theme_root', array(&$this, '_theme_root'));
-                remove_filter( 'stylesheet_root', array(&$this, '_theme_root') );
-                remove_filter( 'template_root', array(&$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->theme_root;
-        }
-
-        /**
-         * @ticket 10959
-         * @ticket 11216
-         */
-        function test_page_templates() {
-                $theme = get_theme('Page Template Theme');
-                $this->assertFalse( empty($theme) );
-
-                switch_theme($theme['Template'], $theme['Stylesheet']);
-
-                $templates = get_page_templates();
-                $this->assertEquals(3, count($templates));
-                $this->assertEquals("template-top-level.php", $templates['Top Level']);
-                $this->assertEquals("subdir/template-sub-dir.php", $templates['Sub Dir']);
-                $this->assertEquals("template-header.php", $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>-<?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->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // it's a non recurring event
-                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this->assertEquals( false, wp_next_scheduled($hook) );
-                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                // it's a non recurring event
-                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
-                // it's a recurring event
-                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                // these don't match so return nothing
-                $this->assertEquals( false, wp_next_scheduled($hook) );
-                $this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
-
-                $this->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->assertEquals( $timestamp, wp_next_scheduled($hook) );
-
-                // now unschedule it and make sure it's gone
-                wp_unschedule_event( $timestamp, $hook );
-                $this->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->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->assertTrue( wp_next_scheduled($hook) > 0 );
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
-
-                // clear the schedule for the no args events and make sure it's gone
-                wp_clear_scheduled_hook($hook);
-                $this->assertFalse( wp_next_scheduled($hook) );
-                // the args events should still be there
-                $this->assertTrue( wp_next_scheduled($hook, $args) > 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->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->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->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->assertEquals( $ts2, wp_next_scheduled($hook, $args) );
-                wp_unschedule_event( $ts2, $hook, $args );
-                // following event should be there too
-                $this->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(&$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_single_event( $timestamp, $hook, $args );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-
-                // run cron jobs
-                $this->_do_cron();
-
-                // our action should have been called once with the correct args
-                $this->assertEquals( 1, $a->get_call_count() );
-                $this->assertEquals( array($args), $a->get_args() );
-
-                // it shouldn't appear in the schedule anymore
-                $this->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(&$a, 'action'));
-
-                // schedule an event for 1 second ago
-                wp_schedule_event( $timestamp, $recur, $hook, $args );
-                $this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
-                $this->assertEquals( $recur, wp_get_schedule($hook, $args) );
-
-                // run cron jobs
-                $this->_do_cron();
-
-                // our action should have been called once with the correct args
-                $this->assertEquals( 1, $a->get_call_count() );
-                $this->assertEquals( array($args), $a->get_args() );
-
-                // it should appear in the schedule to run again in an hour's time
-                $this->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>-<?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->_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->_queries[] = $sql;
-                return $sql;
-        }
-
-        /**
-         * Test that floats formatted as "0,700" 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->markTestSkipped( 'No European languages available for testing' );
-
-                // Try an update query
-                $wpdb->suppress_errors( true );
-                $wpdb->update(
-                        'test_table',
-                        array( 'float_column' => 0.7 ),
-                        array( 'meta_id' => 5 ),
-                        array( '%f' ),
-                        array( '%d' )
-                );
-                $wpdb->suppress_errors( false );
-
-                // Ensure the float isn't 0,700
-                $this->assertContains( '0.700', array_pop( $this->_queries ) );
-
-                // Try a prepare
-                $sql = $wpdb->prepare( "UPDATE test_table SET float_column = %f AND meta_id = %d", 0.7, 5 );
-                $this->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>-<?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(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // only one event occurred for the hook, with empty args
-                $this->assertEquals(1, $a->get_call_count());
-                // only our hook was called
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                $args = array_pop($a->get_args());
-                $this->assertEquals(array($val), $args);
-        }
-
-        function test_remove_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter($tag, array(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter($tag, array(&$a, 'filter'));
-                $this->assertEquals($val, apply_filters($tag, $val));
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-        }
-
-        function test_has_filter() {
-                        $tag = rand_str();
-                        $func = rand_str();
-
-                        $this->assertFalse( has_filter($tag, $func) );
-                        $this->assertFalse( has_filter($tag) );
-                        add_filter($tag, $func);
-                        $this->assertEquals( 10, has_filter($tag, $func) );
-                        $this->assertTrue( has_filter($tag) );
-                        remove_filter($tag, $func);
-                        $this->assertFalse( has_filter($tag, $func) );
-                        $this->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(&$a1, 'filter'));
-                add_filter($tag, array(&$a2, 'filter'));
-
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // both filters called once each
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(1, $a2->get_call_count());
-        }
-
-        function test_filter_args_1() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-                $arg1 = rand_str();
-
-                add_filter($tag, array(&$a, 'filter'), 10, 2);
-                // call the filter with a single argument
-                $this->assertEquals($val, apply_filters($tag, $val, $arg1));
-
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($val, $arg1), array_pop($a->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(&$a1, 'filter'), 10, 3);
-                add_filter($tag, array(&$a2, 'filter'));
-                // call the filter with two arguments
-                $this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
-
-                // a1 should be called with both args
-                $this->assertEquals(1, $a1->get_call_count());
-                $this->assertEquals(array($val, $arg1, $arg2), array_pop($a1->get_args()));
-
-                // a2 should be called with one only
-                $this->assertEquals(1, $a2->get_call_count());
-                $this->assertEquals(array($val), array_pop($a2->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(&$a, 'filter'), 10);
-                add_filter($tag, array(&$a, 'filter2'), 9);
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // there should be two events, one per filter
-                $this->assertEquals(2, $a->get_call_count());
-
-                $expected = array (
-                        // filter2 is called first because it has priority 9
-                        array (
-                                'filter' => 'filter2',
-                                'tag' => $tag,
-                                'args' => array($val)
-                        ),
-                        // filter 1 is called second
-                        array (
-                                'filter' => 'filter',
-                                'tag' => $tag,
-                                'args' => array($val)
-                        ),
-                );
-
-                $this->assertEquals($expected, $a->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(&$a, 'filterall'));
-                // do some filters
-                $this->assertEquals($val, apply_filters($tag1, $val));
-                $this->assertEquals($val, apply_filters($tag2, $val));
-                $this->assertEquals($val, apply_filters($tag1, $val));
-                $this->assertEquals($val, apply_filters($tag1, $val));
-
-                // our filter should have been called once for each apply_filters call
-                $this->assertEquals(4, $a->get_call_count());
-                // the right hooks should have been called in order
-                $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
-
-                remove_filter('all', array(&$a, 'filterall'));
-                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
-
-        }
-
-        function test_remove_all_filter() {
-                $a = new MockAction();
-                $tag = rand_str();
-                $val = rand_str();
-
-                add_filter('all', array(&$a, 'filterall'));
-                $this->assertTrue( has_filter('all') );
-                $this->assertEquals( 10, has_filter('all', array(&$a, 'filterall')) );
-                $this->assertEquals($val, apply_filters($tag, $val));
-
-                // make sure our hook was called correctly
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-
-                // now remove the filter, do it again, and make sure it's not called this time
-                remove_filter('all', array(&$a, 'filterall'));
-                $this->assertFalse( has_filter('all', array(&$a, 'filterall')) );
-                $this->assertFalse( has_filter('all') );
-                $this->assertEquals($val, apply_filters($tag, $val));
-                // call cound should remain at 1
-                $this->assertEquals(1, $a->get_call_count());
-                $this->assertEquals(array($tag), $a->get_tags());
-        }
-
-        /**
-         * @ticket 9886
-         */
-        function test_filter_ref_array() {
-                $obj = new stdClass();
-                $a = new MockAction();
-                $tag = rand_str();
-
-                add_action($tag, array(&$a, 'filter'));
-
-                apply_filters_ref_array($tag, array(&$obj));
-
-                $args = $a->get_args();
-                $this->assertSame($args[0][0], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][0]->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(&$a, 'filter_append'), 10, 2);
-                add_action($tag, array(&$b, 'filter_append'), 10, 2);
-
-                $result = apply_filters_ref_array($tag, array('string', &$obj));
-
-                $this->assertEquals($result, 'string_append_append');
-
-                $args = $a->get_args();
-                $this->assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][1]->foo) );
-
-                $args = $b->get_args();
-                $this->assertSame($args[0][1], $obj);
-                // just in case we don't trust assertSame
-                $obj->foo = true;
-                $this->assertFalse( empty($args[0][1]->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>-<?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->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
-                        return;
-                }
-
-                $class = "WP_HTTP_" . $this->transport;
-                if ( !call_user_func( array($class, 'test') ) ) {
-                        $this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
-                }
-
-                // Disable all transports aside from this one.
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( "use_{$t}_transport", '__return_false' ); // Just strip them all
-                        if ( $t != $this->transport )
-                                add_filter( "use_{$t}_transport", '__return_false' ); // and add it back if need be..
-                }
-        }
-
-        function tearDown() {
-                foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
-                        remove_filter( "use_{$t}_transport", '__return_false' );
-                }
-        }
-
-        function test_redirect_on_301() {
-                // 5 : 5 & 301
-                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        function test_redirect_on_302() {
-                // 5 : 5 & 302
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 5) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_301_no_redirect() {
-                // 5 > 0 & 301
-                $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 0) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals(301, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_302_no_redirect() {
-                // 5 > 0 & 302
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals(302, (int)$res['response']['code'] );
-        }
-
-        function test_redirections_equal() {
-                // 5 - 5
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals(200, (int)$res['response']['code'] );
-        }
-
-        function test_no_head_redirections() {
-                // No redirections on HEAD request:
-                $res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 1, array('method' => 'HEAD') );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals( 302, (int)$res['response']['code'] );
-        }
-
-        /**
-         * @ticket 16855
-         */
-        function test_redirect_on_head() {
-                // Redirections on HEAD request when Requested
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5, 'method' => 'HEAD') );
-                $this->assertFalse( is_wp_error($res) );
-                $this->assertEquals( 200, (int)$res['response']['code'] );
-        }
-
-        function test_redirections_greater() {
-                // 10 > 5
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) );
-                $this->assertTrue( is_wp_error($res), print_r($res, true) );
-        }
-
-        function test_redirections_greater_edgecase() {
-                // 6 > 5 (close edgecase)
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) );
-                $this->assertTrue( is_wp_error($res) );
-        }
-
-        function test_redirections_less_edgecase() {
-                // 4 < 5 (close edgecase)
-                $res = wp_remote_request($this->redirection_script . '?rt=' . 4, array('redirection' => 5) );
-                $this->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->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
-                $this->assertFalse( is_wp_error($res) );
-                $this->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->redirection_script . '?200-location=true' );
-                $this->assertEquals( 'PASS', $res['body']);
-        }
-
-        /**
-         * @ticket 11888
-         */
-        function test_send_headers() {
-                // Test that the headers sent are recieved by the server
-                $headers = array('test1' => 'test', 'test2' => 0, 'test3' => '');
-                $res = wp_remote_request( $this->redirection_script . '?header-check', array('headers' => $headers) );
-
-                $this->assertFalse( is_wp_error($res) );
-
-                $headers = array();
-                foreach ( explode("\n", $res['body']) as $key => $value ) {
-                        if ( empty($value) )
-                                continue;
-                        $parts = explode(':', $value,2);
-                        unset($heaers[$key]);
-                        $headers[ $parts[0] ] = $parts[1];
-                }
-
-                $this->assertTrue( isset($headers['test1']) && 'test' == $headers['test1'] );
-                $this->assertTrue( isset($headers['test2']) && '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->assertTrue( isset($headers['test3']) && '' === $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' => true, 'timeout' => 30 ) ); //Auto generate the filename.
-
-                $this->assertFalse( is_wp_error( $res ) );
-                $this->assertEquals( '', $res['body'] ); // The body should be empty.
-                $this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
-                $this->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->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()" );
-                        return;
-                }
-
-                $actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
-                $this->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>-<?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->current_user = get_current_user_id();
-                wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
-        }
-
-        function tearDown() {
-                wp_set_current_user( $this->current_user );
-                parent::tearDown();
-        }
-
-        /**
-         * @ticket 21117
-         */
-        function test_content_post_type() {
-                register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
-
-                $admin_bar = new WP_Admin_Bar;
-
-                wp_admin_bar_new_content_menu( $admin_bar );
-
-                $nodes = $admin_bar->get_nodes();
-                $this->assertFalse( $nodes['new-content']->parent );
-                $this->assertEquals( 'new-content', $nodes['add-new-content']->parent );
-
-                _unregister_post_type( 'content' );
-        }
-
-        /**
-         * @ticket 21117
-         */
-        function test_merging_existing_meta_values() {
-                $admin_bar = new WP_Admin_Bar;
-
-                $admin_bar->add_node( array(
-                        'id' => 'test-node',
-                        'meta' => array( 'class' => 'test-class' ),
-                ) );
-                $node = $admin_bar->get_node( 'test-node' );
-                $this->assertEquals( array( 'class' => 'test-class' ), $node->meta );
-
-                $admin_bar->add_node( array(
-                        'id' => 'test-node',
-                        'meta' => array( 'some-meta' => 'value' ),
-                ) );
-
-                $node = $admin_bar->get_node( 'test-node' );
-                $this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node->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>-<?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->author_id = $this->factory->user->create( array(
-                        'role' => 'author',
-                        'user_login' => 'test_author',
-                        'description' => 'test_author',
-                ) );
-                $user = new WP_User( $this->author_id );
-
-                $post = array(
-                        'post_author' => $this->author_id,
-                        'post_status' => 'publish',
-                        'post_content' => rand_str(),
-                        'post_title' => rand_str(),
-                        'post_type' => 'post'
-                );
-
-                // insert a post and make sure the ID is ok
-                $this->post_id = $this->factory->post->create( $post );
-
-                setup_postdata( get_post( $this->post_id ) );
-        }
-
-        function tearDown() {
-                wp_reset_postdata();
-                parent::tearDown();
-        }
-
-        function test_get_the_author() {
-                $author_name = get_the_author();
-                $user = new WP_User( $this->author_id );
-
-                $this->assertEquals( $user->display_name, $author_name );
-                $this->assertEquals( 'test_author', $author_name );
-        }
-
-        function test_get_the_author_meta() {
-                $this->assertEquals( 'test_author', get_the_author_meta( 'login' ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
-
-                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                add_user_meta( $this->author_id, 'user_description', 'user description' );
-                $this->assertEquals( 'user description', get_user_meta( $this->author_id, 'user_description', true ) );
-                // user_description in meta is ignored. The content of description is returned instead.
-                // See #20285
-                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-                update_user_meta( $this->author_id, 'user_description', '' );
-                $this->assertEquals( '', get_user_meta( $this->author_id, 'user_description', true ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
-                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
-
-                $this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
-        }
-
-        function test_get_the_author_meta_no_authordata() {
-                unset( $GLOBALS['authordata'] );
-                $this->assertEquals( '', get_the_author_meta( 'id' ) );
-                $this->assertEquals( '', get_the_author_meta( 'user_login' ) );
-                $this->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>-<?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. <div><div>Test</div></div>
-        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->basic_single_tags as $tag ) {
-                        $this->assertEquals( "<$tag />", balanceTags( "<$tag>", 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->single_tags as $tag ) {
-                        $this->assertEquals( "<$tag />", balanceTags( "<$tag>", 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->basic_single_tags as $tag ) {
-                        $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", 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->single_tags as $tag ) {
-                        $this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", true ) );
-                }
-        }
-
-        /**
-         * @ticket 1597
-         */
-        function test_closes_unknown_single_tags_with_closing_tag() {
-
-                $inputs = array(
-                        '<strong/>',
-                        '<em />',
-                        '<p class="main1"/>',
-                        '<p class="main2" />',
-                );
-                $expected = array(
-                        '<strong></strong>',
-                        '<em></em>',
-                        '<p class="main1"></p>',
-                        '<p class="main2"></p>',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_closes_unclosed_single_tags_having_attributes() {
-                $inputs = array(
-                        '<img src="/images/example.png">',
-                        '<input type="text" name="example">'
-                );
-                $expected = array(
-                        '<img src="/images/example.png"/>',
-                        '<input type="text" name="example"/>'
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_allows_validly_closed_single_tags() {
-                $inputs = array(
-                        '<br />',
-                        '<hr />',
-                        '<img src="/images/example.png" />',
-                        '<input type="text" name="example" />'
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_balances_nestable_tags() {
-                $inputs = array(
-                        '<q>Test<q>Test</q>',
-                        '<div><div>Test',
-                        '<div>Test</div></div>',
-                );
-                $expected = array(
-                        '<q>Test<q>Test</q></q>',
-                        '<div><div>Test</div></div>',
-                        '<div>Test</div>',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_allows_adjacent_nestable_tags() {
-                $inputs = array(
-                        '<blockquote><blockquote>Example quote</blockquote></blockquote>',
-                        '<div class="container"><div>This is allowed></div></div>',
-                        '<span><span><span>Example in spans</span></span></span>',
-                        '<blockquote>Main quote<blockquote>Example quote</blockquote> more text</blockquote>',
-                        '<q><q class="inner-q">Inline quote</q></q>',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        /**
-         * @ticket 20401
-         */
-        function test_allows_immediately_nested_object_tags() {
-
-                $object = '<object id="obj1"><param name="param1"/><object id="obj2"><param name="param2"/></object></object>';
-                $this->assertEquals( $object, balanceTags( $object, true ) );
-        }
-
-        function test_balances_nested_non_nestable_tags() {
-                $inputs = array(
-                        '<b><b>This is bold</b></b>',
-                        '<b>Some text here <b>This is bold</b></b>',
-                );
-                $expected = array(
-                        '<b></b><b>This is bold</b>',
-                        '<b>Some text here </b><b>This is bold</b>',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_fixes_improper_closing_tag_sequence() {
-                $inputs = array(
-                        '<p>Here is a <strong class="part">bold <em>and emphasis</p></em></strong>',
-                        '<ul><li>Aaa</li><li>Bbb</ul></li>',
-                );
-                $expected = array(
-                        '<p>Here is a <strong class="part">bold <em>and emphasis</em></strong></p>',
-                        '<ul><li>Aaa</li><li>Bbb</li></ul>',
-                );
-
-                foreach ($inputs as $key => $input) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_adds_missing_closing_tags() {
-                $inputs = array(
-                        '<b><i>Test</b>',
-                        '<p>Test',
-                        '<p>Test test</em> test</p>',
-                        '</p>Test',
-                        '<p>Here is a <strong class="part">Test</p>',
-                );
-                $expected = array(
-                        '<b><i>Test</i></b>',
-                        '<p>Test</p>',
-                        '<p>Test test test</p>',
-                        'Test',
-                        '<p>Here is a <strong class="part">Test</strong></p>',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
-                }
-        }
-
-        function test_removes_extraneous_closing_tags() {
-                $inputs = array(
-                        '<b>Test</b></b>',
-                        '<div>Test</div></div><div>Test',
-                        '<p>Test test</em> test</p>',
-                        '</p>Test',
-                );
-                $expected = array(
-                        '<b>Test</b>',
-                        '<div>Test</div><div>Test</div>',
-                        '<p>Test test test</p>',
-                        'Test',
-                );
-
-                foreach ( $inputs as $key => $input ) {
-                        $this->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>-<?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->cache =& $this->init_cache();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $this->flush_cache();
-        }
-
-        function &init_cache() {
-                $cache = new WP_Object_Cache();
-                return $cache;
-        }
-
-        function test_miss() {
-                $this->assertEquals(NULL, $this->cache->get(rand_str()));
-        }
-
-        function test_add_get() {
-                $key = rand_str();
-                $val = rand_str();
-
-                $this->cache->add($key, $val);
-                $this->assertEquals($val, $this->cache->get($key));
-        }
-
-        function test_add_get_0() {
-                $key = rand_str();
-                $val = 0;
-
-                // you can store zero in the cache
-                $this->cache->add($key, $val);
-                $this->assertEquals($val, $this->cache->get($key));
-        }
-
-        function test_add_get_null() {
-                $key = rand_str();
-                $val = null;
-
-                $this->assertTrue( $this->cache->add($key, $val) );
-                // null is converted to empty string
-                $this->assertEquals( '', $this->cache->get($key) );
-        }
-
-        function test_add() {
-                $key = rand_str();
-                $val1 = rand_str();
-                $val2 = rand_str();
-
-                // add $key to the cache
-                $this->assertTrue($this->cache->add($key, $val1));
-                $this->assertEquals($val1, $this->cache->get($key));
-                // $key is in the cache, so reject new calls to add()
-                $this->assertFalse($this->cache->add($key, $val2));
-                $this->assertEquals($val1, $this->cache->get($key));
-        }
-
-        function test_replace() {
-                $key = rand_str();
-                $val = rand_str();
-
-                // memcached rejects replace() if the key does not exist
-                $this->assertFalse($this->cache->replace($key, $val));
-                $this->assertFalse($this->cache->get($key));
-        }
-
-        function test_set() {
-                $key = rand_str();
-                $val = rand_str();
-
-                // memcached accepts set() if the key does not exist
-                $this->assertTrue($this->cache->set($key, $val));
-                $this->assertEquals($val, $this->cache->get($key));
-        }
-
-        function test_flush() {
-                $key = rand_str();
-                $val = rand_str();
-
-                $this->cache->add($key, $val);
-                // item is visible to both cache objects
-                $this->assertEquals($val, $this->cache->get($key));
-                $this->cache->flush();
-                // If there is no value get returns false.
-                $this->assertFalse($this->cache->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->foo = 'alpha';
-                $this->cache->set( $key, $object_a );
-                $object_a->foo = 'bravo';
-                $object_b = $this->cache->get( $key );
-                $this->assertEquals( 'alpha', $object_b->foo );
-                $object_b->foo = 'charlie';
-                $this->assertEquals( 'bravo', $object_a->foo );
-
-                $key = rand_str();
-                $object_a = new stdClass;
-                $object_a->foo = 'alpha';
-                $this->cache->add( $key, $object_a );
-                $object_a->foo = 'bravo';
-                $object_b = $this->cache->get( $key );
-                $this->assertEquals( 'alpha', $object_b->foo );
-                $object_b->foo = 'charlie';
-                $this->assertEquals( 'bravo', $object_a->foo );
-        }
-
-        function test_incr() {
-                $key = rand_str();
-
-                $this->assertFalse( $this->cache->incr( $key ) );
-
-                $this->cache->set( $key, 0 );
-                $this->cache->incr( $key );
-                $this->assertEquals( 1, $this->cache->get( $key ) );
-
-                $this->cache->incr( $key, 2 );
-                $this->assertEquals( 3, $this->cache->get( $key ) );
-        }
-
-        function test_decr() {
-                $key = rand_str();
-
-                $this->assertFalse( $this->cache->decr( $key ) );
-
-                $this->cache->set( $key, 0 );
-                $this->cache->decr( $key );
-                $this->assertEquals( 0, $this->cache->get( $key ) );
-
-                $this->cache->set( $key, 3 );
-                $this->cache->decr( $key );
-                $this->assertEquals( 2, $this->cache->get( $key ) );
-
-                $this->cache->decr( $key, 2 );
-                $this->assertEquals( 0, $this->cache->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>-<?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->structure );
-                create_initial_taxonomies();
-                $GLOBALS['wp_rewrite']->init();
-                flush_rewrite_rules();
-
-                $this->old_current_user = get_current_user_id();
-                $this->author_id = $this->factory->user->create( array( 'user_login' => 'canonical-author' ) );
-                wp_set_current_user( $this->author_id );
-
-                // Already created by install defaults:
-                // $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
-
-                $this->term_ids = array();
-
-                $this->factory->post->create( array( 'import_id' => 587, 'post_title' => 'post-format-test-audio', 'post_date' => '2008-06-02 00:00:00' ) );
-                $post_id = $this->factory->post->create( array( 'post_title' => 'post-format-test-gallery', 'post_date' => '2008-06-10 00:00:00' ) );
-                $this->factory->post->create( array( 'import_id' => 611, 'post_type' => 'attachment', 'post_title' => 'canola2', 'post_parent' => $post_id ) );
-
-                $this->factory->post->create( array(
-                        'post_title' => 'images-test',
-                        'post_date' => '2008-09-03 00:00:00',
-                        'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3'
-                ) );
-
-                $post_id = $this->factory->post->create( array( 'import_id' => 149, 'post_title' => 'comment-test', 'post_date' => '2008-03-03 00:00:00' ) );
-                $this->factory->comment->create_post_comments( $post_id, 15 );
-
-                $this->factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );
-
-                $this->factory->post->create( array( 'import_id' => 123 ) );
-                $this->factory->post->create( array( 'import_id' => 1 ) );
-                $this->factory->post->create( array( 'import_id' => 358 ) );
-
-                $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'sample-page' ) );
-                $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
-                $post_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $this->factory->post->create(
-                        array( 'import_id' => 144, 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id,
-                ) );
-
-                $this->term_ids['/category/parent/'] = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'parent' ) );
-                $this->term_ids['/category/parent/child-1/'] = $this->factory->term->create( array(
-                        'taxonomy' => 'category', 'name' => 'child-1', 'parent' => $this->term_ids['/category/parent/'],
-                ) );
-                $this->term_ids['/category/parent/child-1/child-2/'] = $this->factory->term->create( array(
-                        'taxonomy' => 'category', 'name' => 'child-2', 'parent' => $this->term_ids['/category/parent/child-1/'],
-                ) );
-
-                $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
-                $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
-
-                $this->factory->term->create( array( 'name' => 'post-formats' ) );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                wp_set_current_user( $this->old_current_user );
-
-                $GLOBALS['wp_rewrite']->init();
-        }
-
-        // URL's are relative to the site "front", 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->knownWPBug( $ticket );
-
-                $ticket_ref = ($ticket > 0) ? 'Ticket #' . $ticket : null;
-
-                if ( is_string($expected) )
-                        $expected = array('url' => $expected);
-                elseif ( is_array($expected) && !isset($expected['url']) && !isset($expected['qv']) )
-                        $expected = array( 'qv' => $expected );
-
-                if ( !isset($expected['url']) && !isset($expected['qv']) )
-                        $this->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->author_id );
-                        if ( false !== strpos( $test_url, '?cat=%d' ) )
-                                $test_url = sprintf( $test_url, $this->term_ids[ $expected['url'] ] );
-                }
-
-                $this->go_to( home_url( $test_url ) );
-
-                // Does the redirect match what's expected?
-                $can_url = $this->get_canonical( $test_url );
-                $parsed_can_url = parse_url($can_url);
-
-                // Just test the Path and Query if present
-                if ( isset($expected['url']) )
-                        $this->assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
-
-                if ( ! isset($expected['qv']) )
-                        return;
-
-                // "make" that the request and check the query is correct
-                $this->go_to( $can_url );
-
-                // Are all query vars accounted for, And correct?
-                global $wp;
-
-                $query_vars = array_diff($wp->query_vars, $wp->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->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->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 "proper" 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' => '/category/uncategorized/', 'qv' => array( 'category_name' => 'uncategorized' ) ) ),
-                        array( '/category/uncategorized/page/2/', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
-                        array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
-                        array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
-                        array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
-                        array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
-
-                        // Categories & Intersections with other vars
-                        array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
-                        array( '/?category_name=cat-a,cat-b', array( 'url' => '/?category_name=cat-a,cat-b', 'qv' => array( 'category_name' => '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&year=2008', array( 'url' => '/category/uncategorized/page/2/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2, 'year' => 2008) ), 17661 ),
-//                        array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
-                        array( '/2008/04/?cat=1', array( 'url' => '/category/uncategorized/?year=2008&monthnum=04', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
-//                        array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
-                        array( '/2008/?category_name=cat-a', array( 'url' => '/category/cat-a/?year=2008', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ), 20386 ),
-//                        array( '/category/uncategorized/?year=2008', array( 'url' => '/2008/?category_name=uncategorized', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
-                        array( '/category/uncategorized/?year=2008', array( 'url' => '/category/uncategorized/?year=2008', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
-
-                        // Pages
-                        array( '/sample%20page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 17653 ), // Page rules always set 'page'
-                        array( '/sample------page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 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' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/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&year=2008', '/2008/?author=3'),
-                        array( '/?author=%d&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&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->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
-                update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
-                $wp_rewrite->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->add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule
-                $wp_rewrite->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' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
-                        array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
-                        array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' => '/ccr/uncategorized/sort/desc/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc', 'year' => '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&p=1', '/?p=1' ),
-
-                        // Strip an existing but incorrect post_type arg
-                        array( '/?post_type=page&page_id=1', '/?p=1' ),
-
-                        array( '/?p=358 ', array('url' => '/?p=358', 'qv' => array('p' => '358') ) ), // Trailing spaces
-                        array( '/?p=358%20', array('url' => '/?p=358', 'qv' => array('p' => '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&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>-<?php
-
-/**
- * @group user
- * @group capabilities
- */
-class TestMapMetaCap extends WP_UnitTestCase {
-        var $super_admins = null;
-
-        function setUp() {
-                parent::setUp();
-
-                $this->user_ids = array();
-
-                $this->user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-
-                if ( isset( $GLOBALS['super_admins'] ) )
-                        $this->super_admins = $GLOBALS['super_admins'];
-                $user = new WP_User( $this->user_id );
-                $GLOBALS['super_admins'] = array( $user->user_login );
-
-                $this->post_type = rand_str( 20 );
-                register_post_type( $this->post_type );
-
-                $this->post_id = wp_insert_post( array(
-                        'post_title' => rand_str(),
-                        'post_type' => $this->post_type,
-                        'post_status' => 'private',
-                        'post_author' => $this->author_id,
-                ) );
-        }
-
-        function tearDown() {
-                parent::tearDown();
-
-                $GLOBALS['super_admins'] = $this->super_admins;
-                unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
-        }
-
-        function test_capability_type_post_with_no_extra_caps() {
-
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'post',
-                ) );
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertTrue( $post_type_object->map_meta_cap );
-
-                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_custom_capability_type_with_map_meta_cap() {
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'book',
-                        'map_meta_cap' => true,
-                ) );
-
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_private_books' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_private_books' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_capability_type_post_with_one_renamed_cap() {
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'post',
-                        'capabilities' => array( 'edit_posts' => 'edit_books' ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertFalse( $post_type_object->map_meta_cap );
-
-                $this->assertEquals( array( 'edit_post' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_post' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_post' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_post' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_post' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_post' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_capability_type_post_map_meta_cap_true_with_renamed_cap() {
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'post',
-                        'map_meta_cap' => true,
-                        'capabilities' => array(
-                                'edit_post' => 'edit_book', // maps back to itself.
-                                'edit_others_posts' => 'edit_others_books',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertTrue( $post_type_object->map_meta_cap );
-
-                $this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_capability_type_post_with_all_meta_caps_renamed() {
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'post',
-                        'capabilities' => array(
-                                'edit_post' => 'edit_book',
-                                'read_post' => 'read_book',
-                                'delete_post' => 'delete_book',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertFalse( $post_type_object->map_meta_cap );
-
-                $this->assertEquals( array( 'edit_book' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_book' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_book' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_book' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_book' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_book' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_capability_type_post_with_all_meta_caps_renamed_mapped() {
-                register_post_type( $this->post_type, array(
-                        'capability_type' => 'post',
-                        'map_meta_cap' => true,
-                        'capabilities' => array(
-                                'edit_post' => 'edit_book',
-                                'read_post' => 'read_book',
-                                'delete_post' => 'delete_book',
-                        ),
-                ) );
-
-                $post_type_object = get_post_type_object( $this->post_type );
-
-                $this->assertTrue( $post_type_object->map_meta_cap );
-
-                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'read_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
-
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
-                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
-                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
-        }
-
-        function test_unfiltered_html_cap() {
-                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
-                        $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
-                if ( is_multisite() ) {
-                        $this->assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
-                        $this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->user_id ) );
-                } else {
-                        $this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->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->markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
-
-                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
-                        if ( ! DISALLOW_UNFILTERED_HTML )
-                                $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
-                } else {
-                        define( 'DISALLOW_UNFILTERED_HTML', true );
-                }
-
-                $this->assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', $this->user_id ) );
-                $this->assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', $this->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>-<?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Dependencies extends WP_UnitTestCase {
-        function test_add() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'one' ));
-                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
-
-                //Cannot reuse names
-                $this->assertFalse($dep->add( 'one', '' ));
-        }
-
-        function test_remove() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $dep->remove( 'one' );
-
-                $this->assertFalse($dep->query( 'one'));
-                $this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
-
-        }
-
-        function test_enqueue() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $dep->enqueue('one');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertFalse($dep->query( 'two', 'queue' ));
-
-                $dep->enqueue('two');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-        }
-
-        function test_dequeue() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $dep->enqueue('one');
-                $dep->enqueue('two');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-
-                $dep->dequeue('one');
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-
-                $dep->dequeue('two');
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $this->assertFalse($dep->query( 'two', 'queue' ));
-        }
-
-        function test_enqueue_args() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $dep->enqueue('one?arg');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertFalse($dep->query( 'two', 'queue' ));
-                $this->assertEquals('arg', $dep->args['one']);
-
-                $dep->enqueue('two?arg');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-                $this->assertEquals('arg', $dep->args['two']);
-        }
-
-        function test_dequeue_args() {
-                // Create a new object
-                $dep = new WP_Dependencies;
-
-                $this->assertTrue($dep->add( 'one', '' ));
-                $this->assertTrue($dep->add( 'two', '' ));
-
-                $dep->enqueue('one?arg');
-                $dep->enqueue('two?arg');
-                $this->assertTrue($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-                $this->assertEquals('arg', $dep->args['one']);
-                $this->assertEquals('arg', $dep->args['two']);
-
-                $dep->dequeue('one');
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $this->assertTrue($dep->query( 'two', 'queue' ));
-                $this->assertFalse(isset($dep->args['one']));
-
-                $dep->dequeue('two');
-                $this->assertFalse($dep->query( 'one', 'queue' ));
-                $this->assertFalse($dep->query( 'two', 'queue' ));
-                $this->assertFalse(isset($dep->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>-<?php
-/**
- * @group themes
- */
-class Test_WP_Theme extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
-
-                $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
-                $GLOBALS['wp_theme_directories'] = array( $this->theme_root );
-
-                add_filter('theme_root', array(&$this, '_theme_root'));
-                add_filter( 'stylesheet_root', array(&$this, '_theme_root') );
-                add_filter( 'template_root', array(&$this, '_theme_root') );
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
-                remove_filter('theme_root', array(&$this, '_theme_root'));
-                remove_filter( 'stylesheet_root', array(&$this, '_theme_root') );
-                remove_filter( 'template_root', array(&$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->theme_root;
-        }
-        function test_new_WP_Theme_top_level() {
-                $theme = new WP_Theme( 'theme1', $this->theme_root );
-
-                //Meta
-                $this->assertEquals( 'My Theme', $theme->get('Name') );
-                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
-                $this->assertEquals( 'An example theme', $theme->get('Description') );
-                $this->assertEquals( 'Minnie Bannister', $theme->get('Author') );
-                $this->assertEquals( 'http://example.com/', $theme->get('AuthorURI') );
-                $this->assertEquals( '1.3', $theme->get('Version') );
-                $this->assertEquals( '', $theme->get('Template') );
-                $this->assertEquals( 'publish', $theme->get('Status') );
-                $this->assertEquals( array(), $theme->get('Tags') );
-
-                //Important
-                $this->assertEquals( 'theme1', $theme->get_stylesheet() );
-                $this->assertEquals( 'theme1', $theme->get_template() );
-        }
-
-        function test_new_WP_Theme_subdir() {
-                $theme = new WP_Theme( 'subdir/theme2', $this->theme_root );
-
-                //Meta
-                $this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
-                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
-                $this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
-                $this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
-                $this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
-                $this->assertEquals( '0.1', $theme->get('Version') );
-                $this->assertEquals( '', $theme->get('Template') );
-                $this->assertEquals( 'publish', $theme->get('Status') );
-                $this->assertEquals( array(), $theme->get('Tags') );
-
-                //Important
-                $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
-                $this->assertEquals( 'subdir/theme2', $theme->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->theme_root . '/subdir' );
-
-                //Meta
-                $this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
-                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
-                $this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
-                $this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
-                $this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
-                $this->assertEquals( '0.1', $theme->get('Version') );
-                $this->assertEquals( '', $theme->get('Template') );
-                $this->assertEquals( 'publish', $theme->get('Status') );
-                $this->assertEquals( array(), $theme->get('Tags') );
-
-                //Important
-                $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
-                $this->assertEquals( 'subdir/theme2', $theme->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>-<?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->wp_getOptions( array( 1, 'username', 'password' ) );
-
-                $this->assertInstanceOf( 'IXR_Error', $result );
-                $this->assertEquals( 405, $result->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>-<?php
-
-/**
- * @group compat
- */
-class TestMbSubStr extends WP_UnitTestCase {
-        function test_mb_strcut() {
-                $this->assertEquals('баб', _mb_substr('баба', 0, 3));
-                $this->assertEquals('баб', _mb_substr('баба', 0, -1));
-                $this->assertEquals('баб', _mb_substr('баба', 0, -1));
-                $this->assertEquals('I am your б', _mb_substr('I am your баба', 0, 11));
-        }
-}
-
-/**
- * @group compat
- */
-class TestHashHMAC extends WP_UnitTestCase {
-        function test_simple() {
-                $this->assertEquals('140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac('md5', 'simple', 'key'));
-                $this->assertEquals('993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac('sha1', 'simple', 'key'));
-        }
-
-        function test_key_padding() {
-                $this->assertEquals('3c1399103807cf12ec38228614416a8c', _hash_hmac('md5', 'simple', '65 character key 65 character key 65 character key 65 character k'));
-                $this->assertEquals('4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac('sha1', 'simple', '65 character key 65 character key 65 character key 65 character k'));
-        }
-
-        function test_raw_output() {
-                $this->assertEquals(array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
-                $this->assertEquals(array( 1 => '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>-<?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->factory->post->create_many( 25 );
-
-                $this->post_count = get_option('posts_per_rss');
-                $this->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->go_to('/feed/');
-                $feed = $this->do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get the rss element
-                $rss = xml_find($xml, 'rss');
-
-                // there should only be one rss element
-                $this->assertEquals(1, count($rss));
-
-                $this->assertEquals('2.0', $rss[0]['attributes']['version']);
-                $this->assertEquals('http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content']);
-                $this->assertEquals('http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw']);
-                $this->assertEquals('http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc']);
-
-                // rss should have exactly one child element (channel)
-                $this->assertEquals(1, count($rss[0]['child']));
-        }
-
-        function test_channel() {
-                $this->go_to('/feed/');
-                $feed = $this->do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get the rss -> channel element
-                $channel = xml_find($xml, 'rss', 'channel');
-
-                $this->assertTrue(empty($channel[0]['attributes']));
-
-                $title = xml_find($xml, 'rss', 'channel', 'title');
-                $this->assertEquals(get_option('blogname'), $title[0]['content']);
-
-                $desc = xml_find($xml, 'rss', 'channel', 'description');
-                $this->assertEquals(get_option('blogdescription'), $desc[0]['content']);
-
-                $link = xml_find($xml, 'rss', 'channel', 'link');
-                $this->assertEquals(get_option('siteurl'), $link[0]['content']);
-
-                $pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
-                $this->assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
-        }
-
-        /**
-         * @ticket UT32
-         */
-        function test_items() {
-                $this->go_to('/feed/');
-                $feed = $this->do_rss2();
-                $xml = xml_to_array($feed);
-
-                // get all the rss -> channel -> item elements
-                $items = xml_find($xml, 'rss', 'channel', 'item');
-                $posts = get_posts('numberposts='.$this->post_count);
-
-                // check each of the items against the known post data
-                for ($i=0; $i < $this->post_count; $i++) {
-
-                        // title
-                        $title = xml_find($items[$i]['child'], 'title');
-                        $this->assertEquals($posts[$i]->post_title, $title[0]['content']);
-
-                        // link
-                        $link = xml_find($items[$i]['child'], 'link');
-                        $this->assertEquals(get_permalink($posts[$i]->ID), $link[0]['content']);
-
-                        // comment link
-                        $comments_link = xml_find($items[$i]['child'], 'comments');
-                        $this->assertEquals(get_permalink($posts[$i]->ID) . '#comments', $comments_link[0]['content']);
-
-                        // pub date
-                        $pubdate = xml_find($items[$i]['child'], 'pubDate');
-                        $this->assertEquals(strtotime($posts[$i]->post_date), strtotime($pubdate[0]['content']));
-
-                        // author
-                        $creator = xml_find($items[$i]['child'], 'dc:creator');
-                        $this->assertEquals($this->author->user_nicename, $creator[0]['content']);
-
-                        // categories (perhaps multiple)
-                        $categories = xml_find($items[$i]['child'], 'category');
-                        $cat_ids = wp_get_post_categories($post->ID);
-                        if (empty($cat_ids))        $cat_ids = array(1);
-                        // should be the same number of categories
-                        $this->assertEquals(count($cat_ids), count($categories));
-                        // ..with the same names
-                        for ($j=0; $j < count($cat_ids); $j++)
-                                $this->assertEquals(get_cat_name($cat_ids[$j]), $categories[$j]['content']);
-
-                        // GUID
-                        $guid = xml_find($items[$i]['child'], 'guid');
-                        $this->assertEquals('false', $guid[0]['attributes']['isPermaLink']);
-                        $this->assertEquals($posts[$i]->guid, $guid[0]['content']);
-
-                        // description/excerpt
-                        $description = xml_find($items[$i]['child'], 'description');
-                        $this->assertEquals(trim($posts[$i]->post_excerpt), trim($description[0]['content']));
-
-                        // post content
-                        if (!$this->excerpt_only) {
-                                $content = xml_find($items[$i]['child'], 'content:encoded');
-                                $this->assertEquals(trim(apply_filters('the_content', $posts[$i]->post_content)), trim($content[0]['content']));
-                        }
-
-                        // comment rss
-                        $comment_rss = xml_find($items[$i]['child'], 'wfw:commentRss');
-                        $this->assertEquals(html_entity_decode(get_post_comments_feed_link($posts[$i]->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>-<?php
-
-class TestIncludesFile extends WP_UnitTestCase {
-
-        function setUp() {
-                $this->dir = dirname(tempnam('/tmp', 'foo'));
-
-                $this->badchars = '"\'[]*&?$';
-        }
-
-        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->dir, rand_str() . '.txt' );
-
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
-
-                unlink($this->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->dir, $name . '.txt' );
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename1) );
-                $filename2 = wp_unique_filename( $this->dir, $name . '.txt' );
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename2) );
-
-                // the two should be different
-                $this->assertNotEquals( $filename1, $filename2 );
-
-                unlink($this->dir . DIRECTORY_SEPARATOR . $filename1);
-                unlink($this->dir . DIRECTORY_SEPARATOR . $filename2);
-        }
-
-        function test_unique_filename_is_sanitized() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' );
-
-                // make sure the bad characters were all stripped out
-                $this->assertEquals( $name . '.txt', $filename );
-
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
-
-                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_with_slashes() {
-                $name = rand_str();
-                // "foo/foo.txt"
-                $filename = wp_unique_filename( $this->dir, $name . '/' . $name . '.txt' );
-
-                // the slash should be removed, i.e. "foofoo.txt"
-                $this->assertEquals( $name . $name . '.txt', $filename );
-
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
-
-                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_multiple_ext() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this->dir, $name . '.php.txt' );
-
-                // "foo.php.txt" becomes "foo.php_.txt"
-                $this->assertEquals( $name . '.php_.txt', $filename );
-
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
-
-                unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
-        }
-
-        function test_unique_filename_no_ext() {
-                $name = rand_str();
-                $filename = wp_unique_filename( $this->dir, $name );
-
-                $this->assertEquals( $name, $filename );
-
-                $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
-
-                unlink($this->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>-<?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' => 'classname',
-                        'id' => 'id',
-                        'style' => 'color: red;',
-                        'title' => 'title',
-                );
-
-                foreach ( $attributes as $name => $value ) {
-                        $string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
-                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        /**
-         * @ticket 20210
-         */
-        function test_wp_filter_post_kses_a() {
-                global $allowedposttags;
-
-                $attributes = array(
-                        'class' => 'classname',
-                        'id' => 'id',
-                        'style' => 'color: red;',
-                        'title' => 'title',
-                        'href' => 'http://example.com',
-                        'rel' => 'related',
-                        'rev' => 'revision',
-                        'name' => 'name',
-                        'target' => '_blank',
-                );
-
-                foreach ( $attributes as $name => $value ) {
-                        $string = "<a $name='$value'>I link this</a>";
-                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        /**
-         * @ticket 20210
-         */
-        function test_wp_filter_post_kses_abbr() {
-                global $allowedposttags;
-
-                $attributes = array(
-                        'class' => 'classname',
-                        'id' => 'id',
-                        'style' => 'color: red;',
-                        'title' => 'title',
-                );
-
-                foreach ( $attributes as $name => $value ) {
-                        $string = "<abbr $name='$value'>WP</abbr>";
-                        $this->assertEquals( $string, wp_kses( $string, $allowedposttags ) );
-                }
-        }
-
-        function test_feed_links() {
-                global $allowedposttags;
-
-                $content = <<<EOF
-<a href="feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:javascript:feed:alert(1)">CLICK ME</a>
-<a href="feed:feed:javascript:alert(1)">CLICK ME</a>
-<a href="javascript:feed:alert(1)">CLICK ME</a>
-<a href="javascript:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:feed:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
-<a href="feed:feed:feed:http:alert(1)">CLICK ME</a>
-EOF;
-
-                $expected = <<<EOF
-<a href="feed:alert(1)">CLICK ME</a>
-<a href="feed:feed:alert(1)">CLICK ME</a>
-<a href="feed:feed:alert(1)">CLICK ME</a>
-<a href="feed:alert(1)">CLICK ME</a>
-<a href="feed:alert(1)">CLICK ME</a>
-<a href="">CLICK ME</a>
-<a href="">CLICK ME</a>
-<a href="">CLICK ME</a>
-<a href="">CLICK ME</a>
-<a href="">CLICK ME</a>
-<a href="">CLICK ME</a>
-EOF;
-
-        $this->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>-<?php
-
-class TestIncludesMedia extends WP_UnitTestCase {
-
- function setUp() {
- $this->caption = 'A simple caption.';
- $this->html_content = <<<CAP
-A <strong class='classy'>bolded</strong> <em>caption</em> with a <a href="#">link</a>.
-CAP;
- $this->img_content = <<<CAP
-<img src="pic.jpg" id='anId' alt="pic"/>
-CAP;
- }
-
- function test_img_caption_shortcode_added() {
- global $shortcode_tags;
- $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
- $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
- }
-
- function test_img_caption_shortcode_with_empty_params() {
- $result = img_caption_shortcode( array() );
- $this->assertNull( $result );
- }
-
- function test_img_caption_shortcode_with_bad_attr() {
- $result = img_caption_shortcode( array(), 'content' );
- $this->assertEquals( 'content', 'content' );
- }
-
- function test_img_caption_shortcode_with_old_format() {
- $result = img_caption_shortcode(
- array( 'width' => 20, 'caption' => $this->caption )
- );
- $this->assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "/width: 30/", $result, $_r ) );
- }
-
- function test_img_caption_shortcode_with_old_format_id_and_align() {
- $result = img_caption_shortcode(
- array(
- 'width' => 20,
- 'caption' => $this->caption,
- 'id' => '"myId',
- 'align' => '&myAlignment'
- )
- );
- $this->assertEquals( 1, preg_match_all( '/wp-caption &amp;myAlignment/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( '/id="&quot;myId"/', $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
- }
-
- function test_new_img_caption_shortcode_with_html_caption() {
- $result = img_caption_shortcode(
- array( 'width' => 20, 'caption' => $this->html_content )
- );
- $our_preg = preg_quote( $this->html_content );
-
- $this->assertEquals( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
- }
-
- function test_new_img_caption_shortcode_new_format() {
- $result = img_caption_shortcode(
- array( 'width' => 20 ),
- $this->img_content . $this->html_content
- );
- $img_preg = preg_quote( $this->img_content );
- $content_preg = preg_quote( $this->html_content );
-
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
- }
-
- function test_new_img_caption_shortcode_new_format_and_linked_image() {
- $linked_image = "<a href='#'>{$this->img_content}</a>";
- $result = img_caption_shortcode(
- array( 'width' => 20 ),
- $linked_image . $this->html_content
- );
- $img_preg = preg_quote( $linked_image );
- $content_preg = preg_quote( $this->html_content );
-
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
- }
-
- function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
- $linked_image = "<a href='#'>{$this->img_content}</a>";
- $result = img_caption_shortcode(
- array( 'width' => 20 ),
- $linked_image . "\n\n" . $this->html_content
- );
- $img_preg = preg_quote( $linked_image );
- $content_preg = preg_quote( $this->html_content );
-
- $this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
- $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $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>-<?php
-
-/**
- * @group meta
- */
-class WPTestIncludesMeta extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this->author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
-                $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' );
-                $this->delete_meta_id = add_metadata( 'user', $this->author->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->assertEquals( 'unsanitized', $meta );
-
-                register_meta( 'post', 'some_meta', array( &$this, '_meta_sanitize_cb' ) );
-                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
-                $this->assertEquals( 'sanitized', $meta );
-        }
-
-        function test_delete_metadata_by_mid() {
-                // Let's try and delete a non-existing ID, non existing meta
-                $this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
-                $this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this->delete_meta_id ) );
-
-                // Now let's delete the real meta data
-                $this->assertTrue( delete_metadata_by_mid( 'user', $this->delete_meta_id ) );
-
-                // And make sure it's been deleted
-                $this->assertFalse( get_metadata_by_mid( 'user', $this->delete_meta_id ) );
-
-                // Make sure the caches are cleared
-                $this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
-        }
-
-        function test_update_metadata_by_mid() {
-                // Setup
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-
-                // Update the meta value
-                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-                $this->assertEquals( 'meta_new_value', $meta->meta_value );
-
-                // Update the meta value
-                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-                $this->assertEquals( 'meta_new_key', $meta->meta_key );
-
-                // Update the key and value
-                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-                $this->assertEquals( 'meta_key', $meta->meta_key );
-                $this->assertEquals( 'meta_value', $meta->meta_value );
-
-                // Update the value that has to be serialized
-                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-                $this->assertEquals( array( 'first', 'second' ), $meta->meta_value );
-
-                // Let's try some invalid meta data
-                $this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
-                $this->assertFalse( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', array('invalid', 'key' ) ) );
-
-                // Let's see if caches get cleared after updates.
-                $meta = get_metadata_by_mid( 'user', $this->meta_id );
-                $first = get_user_meta( $meta->user_id, $meta->meta_key );
-                $this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'other_meta_value' ) );
-                $second = get_user_meta( $meta->user_id, $meta->meta_key );
-                $this->assertFalse( $first === $second );
-        }
-
-        function test_metadata_exists() {
-                $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'foobarbaz' ) );
-                $this->assertTrue( metadata_exists( 'user', $this->author->ID, 'meta_key' ) );
-                $this->assertFalse( metadata_exists( 'user', 1234567890, 'foobarbaz' ) );
-                $this->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->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
-                $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) );
-                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value ) );
-                $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
-                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value ) );
-                $this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) );
-                $this->assertEquals( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
-                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
-
-                // Test overslashing
-                $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) );
-                $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
-                $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
-                $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) );
-                $this->assertEquals( $expected2, get_metadata( 'user', $this->author->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->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->factory->user->create( array( 'role' => 'administrator' ) );
-                $this->assertFalse( get_userdata( 0 ) );
-                $this->assertFalse( get_userdata( '0' ) );
-                $this->assertFalse( get_userdata( 'string' ) );
-                $this->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>-<?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Scripts extends WP_UnitTestCase {
-        var $old_wp_scripts;
-
-        function setUp() {
-                parent::setUp();
-                $this->old_wp_scripts = $GLOBALS['wp_scripts'];
-                remove_action( 'wp_default_scripts', 'wp_default_scripts' );
-                $GLOBALS['wp_scripts'] = new WP_Scripts();
-                $GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
-
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_scripts'] = $this->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 = "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
-                $expected .= "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
-                $expected .= "<script type='text/javascript' src='http://example.com?ver=1.2'></script>\n";
-                $expected .= "<script type='text/javascript' src='http://example.com'></script>\n";
-
-                $this->assertEquals($expected, get_echo('wp_print_scripts'));
-
-                // No scripts left to print
-                $this->assertEquals("", 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->base_url;
-                $wp_scripts->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 .= "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
-
-                // Try with an HTTPS reference
-                wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected .= "<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
-
-                // Try with an automatic protocol reference (//)
-                wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected .= "<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
-
-                // Try with a local resource and an automatic protocol reference (//)
-                $url = '//my_plugin/script.js';
-                wp_enqueue_script( 'plugin-script', $url );
-                $expected .= "<script type='text/javascript' src='$url?ver=$ver'></script>\n";
-
-                // Try with a bad protocol
-                wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
-                $expected .= "<script type='text/javascript' src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
-
-                // Go!
-                $this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
-
-                // No scripts left to print
-                $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
-
-                // Cleanup
-                $wp_scripts->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>-<?php
-/**
- * @group dependencies
- * @group scripts
- */
-class TestWP_Styles extends WP_UnitTestCase {
-        var $old_wp_styles;
-
-        function setUp() {
-                parent::setUp();
-                $this->old_wp_styles = $GLOBALS['wp_styles'];
-                remove_action( 'wp_default_styles', 'wp_default_styles' );
-                $GLOBALS['wp_styles'] = new WP_Styles();
-                $GLOBALS['wp_styles']->default_version = get_bloginfo( 'version' );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_styles'] = $this->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 = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' type='text/css' media='all' />\n";
-                $expected .= "<link rel='stylesheet' id='no-deps-version-css' href='http://example.com?ver=1.2' type='text/css' media='all' />\n";
-                $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' href='http://example.com' type='text/css' media='all' />\n";
-                $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' href='http://example.com' type='text/css' media='print' />\n";
-
-                $this->assertEquals($expected, get_echo('wp_print_styles'));
-
-                // No styles left to print
-                $this->assertEquals("", 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->base_url;
-                $wp_styles->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 .= "<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' />\n";
-
-                // Try with an HTTPS reference
-                wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected .= "<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' />\n";
-
-                // Try with an automatic protocol reference (//)
-                wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected .= "<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' />\n";
-
-                // Try with a local resource and an automatic protocol reference (//)
-                $url = '//my_plugin/style.css';
-                wp_enqueue_style( 'plugin-style', $url );
-                $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' type='text/css' media='all' />\n";
-
-                // Try with a bad protocol
-                wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
-                $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
-
-                // Go!
-                $this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
-
-                // No styles left to print
-                $this->assertEquals( '', get_echo( 'wp_print_styles' ) );
-
-                // Cleanup
-                $wp_styles->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>-<?php
-
-// tests for link-template.php and related URL functions
-class TestSSLLinks extends WP_UnitTestCase {
-        var $_old_server;
-        function setUp() {
-                $this->_old_server = $_SERVER;
-        }
-
-        function tearDown() {
-                $_SERVER = $this->_old_server;
-        }
-
-        function test_is_ssl_positive() {
-                $_SERVER['HTTPS'] = 'on';
-                $this->assertTrue( is_ssl() );
-
-                $_SERVER['HTTPS'] = 'ON';
-                $this->assertTrue( is_ssl() );
-
-                $_SERVER['HTTPS'] = '1';
-                $this->assertTrue( is_ssl() );
-
-                unset( $_SERVER['HTTPS'] );
-                $_SERVER['SERVER_PORT'] = '443';
-                $this->assertTrue( is_ssl() );
-        }
-
-        function test_is_ssl_negative() {
-                $_SERVER['HTTPS'] = 'off';
-                $this->assertFalse( is_ssl() );
-
-                $_SERVER['HTTPS'] = 'OFF';
-                $this->assertFalse( is_ssl() );
-
-                unset($_SERVER['HTTPS']);
-                $this->assertFalse( is_ssl() );
-        }
-
-        function test_admin_url_valid() {
-                $paths = array(
-                        '' => "/wp-admin/",
-                        'foo' => "/wp-admin/foo",
-                        '/foo' => "/wp-admin/foo",
-                        '/foo/' => "/wp-admin/foo/",
-                        'foo.php' => "/wp-admin/foo.php",
-                        '/foo.php' => "/wp-admin/foo.php",
-                        '/foo.php?bar=1' => "/wp-admin/foo.php?bar=1",
-                );
-                $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 => $out) {
-                                $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
-                        }
-                }
-        }
-
-        function test_admin_url_invalid() {
-                $paths = array(
-                        null => "/wp-admin/",
-                        0 => "/wp-admin/",
-                        -1 => "/wp-admin/",
-                        '../foo/' => "/wp-admin/",
-                        '///' => "/wp-admin/",
-                );
-                $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 => $out) {
-                                $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
-                        }
-                }
-        }
-
-        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->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );
-                        $this->assertEquals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );
-
-                        $_SERVER['HTTPS'] = 'on';
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link ) );
-
-                        $_SERVER['HTTPS'] = 'off';
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link ) );
-
-                        force_ssl_login( false );
-                        force_ssl_admin( true );
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
-
-                        force_ssl_admin( false );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );
-
-                        force_ssl_login( true );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
-                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
-                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
-                        $this->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>-<?php
-
-/**
- * just make sure the test framework is working
- *
- * @group testsuite
- */
-class WPTestMeta extends WP_UnitTestCase {
-        var $val;
-
-        function setUp() {
-                parent::setUp();
-                $this->val = true;
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $this->val = false;
-        }
-
-        function test_true() {
-                $this->assertTrue($this->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->assertEquals($test_foo, array(0=>'foo', 2=>'baz'));
-                $this->assertEquals($test_foo, $GLOBALS['test_foo']);
-        }
-
-        function test_globals_bar() {
-                global $test_bar;
-                $test_bar = array('a', 'b', 'c');
-                $this->assertEquals($test_bar, $GLOBALS['test_bar']);
-        }
-
-}
-
-/**
- * test helper utility functions
- *
- * @group testsuite
- */
-class WPTestUtils extends WP_UnitTestCase {
-
-        function test_strip_ws() {
-                $this->assertEquals('', strip_ws(''));
-                $this->assertEquals('foo', strip_ws('foo'));
-                $this->assertEquals('', strip_ws("\r\n\t \n\r\t"));
-
-                $in = "asdf\n";
-                $in .= "asdf asdf\n";
-                $in .= "asdf asdf\n";
-                $in .= "\tasdf\n";
-                $in .= "\tasdf\t\n";
-                $in .= "\t\tasdf\n";
-                $in .= "foo bar\n\r\n";
-                $in .= "foo\n";
-
-                $expected = "asdf\n";
-                $expected .= "asdf asdf\n";
-                $expected .= "asdf asdf\n";
-                $expected .= "asdf\n";
-                $expected .= "asdf\n";
-                $expected .= "asdf\n";
-                $expected .= "foo bar\n";
-                $expected .= "foo";
-
-                $this->assertEquals($expected, strip_ws($in));
-
-        }
-
-        function test_mask_input_value() {
-                $in = <<<EOF
-<h2>Assign Authors</h2>
-<p>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 <code>admin</code>s entries.</p>
-<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
- <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="855ae98911" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
-EOF;
-                // _wpnonce value should be replaced with 'xxx'
-                $expected = <<<EOF
-<h2>Assign Authors</h2>
-<p>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 <code>admin</code>s entries.</p>
-<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
- <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="***" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
-EOF;
-                $this->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>-<?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->factory->blog->create_many( 4 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this->assertInternalType( 'int', $blog_id );
-                        $prefix = $wpdb->get_blog_prefix( $blog_id );
-
-                        foreach ( $wpdb->tables( 'blog', false ) as $table ) {
-                                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
-                                $this->assertNotEmpty( $table_fields );
-                                $result = $wpdb->get_results( "SELECT * FROM $prefix$table LIMIT 1" );
-                                if ( 'commentmeta' == $table )
-                                        $this->assertEmpty( $result );
-                                else
-                                        $this->assertNotEmpty( $result );
-                        }
-                }
-
-                // update the blog count cache to use get_blog_count()
-                wp_update_network_counts();
-                $this->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->get_blog_prefix( $blog_id );
-                        foreach ( $wpdb->tables( 'blog', false ) as $table ) {
-                                $table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
-                                if ( $drop_tables )
-                                        $this->assertEmpty( $table_fields );
-                                else
-                                        $this->assertNotEmpty( $table_fields, $prefix . $table );
-                        }
-                }
-
-                // update the blog count cache to use get_blog_count()
-                wp_update_network_counts();
-                $this->assertEquals( 1, get_blog_count() );
-        }
-
-        function test_get_blogs_of_user() {
-                global $current_site;
-
-                // Logged out users don't have blogs.
-                $this->assertEquals( array(), get_blogs_of_user( 0 ) );
-
-                $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                $blog_ids = $this->factory->blog->create_many( 10, array( 'user_id' => $user1_id ) );
-
-                foreach ( $blog_ids as $blog_id )
-                        $this->assertInternalType( 'int', $blog_id );
-
-                $blogs_of_user = array_keys( get_blogs_of_user( $user1_id, $all = false ) );
-                sort( $blogs_of_user );
-                $this->assertEquals ( array_merge( array( 1 ), $blog_ids), $blogs_of_user );
-
-                $this->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->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->assertFalse( $user->exists(), 'WP_User->exists' );
-                $this->assertEquals( array(), get_blogs_of_user( $user1_id ) );
-        }
-
-        function test_is_blog_user() {
-                global $current_site, $wpdb;
-
-                $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-
-                $old_current = get_current_user_id();
-                wp_set_current_user( $user1_id );
-
-                $this->assertTrue( is_blog_user() );
-                $this->assertTrue( is_blog_user( $wpdb->blogid ) );
-
-                $blog_ids = array();
-
-                $blog_ids = $this->factory->blog->create_many( 5 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this->assertInternalType( 'int', $blog_id );
-                        $this->assertTrue( is_blog_user( $blog_id ) );
-                        $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
-                        $this->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->factory->user->create( array( 'role' => 'administrator' ) );
-
-                $old_current = get_current_user_id();
-                wp_set_current_user( $user1_id );
-
-                $this->assertTrue( is_user_member_of_blog() );
-                $this->assertTrue( is_user_member_of_blog( 0, 0 ) );
-                $this->assertTrue( is_user_member_of_blog( 0, $wpdb->blogid ) );
-                $this->assertTrue( is_user_member_of_blog( $user1_id ) );
-                $this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) );
-
-                $blog_ids = $this->factory->blog->create_many( 5 );
-                foreach ( $blog_ids as $blog_id ) {
-                        $this->assertInternalType( 'int', $blog_id );
-                        $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) );
-                        $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
-                        $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) );
-                }
-
-                wpmu_delete_user( $user1_id );
-                $user = new WP_User( $user1_id );
-                $this->assertFalse( $user->exists(), 'WP_User->exists' );
-                $this->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 = "hello.php";
-
-                // local activate, should be invisible for the network
-                activate_plugin($path); // $network_wide = false
-                $active_plugins = wp_get_active_network_plugins();
-                $this->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->assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins );
-
-                //deactivate the plugin
-                deactivate_plugins($path);
-                $active_plugins = wp_get_active_network_plugins();
-                $this->assertEquals( Array(), $active_plugins );
-
-                $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
-
-                activate_plugin($path, '', $network_wide = true);
-                deactivate_plugins($path, true); // silent
-
-                $this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
-        }
-
-        function _helper_deactivate_hook() {
-                $this->plugin_hook_count++;
-        }
-
-        function test_get_user_count() {
-                // Refresh the cache
-                wp_update_network_counts();
-                $start_count = get_user_count();
-
-                $this->factory->user->create( array( 'role' => 'administrator' ) );
-
-                $count = get_user_count(); // No change, cache not refreshed
-                $this->assertEquals( $start_count, $count );
-
-                wp_update_network_counts(); // Magic happens here
-
-                $count = get_user_count();
-                $this->assertEquals( $start_count + 1, $count );
-        }
-
-        function test_wp_schedule_update_network_counts() {
-                $this->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->assertInternalType('int', wp_next_scheduled('update_network_counts'));
-        }
-
-        function test_users_can_register_signup_filter() {
-
-                $registration = get_site_option('registration');
-                $this->assertFalse( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'all');
-                $this->assertTrue( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'user');
-                $this->assertTrue( users_can_register_signup_filter() );
-
-                update_site_option('registration', 'none');
-                $this->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->assertEquals( 1, $dashboard_blog->blog_id );
-
-                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
-                $this->assertInternalType( 'int', $blog_id );
-
-                // set the dashboard blog to another one
-                update_site_option( 'dashboard_blog', $blog_id );
-                $dashboard_blog = get_dashboard_blog();
-                $this->assertEquals( $blog_id, $dashboard_blog->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->get_col( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE '" . $ip . "'" );
-                $this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog )-1 ] );
-        }
-
-        /**
-         * @ticket 18119
-         */
-        function test_upload_is_user_over_quota() {
-                $default_space_allowed = 50;
-                $echo = false;
-
-                $this->assertFalse( upload_is_user_over_quota( $echo ) );
-                $this->assertTrue( is_upload_space_available() );
-
-                update_site_option('upload_space_check_disabled', true);
-                $this->assertFalse( upload_is_user_over_quota( $echo ) );
-                $this->assertTrue( is_upload_space_available() );
-
-                update_site_option( 'blog_upload_space', 0 );
-                $this->assertFalse( upload_is_user_over_quota( $echo ) );
-                $this->assertEquals( $default_space_allowed, get_space_allowed() );
-                $this->assertTrue( is_upload_space_available() );
-
-                update_site_option('upload_space_check_disabled', false);
-                $this->assertFalse( upload_is_user_over_quota( $echo ) );
-                $this->assertTrue( is_upload_space_available() );
-
-                if ( ! file_exists( BLOGSUPLOADDIR ) )
-                        $this->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, < 0 is returned as 0.
-                */
-
-                update_site_option( 'blog_upload_space', -1 );
-                $this->assertTrue( upload_is_user_over_quota( $echo ) );
-                $this->assertEquals( -1, get_space_allowed() );
-                $this->assertFalse( is_upload_space_available() );
-
-                update_option( 'blog_upload_space', 0 );
-                $this->assertFalse( upload_is_user_over_quota( $echo ) );
-                $this->assertEquals( $default_space_allowed, get_space_allowed() );
-                $this->assertTrue( is_upload_space_available() );
-
-                update_option( 'blog_upload_space', -1 );
-                $this->assertTrue( upload_is_user_over_quota( $echo ) );
-                $this->assertEquals( -1, get_space_allowed() );
-                $this->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 < 2
-                $blog = get_blog_details( $wpdb->blogid );
-                $current_time = time();
-                $time_difference = $current_time - strtotime( $blog->last_updated );
-                $this->assertLessThan( 2, $time_difference );
-        }
-
-        function test_getters(){
-                global $current_site;
-
-                $blog_id = get_current_blog_id();
-                $blog = get_blog_details( $blog_id );
-                $this->assertEquals( $blog_id, $blog->blog_id );
-                $this->assertEquals( $current_site->domain, $blog->domain );
-                $this->assertEquals( '/', $blog->path );
-
-                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogname', 'title' => 'Test Title' ) );
-                $this->assertInternalType( 'int', $blog_id );
-
-                $this->assertEquals( 'http://' . DOMAIN_CURRENT_SITE . PATH_CURRENT_SITE . 'test_blogname/', get_blogaddress_by_name('test_blogname') );
-
-                $this->assertEquals( $blog_id, get_id_from_blogname('test_blogname') );
-        }
-
-        function test_update_blog_details() {
-                global $current_site;
-
-                $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
-                $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
-                $this->assertInternalType( 'int', $blog_id );
-
-                $result = update_blog_details( $blog_id, array('domain' => 'example.com', 'path' => 'my_path/') );
-                $this->assertTrue( $result );
-
-                $blog = get_blog_details( $blog_id );
-                $this->assertEquals( 'example.com', $blog->domain );
-                $this->assertEquals( 'my_path/', $blog->path );
-                $this->assertEquals( '0', $blog->spam );
-
-                $result = update_blog_details( $blog_id, array('domain' => 'example2.com','spam' => 1) );
-                $this->assertTrue( $result );
-                $blog = get_blog_details( $blog_id );
-                $this->assertEquals( 'example2.com', $blog->domain );
-                $this->assertEquals( 'my_path/', $blog->path );
-                $this->assertEquals( '1', $blog->spam );
-
-                $result = update_blog_details( $blog_id );
-                $this->assertFalse( $result );
-                $blog = get_blog_details( $blog_id );
-                $this->assertEquals( 'example2.com', $blog->domain );
-                $this->assertEquals( 'my_path/', $blog->path );
-                $this->assertEquals( '1', $blog->spam );
-                $this->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>-<?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->assertFalse( get_option( 'doesnotexist' ) );
-                $this->assertTrue( add_option( $key, $value ) );
-                $this->assertEquals( $value, get_option( $key ) );
-                $this->assertFalse( add_option( $key, $value ) ); // Already exists
-                $this->assertFalse( update_option( $key, $value ) ); // Value is the same
-                $this->assertTrue( update_option( $key, $value2 ) );
-                $this->assertEquals( $value2, get_option( $key ) );
-                $this->assertFalse( add_option( $key, $value ) );
-                $this->assertEquals( $value2, get_option( $key ) );
-                $this->assertTrue( delete_option( $key ) );
-                $this->assertFalse( get_option( $key ) );
-                $this->assertFalse( delete_option( $key ) );
-
-                $this->assertTrue( update_option( $key2, $value2 ) );
-                $this->assertEquals( $value2, get_option( $key2 ) );
-                $this->assertTrue( delete_option( $key2 ) );
-                $this->assertFalse( get_option( $key2 ) );
-        }
-
-        function test_default_filter() {
-                $random = rand_str();
-
-                $this->assertFalse( get_option( 'doesnotexist' ) );
-
-                // Default filter overrides $default arg.
-                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this->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->assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
-
-                // Once the option exists, the $default arg and the default filter are ignored.
-                add_option( 'doesnotexist', $random );
-                $this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
-                add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
-                remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
-
-                // Cleanup
-                $this->assertTrue( delete_option( 'doesnotexist' ) );
-                $this->assertFalse( get_option( 'doesnotexist' ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' => true, 'bar' => true );
-
-                $this->assertTrue( add_option( $key, $value ) );
-                $this->assertEquals( $value, get_option( $key ) );
-
-                $value = (object) $value;
-                $this->assertTrue( update_option( $key, $value ) );
-                $this->assertEquals( $value, get_option( $key ) );
-                $this->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->assertFalse( get_site_option( 'doesnotexist' ) );
-                $this->assertTrue( add_site_option( $key, $value ) );
-                $this->assertEquals( $value, get_site_option( $key ) );
-                $this->assertFalse( add_site_option( $key, $value ) ); // Already exists
-                $this->assertFalse( update_site_option( $key, $value ) ); // Value is the same
-                $this->assertTrue( update_site_option( $key, $value2 ) );
-                $this->assertEquals( $value2, get_site_option( $key ) );
-                $this->assertFalse( add_site_option( $key, $value ) );
-                $this->assertEquals( $value2, get_site_option( $key ) );
-                $this->assertTrue( delete_site_option( $key ) );
-                $this->assertFalse( get_site_option( $key ) );
-                $this->assertFalse( delete_site_option( $key ) );
-
-                $this->assertTrue( update_site_option( $key2, $value2 ) );
-                $this->assertEquals( $value2, get_site_option( $key2 ) );
-                $this->assertTrue( delete_site_option( $key2 ) );
-                $this->assertFalse( get_site_option( $key2 ) );
-        }
-
-        function test_default_filter() {
-                $random = rand_str();
-
-                $this->assertFalse( get_site_option( 'doesnotexist' ) );
-
-                // Default filter overrides $default arg.
-                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this->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->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->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
-                add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-                $this->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
-                remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
-
-                // Cleanup
-                $this->assertTrue( delete_site_option( 'doesnotexist' ) );
-                $this->assertFalse( get_site_option( 'doesnotexist' ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' => true, 'bar' => true );
-
-                $this->assertTrue( add_site_option( $key, $value ) );
-                $this->assertEquals( $value, get_site_option( $key ) );
-
-                $value = (object) $value;
-                $this->assertTrue( update_site_option( $key, $value ) );
-                $this->assertEquals( $value, get_site_option( $key ) );
-                $this->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->assertTrue( update_site_option( $key, $value ) );
-                wp_cache_flush(); // ensure we're getting the value from the DB
-                $this->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->assertEquals( get_site_option( $option, $default ), $default );
-                $this->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->assertFalse( get_transient( 'doesnotexist' ) );
-                $this->assertTrue( set_transient( $key, $value ) );
-                $this->assertEquals( $value, get_transient( $key ) );
-                $this->assertFalse( set_transient( $key, $value ) );
-                $this->assertTrue( set_transient( $key, $value2 ) );
-                $this->assertEquals( $value2, get_transient( $key ) );
-                $this->assertTrue( delete_transient( $key ) );
-                $this->assertFalse( get_transient( $key ) );
-                $this->assertFalse( delete_transient( $key ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' => true, 'bar' => true );
-
-                $this->assertTrue( set_transient( $key, $value ) );
-                $this->assertEquals( $value, get_transient( $key ) );
-
-                $value = (object) $value;
-                $this->assertTrue( set_transient( $key, $value ) );
-                $this->assertEquals( $value, get_transient( $key ) );
-                $this->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->assertFalse( get_site_transient( 'doesnotexist' ) );
-                $this->assertTrue( set_site_transient( $key, $value ) );
-                $this->assertEquals( $value, get_site_transient( $key ) );
-                $this->assertFalse( set_site_transient( $key, $value ) );
-                $this->assertTrue( set_site_transient( $key, $value2 ) );
-                $this->assertEquals( $value2, get_site_transient( $key ) );
-                $this->assertTrue( delete_site_transient( $key ) );
-                $this->assertFalse( get_site_transient( $key ) );
-                $this->assertFalse( delete_site_transient( $key ) );
-        }
-
-        function test_serialized_data() {
-                $key = rand_str();
-                $value = array( 'foo' => true, 'bar' => true );
-
-                $this->assertTrue( set_site_transient( $key, $value ) );
-                $this->assertEquals( $value, get_site_transient( $key ) );
-
-                $value = (object) $value;
-                $this->assertTrue( set_site_transient( $key, $value ) );
-                $this->assertEquals( $value, get_site_transient( $key ) );
-                $this->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->assertFalse( get_blog_option( 1, 'doesnotexist' ) );
-                $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
-
-                $this->assertTrue( add_blog_option( 1, $key, $value ) );
-                // Assert all values of $blog_id that means the current or main blog (the same here).
-                $this->assertEquals( $value, get_blog_option( 1, $key ) );
-                $this->assertEquals( $value, get_blog_option( null, $key ) );
-                $this->assertEquals( $value, get_blog_option( '1', $key ) );
-                $this->assertEquals( $value, get_option( $key ) ); // check get_option()
-
-                $this->assertFalse( add_blog_option( 1, $key, $value ) ); // Already exists
-                $this->assertFalse( update_blog_option( 1, $key, $value ) ); // Value is the same
-                $this->assertTrue( update_blog_option( 1, $key, $value2 ) );
-                $this->assertEquals( $value2, get_blog_option( 1, $key ) );
-                $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
-                $this->assertFalse( add_blog_option( 1, $key, $value ) );
-                $this->assertEquals( $value2, get_blog_option( 1, $key ) );
-                $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
-
-                $this->assertTrue( delete_blog_option( 1, $key ) );
-                $this->assertFalse( get_blog_option( 1, $key ) );
-                $this->assertFalse( get_option( $key ) ); // check get_option()
-                $this->assertFalse( delete_blog_option( 1, $key ) );
-                $this->assertTrue( update_blog_option( 1, $key2, $value2 ) );
-                $this->assertEquals( $value2, get_blog_option( 1, $key2 ) );
-                $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
-                $this->assertTrue( delete_blog_option( 1, $key2 ) );
-                $this->assertFalse( get_blog_option( 1, $key2 ) );
-                $this->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>-<?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 = <<<EOF
-<foobar>no such tag</foobar>
-EOF;
-
-                $expected = <<<EOF
-no such tag
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->post_content );
-        }
-
-        // a simple test to make sure unbalanced tags are fixed
-        function test_post_content_unbalanced_tag() {
-
-                $content = <<<EOF
-<i>italics
-EOF;
-
-                $expected = <<<EOF
-<i>italics</i>
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->post_content );
-        }
-
-        // test kses filtering of disallowed attribute
-        function test_post_content_disallowed_attr() {
-
-                $content = <<<EOF
-<img src='foo' width='500' href='shlorp' />
-EOF;
-
-                $expected = <<<EOF
-<img src='foo' width='500' />
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->post_content );
-        }
-
-        /**
-         * test kses bug. xhtml does not require space before closing empty element
-         * @ticket 12394
-         */
-        function test_post_content_xhtml_empty_elem() {
-                $content = <<<EOF
-<img src='foo' width='500' height='300'/>
-EOF;
-
-                $expected = <<<EOF
-<img src='foo' width='500' height='300' />
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span a --more-- tag
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_more() {
-                $content = <<<EOF
-<em>some text<!--more-->
-that's continued after the jump</em>
-EOF;
-
-                $expected = <<<EOF
-<em>some text</em><!--more-->
-that's continued after the jump
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->post_content );
-        }
-
-        /**
-         * make sure unbalanced tags are fixed when they span a --nextpage-- tag
-         * @ticket 6297
-         */
-        function test_post_content_unbalanced_nextpage() {
-                $content = <<<EOF
-<em>some text<!--nextpage-->
-that's continued after the jump</em>
-EOF;
-
-                $expected = <<<EOF
-<em>some text</em><!--nextpage-->
-that's continued after the jump
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->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 = <<<EOF
-<em>some text<!--more-->
-that's continued after the jump</em>
-<!--nextpage-->
-<p>and the next page
-<!--nextpage-->
-breaks the graf</p>
-EOF;
-
-                $expected = <<<EOF
-<em>some text</em><!--more-->
-that's continued after the jump
-<!--nextpage-->
-<p>and the next page
-</p><!--nextpage-->
-breaks the graf
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->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 = <<<EOF
-<em>some text<!--nextpage-->
-that's continued after the jump</em>
-<!--more-->
-<p>and the next page
-<!--nextpage-->
-breaks the graf</p>
-EOF;
-
-                $expected = <<<EOF
-<em>some text</em><!--nextpage-->
-that's continued after the jump
-<!--more-->
-<p>and the next page
-</p><!--nextpage-->
-breaks the graf
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $expected, $post->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 = <<<EOF
-<em>some text<!--nextpage-->
-that's continued after the jump</em>
-<!--more-->
-<p>and the next page
-<!--nextpage-->
-breaks the graf</p>
-EOF;
-
-                $id = $this->factory->post->create( array( 'post_content' => $content ) );
-                $post = get_post($id);
-
-                $this->assertEquals( $content, $post->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>-<?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']->init();
-                flush_rewrite_rules();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                $GLOBALS['wp_rewrite']->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->$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->assertTrue( $passed, $message );
-        }
-
-        function test_home() {
-                $this->go_to('/');
-                $this->assertQueryTrue('is_home');
-        }
-
-        function test_404() {
-                $this->go_to('/'.rand_str());
-                $this->assertQueryTrue('is_404');
-        }
-
-        function test_permalink() {
-                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
-                $this->go_to( get_permalink( $post_id ) );
-                $this->assertQueryTrue('is_single', 'is_singular');
-        }
-
-        function test_post_comments_feed() {
-                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
-                $this->factory->comment->create_post_comments( $post_id, 2 );
-                $this->go_to( get_post_comments_feed_link( $post_id ) );
-                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-
-        function test_post_comments_feed_with_no_comments() {
-                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
-                $this->go_to( get_post_comments_feed_link( $post_id ) );
-                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
-        }
-
-        function test_page() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
-                $this->go_to( get_permalink( $page_id ) );
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_parent_page() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $this->go_to( get_permalink( $page_id ) );
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_1() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $this->go_to( get_permalink( $page_id ) );
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        function test_child_page_2() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
-                $this->go_to( get_permalink( $page_id ) );
-
-                $this->assertQueryTrue('is_page','is_singular');
-        }
-
-        // '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
-        function test_page_trackback() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $url = get_permalink( $page_id );
-                        $this->go_to("{$url}trackback/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page','is_singular','is_trackback');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        //'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
-        function test_page_feed() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $this->factory->comment->create_post_comments( $page_id, 2 );
-                        $url = get_permalink( $page_id );
-                        $this->go_to("{$url}feed/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        function test_page_feed_with_no_comments() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $url = get_permalink( $page_id );
-                        $this->go_to("{$url}feed/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        // '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
-        function test_page_feed_atom() {
-                $page_ids = array();
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
-                $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
-                foreach ( $page_ids as $page_id ) {
-                        $this->factory->comment->create_post_comments( $page_id, 2 );
-
-                        $url = get_permalink( $page_id );
-                        $this->go_to("{$url}feed/atom/");
-
-                        // make sure the correct wp_query flags are set
-                        $this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
-
-                        // make sure the correct page was fetched
-                        global $wp_query;
-                        $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-                }
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
-        function test_page_page_2() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
-                $this->go_to("/about/page/2/");
-
-                // make sure the correct wp_query flags are set
-                $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-        }
-
-        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
-        function test_page_page_2_no_slash() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
-                $this->go_to("/about/page2/");
-
-                // make sure the correct wp_query flags are set
-                $this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-        }
-
-        // FIXME: what is this for?
-        // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
-        function test_pagination_of_posts_page() {
-                $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
-                update_option( 'show_on_front', 'page' );
-                update_option( 'page_for_posts', $page_id );
-
-                $this->go_to('/about/2/');
-
-                $this->assertQueryTrue( 'is_home', 'is_posts_page' );
-
-                // make sure the correct page was fetched
-                global $wp_query;
-                $this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
-        }
-
-        // FIXME: no tests for these yet
-        // 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        // 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-
-        // 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
-        // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
-        function test_main_feed_2() {
-                $this->factory->post->create(); // @test_404
-                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-
-                // long version
-                foreach ($feeds as $feed) {
-                        $this->go_to("/feed/{$feed}/");
-                        $this->assertQueryTrue('is_feed');
-                }
-
-                // short version
-                foreach ($feeds as $feed) {
-                        $this->go_to("/{$feed}/");
-                        $this->assertQueryTrue('is_feed');
-                }
-
-        }
-
-        function test_main_feed() {
-                $this->factory->post->create(); // @test_404
-                $types = array('rss2', 'rss', 'atom');
-                foreach ($types as $type) {
-                        $this->go_to(get_feed_link($type));
-                        $this->assertQueryTrue('is_feed');
-                }
-        }
-
-        // 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
-        function test_paged() {
-                $this->factory->post->create_many( 15 );
-                for ( $i = 2; $i <= 3; $i++ ) {
-                        $this->go_to("/page/{$i}/");
-                        $this->assertQueryTrue('is_home', 'is_paged');
-                }
-        }
-
-        // 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
-        // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
-        function test_main_comments_feed() {
-                $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
-                $this->factory->comment->create_post_comments( $post_id, 2 );
-
-                // check the url as generated by get_post_comments_feed_link()
-                $this->go_to( get_post_comments_feed_link( $post_id ) );
-                $this->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->go_to("/comments/feed/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/comments/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_comment_feed');
-                }
-
-        }
-
-        // 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
-        // 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
-        function test_search_feed() {
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/search/test/feed/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_search');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/search/test/{$type}");
-                                $this->assertQueryTrue('is_feed', 'is_search');
-                }
-        }
-
-        // 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
-        function test_search_paged() {
-                $this->factory->post->create_many( 10, array( 'post_title' => 'test' ) );
-                $this->go_to('/search/test/page/2/');
-                $this->assertQueryTrue('is_search', 'is_paged');
-        }
-
-        // 'search/(.+)/?$' => 'index.php?s=$matches[1]',
-        function test_search() {
-                $this->go_to('/search/test/');
-                $this->assertQueryTrue('is_search');
-        }
-
-        /**
-         * @ticket 13961
-         */
-        function test_search_encoded_chars() {
-                $this->go_to('/search/F%C3%BCnf%2Bbar/');
-                $this->assertEquals( get_query_var( 's' ), 'Fünf+bar' );
-        }
-
-        // 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
-        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
-        function test_category_feed() {
-                $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/category/cat-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/category/cat-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
-                }
-        }
-
-        // 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
-        function test_category_paged() {
-                $this->factory->post->create_many( 10 );
-                $this->go_to('/category/uncategorized/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
-        }
-
-        // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
-        function test_category() {
-                $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
-                $this->go_to('/category/cat-a/');
-                $this->assertQueryTrue('is_archive', 'is_category');
-        }
-
-        // 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
-        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
-        function test_tag_feed() {
-                $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/tag/tag-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/tag/tag-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
-                }
-        }
-
-        // 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
-        function test_tag_paged() {
-                $post_ids = $this->factory->post->create_many( 10 );
-                foreach ( $post_ids as $post_id )
-                        $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
-                $this->go_to('/tag/tag-a/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
-        }
-
-        // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
-        function test_tag() {
-                $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
-                $this->go_to('/tag/tag-a/');
-                $this->assertQueryTrue('is_archive', 'is_tag');
-        }
-
-        // 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
-        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
-        function test_author_feed() {
-                $this->factory->user->create( array( 'user_login' => 'user-a' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/author/user-a/feed/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-
-                // check the short form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/author/user-a/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
-                }
-        }
-
-        // 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
-        function test_author_paged() {
-                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
-                $this->factory->post->create_many( 10, array( 'post_author' => $user_id ) );
-                $this->go_to('/author/user-a/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
-        }
-
-        // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
-        function test_author() {
-                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
-                $this->factory->post->create( array( 'post_author' => $user_id ) );
-                $this->go_to('/author/user-a/');
-                $this->assertQueryTrue('is_archive', 'is_author');
-        }
-
-        function test_author_with_no_posts() {
-                $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
-                $this->go_to('/author/user-a/');
-                $this->assertQueryTrue('is_archive', 'is_author');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
-        function test_ymd_feed() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/2007/09/04/feed/{$type}");
-                                $this->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->go_to("/2007/09/04/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
-        function test_ymd_paged() {
-                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/09/04/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
-        function test_ymd() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/09/04/');
-                $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
-        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
-        function test_ym_feed() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/2007/09/feed/{$type}");
-                                $this->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->go_to("/2007/09/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
-        function test_ym_paged() {
-                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/09/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
-        function test_ym() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/09/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
-        }
-
-        // '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
-        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
-        function test_y_feed() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                // check the long form
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("/2007/feed/{$type}");
-                                $this->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->go_to("/2007/{$type}");
-                                $this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
-                }
-        }
-
-        // '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
-        function test_y_paged() {
-                $this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/page/2/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
-        }
-
-        // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
-        function test_y() {
-                $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
-                $this->go_to('/2007/');
-                $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
-        function test_post_trackback() {
-                $post_id = $this->factory->post->create();
-                $permalink = get_permalink( $post_id );
-                $this->go_to("{$permalink}trackback/");
-                $this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
-        function test_post_comment_feed() {
-                $post_id = $this->factory->post->create();
-                $permalink = get_permalink( $post_id );
-
-                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
-                foreach ($types as $type) {
-                                $this->go_to("{$permalink}feed/{$type}");
-                                $this->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->go_to("{$permalink}{$type}");
-                                $this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
-                }
-        }
-
-        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
-        function test_post_paged_short() {
-                $post_id = $this->factory->post->create( array(
-                        'post_date' => '2007-09-04 00:00:00',
-                        'post_title' => 'a-post-with-multiple-pages',
-                        'post_content' => 'Page 1 <!--nextpage--> Page 2'
-                ) );
-                $this->go_to( get_permalink( $post_id ) . '2/' );
-                // should is_paged be true also?
-                $this->assertQueryTrue('is_single', 'is_singular');
-
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        function test_post_attachment() {
-                $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
-                $permalink = get_attachment_link( $post_id );
-                $this->go_to($permalink);
-                $this->assertQueryTrue('is_single', 'is_attachment', 'is_singular');
-        }
-
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
-        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&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']->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>-<?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->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
-                $cat_b = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
-                $cat_c = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-c' ) );
-
-                $this->factory->post->create( array( 'post_title' => 'cats-a-b-c', 'post_date' => '2008-12-01 00:00:00', 'post_category' => array( $cat_a, $cat_b, $cat_c ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cats-a-and-b', 'post_date' => '2009-01-01 00:00:00', 'post_category' => array( $cat_a, $cat_b ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cats-b-and-c', 'post_date' => '2009-02-01 00:00:00', 'post_category' => array( $cat_b, $cat_c ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cats-a-and-c', 'post_date' => '2009-03-01 00:00:00', 'post_category' => array( $cat_a, $cat_c ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cat-a', 'post_date' => '2009-04-01 00:00:00', 'post_category' => array( $cat_a ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cat-b', 'post_date' => '2009-05-01 00:00:00', 'post_category' => array( $cat_b ) ) );
-                $this->factory->post->create( array( 'post_title' => 'cat-c', 'post_date' => '2009-06-01 00:00:00', 'post_category' => array( $cat_c ) ) );
-                $this->factory->post->create( array( 'post_title' => 'lorem-ipsum', 'post_date' => '2009-07-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'comment-test', 'post_date' => '2009-08-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'one-trackback', 'post_date' => '2009-09-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'many-trackbacks', 'post_date' => '2009-10-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'no-comments', 'post_date' => '2009-10-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'one-comment', 'post_date' => '2009-11-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'contributor-post-approved', 'post_date' => '2009-12-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'embedded-video', 'post_date' => '2010-01-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'simple-markup-test', 'post_date' => '2010-02-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'raw-html-code', 'post_date' => '2010-03-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tags-a-b-c', 'tags_input' => array( 'tag-a', 'tag-b', 'tag-c' ), 'post_date' => '2010-04-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tag-a', 'tags_input' => array( 'tag-a' ), 'post_date' => '2010-05-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tag-b', 'tags_input' => array( 'tag-b' ), 'post_date' => '2010-06-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tag-c', 'tags_input' => array( 'tag-c' ), 'post_date' => '2010-07-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tags-a-and-b', 'tags_input' => array( 'tag-a', 'tag-b' ), 'post_date' => '2010-08-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tags-b-and-c', 'tags_input' => array( 'tag-b', 'tag-c' ), 'post_date' => '2010-09-01 00:00:00' ) );
-                $this->factory->post->create( array( 'post_title' => 'tags-a-and-c', 'tags_input' => array( 'tag-a', 'tag-c' ), 'post_date' => '2010-10-01 00:00:00' ) );
-
-                unset( $this->q );
-                $this->q = new WP_Query();
-        }
-
-        function test_query_default() {
-                $posts = $this->q->query('');
-
-                // the output should be the most recent 10 posts as listed here
-                $expected = array(
-                        0 => 'tags-a-and-c',
-                        1 => 'tags-b-and-c',
-                        2 => 'tags-a-and-b',
-                        3 => 'tag-c',
-                        4 => 'tag-b',
-                        5 => 'tag-a',
-                        6 => 'tags-a-b-c',
-                        7 => 'raw-html-code',
-                        8 => 'simple-markup-test',
-                        9 => 'embedded-video',
-                );
-
-                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_tag_a() {
-                $posts = $this->q->query('tag=tag-a');
-
-                // there are 4 posts with Tag A
-                $this->assertCount( 4, $posts );
-                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
-                $this->assertEquals( 'tag-a', $posts[2]->post_name );
-                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
-        }
-
-        function test_query_tag_b() {
-                $posts = $this->q->query('tag=tag-b');
-
-                // there are 4 posts with Tag A
-                $this->assertCount( 4, $posts );
-                $this->assertEquals( 'tags-b-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
-                $this->assertEquals( 'tag-b', $posts[2]->post_name );
-                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
-        }
-
-        function test_query_tag_id() {
-                $tag = tag_exists('tag-a');
-                $posts = $this->q->query("tag_id={$tag[term_id]}");
-
-                // there are 4 posts with Tag A
-                $this->assertCount( 4, $posts );
-                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
-                $this->assertEquals( 'tag-a', $posts[2]->post_name );
-                $this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
-        }
-
-        function test_query_tag_slug__in() {
-                $posts = $this->q->query("tag_slug__in[]=tag-b&tag_slug__in[]=tag-c");
-
-                // there are 4 posts with either Tag B or Tag C
-                $this->assertCount( 6, $posts );
-                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
-                $this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
-                $this->assertEquals( 'tag-c', $posts[3]->post_name );
-                $this->assertEquals( 'tag-b', $posts[4]->post_name );
-                $this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
-        }
-
-
-        function test_query_tag__in() {
-                $tag_a = tag_exists('tag-a');
-                $tag_b = tag_exists('tag-b');
-                $posts = $this->q->query("tag__in[]={$tag_a[term_id]}&tag__in[]={$tag_b[term_id]}");
-
-                // there are 6 posts with either Tag A or Tag B
-                $this->assertCount( 6, $posts );
-                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
-                $this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
-                $this->assertEquals( 'tag-b', $posts[3]->post_name );
-                $this->assertEquals( 'tag-a', $posts[4]->post_name );
-                $this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
-        }
-
-        function test_query_tag__not_in() {
-                $tag_a = tag_exists('tag-a');
-                $posts = $this->q->query("tag__not_in[]={$tag_a[term_id]}");
-
-                // the most recent 10 posts with Tag A excluded
-                // (note the different between this and test_query_default)
-                $expected = array (
-                        0 => 'tags-b-and-c',
-                        1 => 'tag-c',
-                        2 => 'tag-b',
-                        3 => 'raw-html-code',
-                        4 => 'simple-markup-test',
-                        5 => 'embedded-video',
-                        6 => 'contributor-post-approved',
-                        7 => 'one-comment',
-                        8 => 'no-comments',
-                        9 => 'many-trackbacks',
-                );
-
-                $this->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->q->query("tag__in[]={$tag_a[term_id]}&tag__not_in[]={$tag_b[term_id]}");
-
-                // there are 4 posts with Tag A, only 2 when we exclude Tag B
-                $this->assertCount( 2, $posts );
-                $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
-                $this->assertEquals( 'tag-a', $posts[1]->post_name );
-        }
-
-
-
-        function test_query_category_name() {
-                $posts = $this->q->query('category_name=cat-a');
-
-                // there are 4 posts with Cat A, we'll check for them by name
-                $this->assertCount( 4, $posts );
-                $this->assertEquals( 'cat-a', $posts[0]->post_name );
-                $this->assertEquals( 'cats-a-and-c', $posts[1]->post_name );
-                $this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
-                $this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
-        }
-
-        function test_query_cat() {
-                $cat = category_exists('cat-b');
-                $posts = $this->q->query("cat=$cat");
-
-                // there are 4 posts with Cat B
-                $this->assertCount( 4, $posts );
-                $this->assertEquals( 'cat-b', $posts[0]->post_name );
-                $this->assertEquals( 'cats-b-and-c', $posts[1]->post_name );
-                $this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
-                $this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
-        }
-
-        function test_query_posts_per_page() {
-                $posts = $this->q->query('posts_per_page=5');
-
-                $expected = array (
-                        0 => 'tags-a-and-c',
-                        1 => 'tags-b-and-c',
-                        2 => 'tags-a-and-b',
-                        3 => 'tag-c',
-                        4 => 'tag-b',
-                );
-
-                $this->assertCount( 5, $posts );
-                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_offset() {
-                $posts = $this->q->query('offset=2');
-
-                $expected = array (
-                        0 => 'tags-a-and-b',
-                        1 => 'tag-c',
-                        2 => 'tag-b',
-                        3 => 'tag-a',
-                        4 => 'tags-a-b-c',
-                        5 => 'raw-html-code',
-                        6 => 'simple-markup-test',
-                        7 => 'embedded-video',
-                        8 => 'contributor-post-approved',
-                        9 => 'one-comment',
-                );
-
-                $this->assertCount( 10, $posts );
-                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_paged() {
-                $posts = $this->q->query('paged=2');
-
-                $expected = array (
-                        0 => 'contributor-post-approved',
-                        1 => 'one-comment',
-                        2 => 'no-comments',
-                        3 => 'many-trackbacks',
-                        4 => 'one-trackback',
-                        5 => 'comment-test',
-                        6 => 'lorem-ipsum',
-                        7 => 'cat-c',
-                        8 => 'cat-b',
-                        9 => 'cat-a',
-                );
-
-                $this->assertCount( 10, $posts );
-                $this->assertTrue( $this->q->is_paged() );
-                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        function test_query_paged_and_posts_per_page() {
-                $posts = $this->q->query('paged=4&posts_per_page=4');
-
-                $expected = array (
-                        0 => 'no-comments',
-                        1 => 'many-trackbacks',
-                        2 => 'one-trackback',
-                        3 => 'comment-test',
-                );
-
-                $this->assertCount( 4, $posts );
-                $this->assertTrue( $this->q->is_paged() );
-                $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
-        }
-
-        /**
-         * @ticket 18897
-         */
-        function test_query_offset_and_paged() {
-                $posts = $this->q->query('paged=2&offset=3');
-
-                $expected = array (
-                        0 => 'many-trackbacks',
-                        1 => 'one-trackback',
-                        2 => 'comment-test',
-                        3 => 'lorem-ipsum',
-                        4 => 'cat-c',
-                        5 => 'cat-b',
-                        6 => 'cat-a',
-                        7 => 'cats-a-and-c',
-                        8 => 'cats-b-and-c',
-                        9 => 'cats-a-and-b',
-                );
-
-                $this->assertCount( 10, $posts );
-                $this->assertTrue( $this->q->is_paged() );
-                $this->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>-<?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(&$this, '_shortcode_tag'));
-
-                foreach ( $this->shortcodes as $shortcode )
-                        add_shortcode( $shortcode, array( $this, '_shortcode_' . $shortcode ) );
-
-                $this->atts = null;
-                $this->content = null;
-                $this->tagname = null;
-
-        }
-
-        function tearDown() {
-                global $shortcode_tags;
-                parent::tearDown();
-                foreach ( $this->shortcodes as $shortcode )
-                        unset( $shortcode_tags[ $shortcode ] );
-                unset( $shortcode_tags['test-shortcode-tag'] );
-        }
-
-        // [footag foo="bar"]
-        function _shortcode_footag( $atts ) {
-                return @"foo = {$atts['foo']}";
-        }
-
-        // [bartag foo="bar"]
-        function _shortcode_bartag( $atts ) {
-                extract(shortcode_atts(array(
-                        'foo' => 'no foo',
-                        'baz' => 'default baz',
-                ), $atts));
-
-                return "foo = {$foo}";
-        }
-
-        // [baztag]content[/baztag]
-        function _shortcode_baztag( $atts, $content = '' ) {
-                return 'content = '.do_shortcode($content);
-        }
-
-        function _shortcode_dumptag( $atts ) {
-                $out = '';
-                foreach ($atts as $k=>$v)
-                        $out .= "$k = $v\n";
-                return $out;
-        }
-
-        function _shortcode_tag($atts, $content=NULL, $tagname=NULL) {
-                $this->atts = $atts;
-                $this->content = $content;
-                $this->tagname = $tagname;
-        }
-
-        function test_noatts() {
-                do_shortcode('[test-shortcode-tag /]');
-                $this->assertEquals( '', $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_one_att() {
-                do_shortcode('[test-shortcode-tag foo="asdf" /]');
-                $this->assertEquals( array('foo' => 'asdf'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_not_a_tag() {
-                $out = do_shortcode('[not-a-shortcode-tag]');
-                $this->assertEquals( '[not-a-shortcode-tag]', $out );
-        }
-
-        function test_two_atts() {
-                do_shortcode('[test-shortcode-tag foo="asdf" bar="bing" /]');
-                $this->assertEquals( array('foo' => 'asdf', 'bar' => 'bing'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_noatts_enclosing() {
-                do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]');
-                $this->assertEquals( '', $this->atts );
-                $this->assertEquals( 'content', $this->content );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_one_att_enclosing() {
-                do_shortcode('[test-shortcode-tag foo="bar"]content[/test-shortcode-tag]');
-                $this->assertEquals( array('foo' => 'bar'), $this->atts );
-                $this->assertEquals( 'content', $this->content );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_two_atts_enclosing() {
-                do_shortcode('[test-shortcode-tag foo="bar" baz="bing"]content[/test-shortcode-tag]');
-                $this->assertEquals( array('foo' => 'bar', 'baz' => 'bing'), $this->atts );
-                $this->assertEquals( 'content', $this->content );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_unclosed() {
-                $out = do_shortcode('[test-shortcode-tag]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( '', $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_positional_atts_num() {
-                $out = do_shortcode('[test-shortcode-tag 123]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( array(0=>'123'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_positional_atts_url() {
-                $out = do_shortcode('[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( array(0=>'http://www.youtube.com/watch?v=eBGIQ7ZuuiU'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_positional_atts_quotes() {
-                $out = do_shortcode('[test-shortcode-tag "something in quotes" "something else"]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( array(0=>'something in quotes', 1=>'something else'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_positional_atts_mixed() {
-                $out = do_shortcode('[test-shortcode-tag 123 http://wordpress.com/ 0 "foo" bar]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( array(0=>'123', 1=>'http://wordpress.com/', 2=>'0', 3=>'foo', 4=>'bar'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_positional_and_named_atts() {
-                $out = do_shortcode('[test-shortcode-tag 123 url=http://wordpress.com/ foo bar="baz"]');
-                $this->assertEquals( '', $out );
-                $this->assertEquals( array(0=>'123', 'url' => 'http://wordpress.com/', 1=>'foo', 'bar' => 'baz'), $this->atts );
-                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
-        }
-
-        function test_footag_default() {
-                $out = do_shortcode('[footag]');
-                $this->assertEquals('foo = ', $out);
-        }
-
-        function test_footag_val() {
-                $val = rand_str();
-                $out = do_shortcode('[footag foo="'.$val.'"]');
-                $this->assertEquals('foo = '.$val, $out);
-        }
-
-        function test_nested_tags() {
-                $out = do_shortcode('[baztag][dumptag abc="foo" def=123 http://wordpress.com/][/baztag]');
-                $expected = "content = abc = foo\ndef = 123\n0 = http://wordpress.com\n";
-                $this->assertEquals($expected, $out);
-        }
-
-        /**
-         * @ticket 6518
-         */
-        function test_tag_escaped() {
-                $out = do_shortcode('[[footag]] [[bartag foo="bar"]]');
-                $this->assertEquals('[footag] [bartag foo="bar"]', $out);
-
-                $out = do_shortcode('[[footag /]] [[bartag foo="bar" /]]');
-                $this->assertEquals('[footag /] [bartag foo="bar" /]', $out);
-
-                $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]]');
-                $this->assertEquals('[baztag foo="bar"]the content[/baztag]', $out);
-
-                // double escaped
-                $out = do_shortcode('[[[footag]]] [[[bartag foo="bar"]]]');
-                $this->assertEquals('[[footag]] [[bartag foo="bar"]]', $out);
-        }
-
-        function test_tag_not_escaped() {
-                // these have square brackets on either end but aren't actually escaped
-                $out = do_shortcode('[[footag] [bartag foo="bar"]]');
-                $this->assertEquals('[foo = foo = bar]', $out);
-
-                $out = do_shortcode('[[footag /] [bartag foo="bar" /]]');
-                $this->assertEquals('[foo = foo = bar]', $out);
-
-                $out = do_shortcode('[[baztag foo="bar"]the content[/baztag]');
-                $this->assertEquals('[content = the content', $out);
-
-                $out = do_shortcode('[[not-a-tag]]');
-                $this->assertEquals('[[not-a-tag]]', $out);
-
-                $out = do_shortcode('[[[footag] [bartag foo="bar"]]]');
-                $this->assertEquals('[[foo = foo = bar]]', $out);
-        }
-
-        function test_mixed_tags() {
-                $in = <<<EOF
-So this is a post with [footag foo="some stuff"] and a bunch of tags.
-
-[bartag]
-
-[baztag]
-Here's some content
-on more than one line
-[/baztag]
-
-[bartag foo=1] [baztag] [footag foo="2"] [baztag]
-
-[baztag]
-more content
-[/baztag]
-
-EOF;
-                $expected = <<<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->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("[test-shortcode-tag foo=\"bar\" \x00\xA0baz=\"123\"]");
-                $this->assertEquals( array('foo' => 'bar', 'baz' => '123'), $this->atts );
-                $this->assertEquals( '', $this->content );
-        }
-
-        /**
-         * @ticket 6562
-         *
-         * @TODO Review this test as it may be incorrect
-         */
-        function test_utf8_whitespace_2() {
-                do_shortcode("[test-shortcode-tag foo=\"bar\" \x20\x0babc=\"def\"]");
-                $this->assertEquals( array('foo' => 'bar', 'abc' => 'def'), $this->atts );
-                $this->assertEquals( '', $this->content );
-        }
-
-        function test_shortcode_unautop() {
-                // a blank line is added at the end, so test with it already there
-                $test_string = <<<EOF
-[footag]
-
-EOF;
-
-                $this->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 = <<<EOF
-[footag]
-[footag]
-
-EOF;
-
-                $actual = shortcode_unautop( wpautop( $test_string ) );
-                $this->assertEquals( $test_string, $actual );
-        }
-
-        /**
-         * @ticket 10326
-         */
-        function test_strip_shortcodes() {
-                $this->assertEquals('before', strip_shortcodes('before[gallery]'));
-                $this->assertEquals('after', strip_shortcodes('[gallery]after'));
-                $this->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>-<?php
-
-
-/**
- * @group upload
- * @group media
- */
-class TestUploadFunctions extends WP_UnitTestCase {
-
-        var $siteurl;
-
-        function setUp() {
-                if ( is_multisite() )
-                        $this->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->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this->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->assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this->assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this->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->assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this->assertEquals( "$path/" . gmstrftime('%Y/%m'), $info['path'] );
-                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this->assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_dir_no_yearnum() {
-                update_option( 'uploads_use_yearmonth_folders', 0 );
-                $info = wp_upload_dir();
-                $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
-                $this->assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
-                $this->assertEquals( '', $info['subdir'] );
-                $this->assertEquals( '', $info['error'] );
-        }
-
-        function test_upload_path_absolute() {
-                update_option( 'upload_url_path', 'http://example.org/asdf' );
-                $info = wp_upload_dir();
-                $this->assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this->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->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
-                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
-                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
-                $this->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>-<?php
-
-// test functions in wp-includes/user.php
-/**
- * @group user
- */
-class TestWPUser extends WP_UnitTestCase {
-
-        protected $_deprecated_errors = array();
-
-        function setUp() {
-                parent::setUp();
-                $this->_deprecated_errors = array();
-        }
-
-        public function deprecated_handler( $function, $message, $version ) {
-                $this->_deprecated_errors[] = array(
-                        'function' => $function,
-                        'message' => $message,
-                        'version' => $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->factory->user->create( array( 'role' => $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->user_id] ) ) {
-                                $roles = array_keys( unserialize( $user->meta_value ) );
-                                $found[ $user->user_id ] = $roles[0];
-                        }
-                }
-
-                // make sure every user we created was returned
-                $this->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->factory->user->create( array( 'role' => 'author' ) );
-
-                // get an option that doesn't exist
-                $this->assertFalse(get_user_option($key, $user_id));
-
-                // set and get
-                update_user_option( $user_id, $key, $val );
-                $this->assertEquals( $val, get_user_option($key, $user_id) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_user_option( $user_id, $key, $val2 );
-                $this->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->factory->user->create( array( 'role' => 'author' ) );
-
-                // get a meta key that doesn't exist
-                $this->assertEquals( '', get_usermeta($user_id, $key) );
-
-                // set and get
-                update_usermeta( $user_id, $key, $val );
-                $this->assertEquals( $val, get_usermeta($user_id, $key) );
-
-                // change and get again
-                $val2 = rand_str();
-                update_usermeta( $user_id, $key, $val2 );
-                $this->assertEquals( $val2, get_usermeta($user_id, $key) );
-
-                // delete and get
-                delete_usermeta( $user_id, $key );
-                $this->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->assertEquals( $val, get_usermeta($user_id, $key) );
-                // correct key: deleted
-                delete_usermeta( $user_id, $key, $val );
-                $this->assertEquals( '', get_usermeta($user_id, $key) );
-
-        }
-
-        // test usermeta functions in array mode
-        function test_usermeta_array() {
-                // some values to set
-                $vals = array(
-                        rand_str() => 'val-'.rand_str(),
-                        rand_str() => 'val-'.rand_str(),
-                        rand_str() => 'val-'.rand_str(),
-                );
-
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-
-                // there is already some stuff in the array
-                $this->assertTrue(is_array(get_usermeta($user_id)));
-
-                foreach ($vals as $k=>$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->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=>$v) {
-                        if ($k == $key_to_delete)
-                                $this->assertFalse(in_array($v, $out));
-                        else
-                                $this->assertTrue(in_array($v, $out));
-                }
-        }
-
-        // Test property magic functions for property get/set/isset.
-        function test_user_properties() {
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                foreach ( $user->data as $key => $data ) {
-                        $this->assertEquals( $data, $user->$key );
-                }
-
-                $this->assertTrue( isset( $user->$key ) );
-                $this->assertFalse( isset( $user->fooooooooo ) );
-
-                $user->$key = 'foo';
-                $this->assertEquals( 'foo', $user->$key );
-                $this->assertEquals( 'foo', $user->data->$key ); // This will fail with WP < 3.3
-
-                foreach ( (array) $user as $key => $value ) {
-                        $this->assertEquals( $value, $user->$key );
-                }
-        }
-
-        /**
-         * Test the magic __unset method
-         *
-         * @ticket 20043
-         */
-        public function test_user_unset() {
-                // New user
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                // Test custom fields
-                $user->customField = 123;
-                $this->assertEquals( $user->customField, 123 );
-                unset( $user->customField );
-                $this->assertFalse( isset( $user->customField ) );
-
-                // Test 'id' (lowercase)
-                add_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3 );
-                unset( $user->id );
-                $this->assertCount( 1, $this->_deprecated_errors );
-                $this->assertEquals( 'WP_User->id', $this->_deprecated_errors[0]['function'] );
-                $this->assertEquals( '2.1', $this->_deprecated_errors[0]['version'] );
-                remove_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3);
-
-                // Test 'ID'
-                $this->assertNotEmpty( $user->ID );
-                unset( $user->ID );
-                $this->assertEmpty( $user->ID );
-        }
-
-        // Test meta property magic functions for property get/set/isset.
-        function test_user_meta_properties() {
-                global $wpdb;
-
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                update_user_option( $user_id, 'foo', 'foo', true );
-
-                $this->assertTrue( isset( $user->foo ) );
-
-                $this->assertEquals( 'foo', $user->foo );
-        }
-
-        function test_id_property_back_compat() {
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $this->assertTrue( isset( $user->id ) );
-                $this->assertEquals( $user->ID, $user->id );
-                $user->id = 1234;
-                $this->assertEquals( $user->ID, $user->id );
-        }
-
-        /**
-         * ticket 19265
-         */
-        function test_user_level_property_back_compat() {
-                $roles = array(
-                        'administrator' => 10,
-                        'editor' => 7,
-                        'author' => 2,
-                        'contributor' => 1,
-                        'subscriber' => 0,
-                );
-
-                foreach ( $roles as $role => $level ) {
-                        $user_id = $this->factory->user->create( array( 'role' => $role ) );
-                        $user = new WP_User( $user_id );
-
-                        $this->assertTrue( isset( $user->user_level ) );
-                        $this->assertEquals( $level, $user->user_level );
-                }
-        }
-
-        function test_construction() {
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-
-                $user = new WP_User( $user_id );
-                $this->assertInstanceOf( 'WP_User', $user );
-                $this->assertEquals( $user_id, $user->ID );
-
-                $user2 = new WP_User( 0, $user->user_login );
-                $this->assertInstanceOf( 'WP_User', $user2 );
-                $this->assertEquals( $user_id, $user2->ID );
-                $this->assertEquals( $user->user_login, $user2->user_login );
-
-                $user3 = new WP_User();
-                $this->assertInstanceOf( 'WP_User', $user3 );
-                $this->assertEquals( 0, $user3->ID );
-                $this->assertFalse( isset( $user3->user_login ) );
-
-                $user3->init( $user->data );
-                $this->assertEquals( $user_id, $user3->ID );
-
-                $user4 = new WP_User( $user->user_login );
-                $this->assertInstanceOf( 'WP_User', $user4 );
-                $this->assertEquals( $user_id, $user4->ID );
-                $this->assertEquals( $user->user_login, $user4->user_login );
-
-                $user5 = new WP_User( null, $user->user_login );
-                $this->assertInstanceOf( 'WP_User', $user5 );
-                $this->assertEquals( $user_id, $user5->ID );
-                $this->assertEquals( $user->user_login, $user5->user_login );
-        }
-
-        function test_get() {
-                $user_id = $this->factory->user->create( array(
-                        'role' => 'author',
-                        'user_login' => 'test_wp_user_get',
-                        'user_pass' => 'password',
-                        'user_email' => 'test@test.com',
-                ) );
-
-                $user = new WP_User( $user_id );
-                $this->assertEquals( 'test_wp_user_get', $user->get( 'user_login' ) );
-                $this->assertEquals( 'test@test.com', $user->get( 'user_email' ) );
-                $this->assertEquals( 0, $user->get( 'use_ssl' ) );
-                $this->assertEquals( '', $user->get( 'field_that_does_not_exist' ) );
-
-                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
-                $this->assertEquals( 'abcdefg', $user->get( 'dashed-key' ) );
-        }
-
-        function test_has_prop() {
-                $user_id = $this->factory->user->create( array(
-                        'role' => 'author',
-                        'user_login' => 'test_wp_user_has_prop',
-                        'user_pass' => 'password',
-                        'user_email' => 'test2@test.com',
-                ) );
-
-                $user = new WP_User( $user_id );
-                $this->assertTrue( $user->has_prop( 'user_email') );
-                $this->assertTrue( $user->has_prop( 'use_ssl' ) );
-                $this->assertFalse( $user->has_prop( 'field_that_does_not_exist' ) );
-
-                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
-                $this->assertTrue( $user->has_prop( 'dashed-key' ) );
-        }
-
-        function test_update_user() {
-                $user_id = $this->factory->user->create( array(
-                        'role' => 'author',
-                        'user_login' => 'test_wp_update_user',
-                        'user_pass' => 'password',
-                        'user_email' => 'test3@test.com',
-                ) );
-                $user = new WP_User( $user_id );
-
-                update_user_meta( $user_id, 'description', 'about me' );
-                $this->assertEquals( 'about me', $user->get( 'description' ) );
-
-                $user_data = array( 'ID' => $user_id, 'display_name' => 'test user' );
-                wp_update_user( $user_data );
-
-                $user = new WP_User( $user_id );
-                $this->assertEquals( 'test user', $user->get( 'display_name' ) );
-
-                // Make sure there is no collateral damage to fields not in $user_data
-                $this->assertEquals( 'about me', $user->get( 'description' ) );
-
-                // Test update of fields in _get_additional_user_keys()
-                $user_data = array( 'ID' => $user_id, 'use_ssl' => 1, 'show_admin_bar_front' => 1,
-                                                 'rich_editing' => 1, 'first_name' => 'first', 'last_name' => 'last',
-                                                 'nickname' => 'nick', 'comment_shortcuts' => 1, 'admin_color' => 'classic',
-                                                 'description' => 'describe', 'aim' => 'aim', 'yim' => 'yim', 'jabber' => 'jabber' );
-                wp_update_user( $user_data );
-
-                $user = new WP_User( $user_id );
-                foreach ( $user_data as $key => $value )
-                        $this->assertEquals( $value, $user->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->assertEquals( array(), get_blogs_of_user( 0 ) );
-
-                $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
-                $blogs = get_blogs_of_user( $user_id );
-                $this->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->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->factory->user->create( array( 'role' => 'subscriber' ) );
-                wp_set_current_user( $user_id );
-
-                $this->assertTrue( is_user_member_of_blog() );
-                $this->assertTrue( is_user_member_of_blog( 0, 0 ) );
-                $this->assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) );
-                $this->assertTrue( is_user_member_of_blog( $user_id ) );
-                $this->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->assertFalse( is_user_member_of_blog( $user_id ) );
-                $this->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->factory->user->create( array( 'role' => 'subscriber' ) );
-                wp_set_current_user( $user_id );
-
-                $this->assertNotEmpty( $userdata );
-                $this->assertInstanceOf( 'WP_User', $userdata );
-                $this->assertEquals( $userdata->ID, $user_id );
-                $prefix = $wpdb->get_blog_prefix();
-                $cap_key = $prefix . 'capabilities';
-                $this->assertTrue( isset( $userdata->$cap_key ) );
-        }
-
-        /**
-         * ticket 19769
-         */
-        function test_global_userdata_is_null_when_logged_out() {
-                global $userdata;
-                wp_set_current_user(0);
-                $this->assertNull( $userdata );
-        }
-
-        function test_exists() {
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $this->assertTrue( $user->exists() );
-
-                $user = new WP_User( 123456789 );
-
-                $this->assertFalse( $user->exists() );
-
-                $user = new WP_User( 0 );
-
-                $this->assertFalse( $user->exists() );
-        }
-
-        function test_global_authordata() {
-                global $authordata, $id;
-
-                $old_post_id = $id;
-
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $post = array(
-                        'post_author' => $user_id,
-                        'post_status' => 'publish',
-                        'post_content' => rand_str(),
-                        'post_title' => rand_str(),
-                        'post_type' => 'post'
-                );
-
-                // insert a post and make sure the ID is ok
-                $post_id = wp_insert_post( $post );
-                $this->assertTrue( is_numeric( $post_id ) );
-
-                setup_postdata( get_post( $post_id ) );
-
-                $this->assertNotEmpty( $authordata );
-                $this->assertInstanceOf( 'WP_User', $authordata );
-                $this->assertEquals( $authordata->ID, $user_id );
-
-                setup_postdata( get_post( $old_post_id ) );
-        }
-
-        function test_delete_user() {
-                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User( $user_id );
-
-                $post = array(
-                        'post_author' => $user_id,
-                        'post_status' => 'publish',
-                        'post_content' => rand_str(),
-                        'post_title' => rand_str(),
-                        'post_type' => 'post',
-                );
-
-                // insert a post and make sure the ID is ok
-                $post_id = wp_insert_post($post);
-                $this->assertTrue(is_numeric($post_id));
-                $this->assertTrue($post_id > 0);
-
-                $post = get_post( $post_id );
-                $this->assertEquals( $post_id, $post->ID );
-
-                $post = array(
-                        'post_author' => $user_id,
-                        'post_status' => 'publish',
-                        'post_content' => rand_str(),
-                        'post_title' => rand_str(),
-                        'post_type' => 'nav_menu_item',
-                );
-
-                // insert a post and make sure the ID is ok
-                $nav_id = wp_insert_post($post);
-                $this->assertTrue(is_numeric($nav_id));
-                $this->assertTrue($nav_id > 0);
-
-                $post = get_post( $nav_id );
-                $this->assertEquals( $nav_id, $post->ID );
-
-                wp_delete_user( $user_id );
-                $user = new WP_User( $user_id );
-                if ( is_multisite() )
-                        $this->assertTrue( $user->exists() );
-                else
-                        $this->assertFalse( $user->exists() );
-
-                $this->assertNotNull( get_post( $post_id ) );
-                $this->assertEquals( 'trash', get_post( $post_id )->post_status );
-                // nav_menu_item is delete_with_user = false so the nav post should remain published.
-                $this->assertNotNull( get_post( $nav_id ) );
-                $this->assertEquals( 'publish', get_post( $nav_id )->post_status );
-                wp_delete_post( $nav_id, true );
-                $this->assertNull( get_post( $nav_id ) );
-                wp_delete_post( $post_id, true );
-                $this->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>-<?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->_flush_roles();
-
-                $this->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->_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->factory->user->create( array( 'role' => 'administrator' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // make sure the role name is correct
-                $this->assertEquals(array('administrator'), $user->roles);
-
-                // check a few of the main capabilities
-                $this->assertTrue($user->has_cap('switch_themes'));
-                $this->assertTrue($user->has_cap('list_users'));
-                $this->assertTrue($user->has_cap('manage_options'));
-                $this->assertTrue($user->has_cap('level_10'));
-        }
-
-        function test_user_editor() {
-                $id = $this->factory->user->create( array( 'role' => 'editor' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // make sure the role name is correct
-                $this->assertEquals(array('editor'), $user->roles);
-
-                // check a few of the main capabilities
-                $this->assertTrue($user->has_cap('moderate_comments'));
-                $this->assertTrue($user->has_cap('manage_categories'));
-                $this->assertTrue($user->has_cap('upload_files'));
-                $this->assertTrue($user->has_cap('level_7'));
-
-                // and a few capabilities this user doesn't have
-                $this->assertFalse($user->has_cap('switch_themes'));
-                $this->assertFalse($user->has_cap('edit_users'));
-                $this->assertFalse($user->has_cap('level_8'));
-        }
-
-        function test_user_author() {
-                $id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // make sure the role name is correct
-                $this->assertEquals(array('author'), $user->roles);
-
-                // check a few of the main capabilities
-                $this->assertTrue($user->has_cap('edit_posts'));
-                $this->assertTrue($user->has_cap('edit_published_posts'));
-                $this->assertTrue($user->has_cap('upload_files'));
-                $this->assertTrue($user->has_cap('level_2'));
-
-                // and a few capabilities this user doesn't have
-                $this->assertFalse($user->has_cap('moderate_comments'));
-                $this->assertFalse($user->has_cap('manage_categories'));
-                $this->assertFalse($user->has_cap('level_3'));
-        }
-
-        function test_user_contributor() {
-                $id = $this->factory->user->create( array( 'role' => 'contributor' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // make sure the role name is correct
-                $this->assertEquals(array('contributor'), $user->roles);
-
-                // check a few of the main capabilities
-                $this->assertTrue($user->has_cap('edit_posts'));
-                $this->assertTrue($user->has_cap('read'));
-                $this->assertTrue($user->has_cap('level_1'));
-                $this->assertTrue($user->has_cap('level_0'));
-
-                // and a few capabilities this user doesn't have
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_published_posts'));
-                $this->assertFalse($user->has_cap('level_2'));
-        }
-
-        function test_user_subscriber() {
-                $id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // make sure the role name is correct
-                $this->assertEquals(array('subscriber'), $user->roles);
-
-                // check a few of the main capabilities
-                $this->assertTrue($user->has_cap('read'));
-                $this->assertTrue($user->has_cap('level_0'));
-
-                // and a few capabilities this user doesn't have
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_posts'));
-                $this->assertFalse($user->has_cap('level_1'));
-        }
-
-        // a role that doesn't exist
-        function test_bogus_role() {
-                _disable_wp_die();
-                $id = $this->factory->user->create( array( 'role' => rand_str() ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // user has no role and no capabilities
-                $this->assertEquals(array(), $user->roles);
-                $this->assertFalse($user->has_cap('level_0'));
-                _enable_wp_die();
-        }
-
-        // a user with multiple roles
-        function test_user_subscriber_contributor() {
-                $id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-                $user->add_role('contributor');
-
-                // nuke and re-fetch the object to make sure it was stored
-                $user = NULL;
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // user should have two roles now
-                $this->assertEquals(array('subscriber', 'contributor'), $user->roles);
-
-                // with contributor capabilities
-                $this->assertTrue($user->has_cap('edit_posts'));
-                $this->assertTrue($user->has_cap('read'));
-                $this->assertTrue($user->has_cap('level_1'));
-                $this->assertTrue($user->has_cap('level_0'));
-
-                // but not these
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_published_posts'));
-                $this->assertFalse($user->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->_flush_roles();
-                $this->assertTrue($wp_roles->is_role($role_name));
-
-                $id = $this->factory->user->create( array( 'role' => $role_name ) );
-
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                $this->assertEquals(array($role_name), $user->roles);
-
-                // user shouldn't have any capabilities; test a quick sample
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_published_posts'));
-                $this->assertFalse($user->has_cap('level_1'));
-                $this->assertFalse($user->has_cap('level_0'));
-
-                // clean up
-                remove_role($role_name);
-                $this->_flush_roles();
-                $this->assertFalse($wp_roles->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'=>true, 'edit_pages'=>true, 'level_0'=>true, 'level_1'=>true, 'level_2'=>true));
-                $this->_flush_roles();
-                $this->assertTrue($wp_roles->is_role($role_name));
-
-                $id = $this->factory->user->create( array( 'role' => $role_name ) );
-
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                $this->assertEquals(array($role_name), $user->roles);
-
-                // the user should have all the above caps
-                $this->assertTrue($user->has_cap($role_name));
-                $this->assertTrue($user->has_cap('edit_posts'));
-                $this->assertTrue($user->has_cap('edit_pages'));
-                $this->assertTrue($user->has_cap('level_0'));
-                $this->assertTrue($user->has_cap('level_1'));
-                $this->assertTrue($user->has_cap('level_2'));
-
-                // shouldn't have any other caps
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_published_posts'));
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('level_3'));
-
-                // clean up
-                remove_role($role_name);
-                $this->_flush_roles();
-                $this->assertFalse($wp_roles->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'=>true) );
-                $this->_flush_roles();
-                $this->assertTrue( $wp_roles->is_role($role_name) );
-
-                // assign a user to that role
-                $id = $this->factory->user->create( array( 'role' => $role_name ) );
-
-                // now add a cap to the role
-                $wp_roles->add_cap($role_name, 'sweep_floor');
-                $this->_flush_roles();
-
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-                $this->assertEquals(array($role_name), $user->roles);
-
-                // the user should have all the above caps
-                $this->assertTrue($user->has_cap($role_name));
-                $this->assertTrue($user->has_cap('level_1'));
-                $this->assertTrue($user->has_cap('sweep_floor'));
-
-                // shouldn't have any other caps
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('edit_published_posts'));
-                $this->assertFalse($user->has_cap('upload_files'));
-                $this->assertFalse($user->has_cap('level_4'));
-
-                // clean up
-                remove_role($role_name);
-                $this->_flush_roles();
-                $this->assertFalse($wp_roles->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'=>true, 'sweep_floor'=>true, 'polish_doorknobs'=>true) );
-                $this->_flush_roles();
-                $this->assertTrue( $wp_roles->is_role($role_name) );
-
-                // assign a user to that role
-                $id = $this->factory->user->create( array( 'role' => $role_name ) );
-
-                // now remove a cap from the role
-                $wp_roles->remove_cap($role_name, 'polish_doorknobs');
-                $this->_flush_roles();
-
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-                $this->assertEquals(array($role_name), $user->roles);
-
-                // the user should have all the above caps
-                $this->assertTrue($user->has_cap($role_name));
-                $this->assertTrue($user->has_cap('level_1'));
-                $this->assertTrue($user->has_cap('sweep_floor'));
-
-                // shouldn't have the removed cap
-                $this->assertFalse($user->has_cap('polish_doorknobs'));
-
-                // clean up
-                remove_role($role_name);
-                $this->_flush_roles();
-                $this->assertFalse($wp_roles->is_role($role_name));
-
-        }
-
-        function test_user_add_cap() {
-                // add an extra capability to a user
-
-                // there are two contributors
-                $id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
-                $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
-
-                // user 1 has an extra capability
-                $user_1 = new WP_User($id_1);
-                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
-                $user_1->add_cap('publish_posts');
-
-                // re-fetch both users from the db
-                $user_1 = new WP_User($id_1);
-                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
-                $user_2 = new WP_User($id_2);
-                $this->assertTrue($user_2->exists(), "Problem getting user $id_2");
-
-                // make sure they're both still contributors
-                $this->assertEquals(array('contributor'), $user_1->roles);
-                $this->assertEquals(array('contributor'), $user_2->roles);
-
-                // check the extra cap on both users
-                $this->assertTrue($user_1->has_cap('publish_posts'));
-                $this->assertFalse($user_2->has_cap('publish_posts'));
-
-                // make sure the other caps didn't get messed up
-                $this->assertTrue($user_1->has_cap('edit_posts'));
-                $this->assertTrue($user_1->has_cap('read'));
-                $this->assertTrue($user_1->has_cap('level_1'));
-                $this->assertTrue($user_1->has_cap('level_0'));
-                $this->assertFalse($user_1->has_cap('upload_files'));
-                $this->assertFalse($user_1->has_cap('edit_published_posts'));
-                $this->assertFalse($user_1->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->factory->user->create( array( 'role' => 'contributor' ) );
-                $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
-
-                // user 1 has an extra capability
-                $user_1 = new WP_User($id_1);
-                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
-                $user_1->add_cap('publish_posts');
-
-                // now remove the extra cap
-                $user_1->remove_cap('publish_posts');
-
-                // re-fetch both users from the db
-                $user_1 = new WP_User($id_1);
-                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
-                $user_2 = new WP_User($id_2);
-                $this->assertTrue($user_2->exists(), "Problem getting user $id_2");
-
-                // make sure they're both still contributors
-                $this->assertEquals(array('contributor'), $user_1->roles);
-                $this->assertEquals(array('contributor'), $user_2->roles);
-
-                // check the removed cap on both users
-                $this->assertFalse($user_1->has_cap('publish_posts'));
-                $this->assertFalse($user_2->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->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // author = user level 2
-                $this->assertEquals( 2, $user->user_level );
-
-                // they get promoted to editor - level should get bumped to 7
-                $user->set_role('editor');
-                $this->assertEquals( 7, $user->user_level );
-
-                // demoted to contributor - level is reduced to 1
-                $user->set_role('contributor');
-                $this->assertEquals( 1, $user->user_level );
-
-                // if they have two roles, user_level should be the max of the two
-                $user->add_role('editor');
-                $this->assertEquals(array('contributor', 'editor'), $user->roles);
-                $this->assertEquals( 7, $user->user_level );
-        }
-
-        function test_user_remove_all_caps() {
-                // user starts as an author
-                $id = $this->factory->user->create( array( 'role' => 'author' ) );
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // add some extra capabilities
-                $user->add_cap('make_coffee');
-                $user->add_cap('drink_coffee');
-
-                // re-fetch
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                $this->assertTrue($user->has_cap('make_coffee'));
-                $this->assertTrue($user->has_cap('drink_coffee'));
-
-                // all caps are removed
-                $user->remove_all_caps();
-
-                // re-fetch
-                $user = new WP_User($id);
-                $this->assertTrue($user->exists(), "Problem getting user $id");
-
-                // capabilities for the author role should be gone
-#                $this->assertFalse($user->has_cap('edit_posts'));
-#                $this->assertFalse($user->has_cap('edit_published_posts'));
-#                $this->assertFalse($user->has_cap('upload_files'));
-#                $this->assertFalse($user->has_cap('level_2'));
-
-                // the extra capabilities should be gone
-                $this->assertFalse($user->has_cap('make_coffee'));
-                $this->assertFalse($user->has_cap('drink_coffee'));
-
-                // user level should be empty
-                $this->assertEmpty( $user->user_level );
-
-
-        }
-
-        function test_post_meta_caps() {
-                // simple tests for some common meta capabilities
-
-                // Make our author
-                $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
-
-                // make a post
-                $post = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );
-
-                // the author of the post
-                $this->assertTrue($author->exists(), "Problem getting user $author->ID");
-
-                // add some other users
-                $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
-                $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
-                $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
-                $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
-
-                // administrators, editors and the post owner can edit it
-                $this->assertTrue($admin->has_cap('edit_post', $post));
-                $this->assertTrue($author->has_cap('edit_post', $post));
-                $this->assertTrue($editor->has_cap('edit_post', $post));
-                // other authors and contributors can't
-                $this->assertFalse($author_2->has_cap('edit_post', $post));
-                $this->assertFalse($contributor->has_cap('edit_post', $post));
-
-                // administrators, editors and the post owner can delete it
-                $this->assertTrue($admin->has_cap('delete_post', $post));
-                $this->assertTrue($author->has_cap('delete_post', $post));
-                $this->assertTrue($editor->has_cap('delete_post', $post));
-                // other authors and contributors can't
-                $this->assertFalse($author_2->has_cap('delete_post', $post));
-                $this->assertFalse($contributor->has_cap('delete_post', $post));
-
-                // Test meta authorization callbacks
-                if ( function_exists( 'register_meta') ) {
-                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post) );
-                        $this->assertTrue( $admin->has_cap('add_post_meta', $post) );
-                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post) );
-
-                        $this->assertFalse( $admin->has_cap('edit_post_meta', $post, '_protected') );
-                        $this->assertFalse( $admin->has_cap('add_post_meta', $post, '_protected') );
-                        $this->assertFalse( $admin->has_cap('delete_post_meta', $post, '_protected') );
-
-                        register_meta( 'post', '_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_yes_you_can' ) );
-                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post, '_protected') );
-                        $this->assertTrue( $admin->has_cap('add_post_meta', $post, '_protected') );
-                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post, '_protected') );
-
-                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
-                        $this->assertTrue( $admin->has_cap('add_post_meta', $post, 'not_protected') );
-                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post, 'not_protected') );
-
-                        register_meta( 'post', 'not_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_no_you_cant' ) );
-                        $this->assertFalse( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
-                        $this->assertFalse( $admin->has_cap('add_post_meta', $post, 'not_protected') );
-                        $this->assertFalse( $admin->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->factory->user->create( array( 'role' => 'author' ) ) );
-
-                // make a page
-                $page = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );
-
-                // the author of the page
-                $this->assertTrue($author->exists(), "Problem getting user " . $author->ID);
-
-                // add some other users
-                $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
-                $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
-                $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
-                $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
-
-                // administrators, editors and the post owner can edit it
-                $this->assertTrue($admin->has_cap('edit_page', $page));
-                $this->assertTrue($editor->has_cap('edit_page', $page));
-                // other authors and contributors can't
-                $this->assertFalse($author->has_cap('edit_page', $page));
-                $this->assertFalse($author_2->has_cap('edit_page', $page));
-                $this->assertFalse($contributor->has_cap('edit_page', $page));
-
-                // administrators, editors and the post owner can delete it
-                $this->assertTrue($admin->has_cap('delete_page', $page));
-                $this->assertTrue($editor->has_cap('delete_page', $page));
-                // other authors and contributors can't
-                $this->assertFalse($author->has_cap('delete_page', $page));
-                $this->assertFalse($author_2->has_cap('delete_page', $page));
-                $this->assertFalse($contributor->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>+<?php
+/**
+ * @group themes
+ */
+class Tests_Theme_WPTheme extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
+
+                $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
+                $GLOBALS['wp_theme_directories'] = array( $this->theme_root );
+
+                add_filter('theme_root', array(&$this, '_theme_root'));
+                add_filter( 'stylesheet_root', array(&$this, '_theme_root') );
+                add_filter( 'template_root', array(&$this, '_theme_root') );
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
+                remove_filter('theme_root', array(&$this, '_theme_root'));
+                remove_filter( 'stylesheet_root', array(&$this, '_theme_root') );
+                remove_filter( 'template_root', array(&$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->theme_root;
+        }
+        function test_new_WP_Theme_top_level() {
+                $theme = new WP_Theme( 'theme1', $this->theme_root );
+
+                //Meta
+                $this->assertEquals( 'My Theme', $theme->get('Name') );
+                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+                $this->assertEquals( 'An example theme', $theme->get('Description') );
+                $this->assertEquals( 'Minnie Bannister', $theme->get('Author') );
+                $this->assertEquals( 'http://example.com/', $theme->get('AuthorURI') );
+                $this->assertEquals( '1.3', $theme->get('Version') );
+                $this->assertEquals( '', $theme->get('Template') );
+                $this->assertEquals( 'publish', $theme->get('Status') );
+                $this->assertEquals( array(), $theme->get('Tags') );
+
+                //Important
+                $this->assertEquals( 'theme1', $theme->get_stylesheet() );
+                $this->assertEquals( 'theme1', $theme->get_template() );
+        }
+
+        function test_new_WP_Theme_subdir() {
+                $theme = new WP_Theme( 'subdir/theme2', $this->theme_root );
+
+                //Meta
+                $this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
+                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+                $this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
+                $this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
+                $this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
+                $this->assertEquals( '0.1', $theme->get('Version') );
+                $this->assertEquals( '', $theme->get('Template') );
+                $this->assertEquals( 'publish', $theme->get('Status') );
+                $this->assertEquals( array(), $theme->get('Tags') );
+
+                //Important
+                $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
+                $this->assertEquals( 'subdir/theme2', $theme->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->theme_root . '/subdir' );
+
+                //Meta
+                $this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
+                $this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+                $this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
+                $this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
+                $this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
+                $this->assertEquals( '0.1', $theme->get('Version') );
+                $this->assertEquals( '', $theme->get('Template') );
+                $this->assertEquals( 'publish', $theme->get('Status') );
+                $this->assertEquals( array(), $theme->get('Tags') );
+
+                //Important
+                $this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
+                $this->assertEquals( 'subdir/theme2', $theme->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>+<?php
+
+
+/**
+ * @group upload
+ * @group media
+ */
+class Tests_Upload extends WP_UnitTestCase {
+
+        var $siteurl;
+
+        function setUp() {
+                if ( is_multisite() )
+                        $this->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->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this->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->assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this->assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this->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->assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this->assertEquals( "$path/" . gmstrftime('%Y/%m'), $info['path'] );
+                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this->assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_dir_no_yearnum() {
+                update_option( 'uploads_use_yearmonth_folders', 0 );
+                $info = wp_upload_dir();
+                $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
+                $this->assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
+                $this->assertEquals( '', $info['subdir'] );
+                $this->assertEquals( '', $info['error'] );
+        }
+
+        function test_upload_path_absolute() {
+                update_option( 'upload_url_path', 'http://example.org/asdf' );
+                $info = wp_upload_dir();
+                $this->assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this->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->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+                $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+                $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+                $this->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>+<?php
+
+// tests for link-template.php and related URL functions
+class Tests_URL extends WP_UnitTestCase {
+        var $_old_server;
+        function setUp() {
+                $this->_old_server = $_SERVER;
+        }
+
+        function tearDown() {
+                $_SERVER = $this->_old_server;
+        }
+
+        function test_is_ssl_positive() {
+                $_SERVER['HTTPS'] = 'on';
+                $this->assertTrue( is_ssl() );
+
+                $_SERVER['HTTPS'] = 'ON';
+                $this->assertTrue( is_ssl() );
+
+                $_SERVER['HTTPS'] = '1';
+                $this->assertTrue( is_ssl() );
+
+                unset( $_SERVER['HTTPS'] );
+                $_SERVER['SERVER_PORT'] = '443';
+                $this->assertTrue( is_ssl() );
+        }
+
+        function test_is_ssl_negative() {
+                $_SERVER['HTTPS'] = 'off';
+                $this->assertFalse( is_ssl() );
+
+                $_SERVER['HTTPS'] = 'OFF';
+                $this->assertFalse( is_ssl() );
+
+                unset($_SERVER['HTTPS']);
+                $this->assertFalse( is_ssl() );
+        }
+
+        function test_admin_url_valid() {
+                $paths = array(
+                        '' => "/wp-admin/",
+                        'foo' => "/wp-admin/foo",
+                        '/foo' => "/wp-admin/foo",
+                        '/foo/' => "/wp-admin/foo/",
+                        'foo.php' => "/wp-admin/foo.php",
+                        '/foo.php' => "/wp-admin/foo.php",
+                        '/foo.php?bar=1' => "/wp-admin/foo.php?bar=1",
+                );
+                $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 => $out) {
+                                $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
+                        }
+                }
+        }
+
+        function test_admin_url_invalid() {
+                $paths = array(
+                        null => "/wp-admin/",
+                        0 => "/wp-admin/",
+                        -1 => "/wp-admin/",
+                        '../foo/' => "/wp-admin/",
+                        '///' => "/wp-admin/",
+                );
+                $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 => $out) {
+                                $this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
+                        }
+                }
+        }
+
+        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->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );
+                        $this->assertEquals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );
+
+                        $_SERVER['HTTPS'] = 'on';
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link ) );
+
+                        $_SERVER['HTTPS'] = 'off';
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link ) );
+
+                        force_ssl_login( false );
+                        force_ssl_admin( true );
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+                        force_ssl_admin( false );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+                        force_ssl_login( true );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
+                        $this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+                        $this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
+                        $this->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>+<?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->author_id = $this->factory->user->create( array(
+                        'role' => 'author',
+                        'user_login' => 'test_author',
+                        'description' => 'test_author',
+                ) );
+                $user = new WP_User( $this->author_id );
+
+                $post = array(
+                        'post_author' => $this->author_id,
+                        'post_status' => 'publish',
+                        'post_content' => rand_str(),
+                        'post_title' => rand_str(),
+                        'post_type' => 'post'
+                );
+
+                // insert a post and make sure the ID is ok
+                $this->post_id = $this->factory->post->create( $post );
+
+                setup_postdata( get_post( $this->post_id ) );
+        }
+
+        function tearDown() {
+                wp_reset_postdata();
+                parent::tearDown();
+        }
+
+        function test_get_the_author() {
+                $author_name = get_the_author();
+                $user = new WP_User( $this->author_id );
+
+                $this->assertEquals( $user->display_name, $author_name );
+                $this->assertEquals( 'test_author', $author_name );
+        }
+
+        function test_get_the_author_meta() {
+                $this->assertEquals( 'test_author', get_the_author_meta( 'login' ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
+
+                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                add_user_meta( $this->author_id, 'user_description', 'user description' );
+                $this->assertEquals( 'user description', get_user_meta( $this->author_id, 'user_description', true ) );
+                // user_description in meta is ignored. The content of description is returned instead.
+                // See #20285
+                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+                update_user_meta( $this->author_id, 'user_description', '' );
+                $this->assertEquals( '', get_user_meta( $this->author_id, 'user_description', true ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+                $this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+
+                $this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
+        }
+
+        function test_get_the_author_meta_no_authordata() {
+                unset( $GLOBALS['authordata'] );
+                $this->assertEquals( '', get_the_author_meta( 'id' ) );
+                $this->assertEquals( '', get_the_author_meta( 'user_login' ) );
+                $this->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>+<?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->_flush_roles();
+
+                $this->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->_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->factory->user->create( array( 'role' => 'administrator' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // make sure the role name is correct
+                $this->assertEquals(array('administrator'), $user->roles);
+
+                // check a few of the main capabilities
+                $this->assertTrue($user->has_cap('switch_themes'));
+                $this->assertTrue($user->has_cap('list_users'));
+                $this->assertTrue($user->has_cap('manage_options'));
+                $this->assertTrue($user->has_cap('level_10'));
+        }
+
+        function test_user_editor() {
+                $id = $this->factory->user->create( array( 'role' => 'editor' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // make sure the role name is correct
+                $this->assertEquals(array('editor'), $user->roles);
+
+                // check a few of the main capabilities
+                $this->assertTrue($user->has_cap('moderate_comments'));
+                $this->assertTrue($user->has_cap('manage_categories'));
+                $this->assertTrue($user->has_cap('upload_files'));
+                $this->assertTrue($user->has_cap('level_7'));
+
+                // and a few capabilities this user doesn't have
+                $this->assertFalse($user->has_cap('switch_themes'));
+                $this->assertFalse($user->has_cap('edit_users'));
+                $this->assertFalse($user->has_cap('level_8'));
+        }
+
+        function test_user_author() {
+                $id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // make sure the role name is correct
+                $this->assertEquals(array('author'), $user->roles);
+
+                // check a few of the main capabilities
+                $this->assertTrue($user->has_cap('edit_posts'));
+                $this->assertTrue($user->has_cap('edit_published_posts'));
+                $this->assertTrue($user->has_cap('upload_files'));
+                $this->assertTrue($user->has_cap('level_2'));
+
+                // and a few capabilities this user doesn't have
+                $this->assertFalse($user->has_cap('moderate_comments'));
+                $this->assertFalse($user->has_cap('manage_categories'));
+                $this->assertFalse($user->has_cap('level_3'));
+        }
+
+        function test_user_contributor() {
+                $id = $this->factory->user->create( array( 'role' => 'contributor' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // make sure the role name is correct
+                $this->assertEquals(array('contributor'), $user->roles);
+
+                // check a few of the main capabilities
+                $this->assertTrue($user->has_cap('edit_posts'));
+                $this->assertTrue($user->has_cap('read'));
+                $this->assertTrue($user->has_cap('level_1'));
+                $this->assertTrue($user->has_cap('level_0'));
+
+                // and a few capabilities this user doesn't have
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_published_posts'));
+                $this->assertFalse($user->has_cap('level_2'));
+        }
+
+        function test_user_subscriber() {
+                $id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // make sure the role name is correct
+                $this->assertEquals(array('subscriber'), $user->roles);
+
+                // check a few of the main capabilities
+                $this->assertTrue($user->has_cap('read'));
+                $this->assertTrue($user->has_cap('level_0'));
+
+                // and a few capabilities this user doesn't have
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_posts'));
+                $this->assertFalse($user->has_cap('level_1'));
+        }
+
+        // a role that doesn't exist
+        function test_bogus_role() {
+                _disable_wp_die();
+                $id = $this->factory->user->create( array( 'role' => rand_str() ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // user has no role and no capabilities
+                $this->assertEquals(array(), $user->roles);
+                $this->assertFalse($user->has_cap('level_0'));
+                _enable_wp_die();
+        }
+
+        // a user with multiple roles
+        function test_user_subscriber_contributor() {
+                $id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+                $user->add_role('contributor');
+
+                // nuke and re-fetch the object to make sure it was stored
+                $user = NULL;
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // user should have two roles now
+                $this->assertEquals(array('subscriber', 'contributor'), $user->roles);
+
+                // with contributor capabilities
+                $this->assertTrue($user->has_cap('edit_posts'));
+                $this->assertTrue($user->has_cap('read'));
+                $this->assertTrue($user->has_cap('level_1'));
+                $this->assertTrue($user->has_cap('level_0'));
+
+                // but not these
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_published_posts'));
+                $this->assertFalse($user->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->_flush_roles();
+                $this->assertTrue($wp_roles->is_role($role_name));
+
+                $id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                $this->assertEquals(array($role_name), $user->roles);
+
+                // user shouldn't have any capabilities; test a quick sample
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_published_posts'));
+                $this->assertFalse($user->has_cap('level_1'));
+                $this->assertFalse($user->has_cap('level_0'));
+
+                // clean up
+                remove_role($role_name);
+                $this->_flush_roles();
+                $this->assertFalse($wp_roles->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'=>true, 'edit_pages'=>true, 'level_0'=>true, 'level_1'=>true, 'level_2'=>true));
+                $this->_flush_roles();
+                $this->assertTrue($wp_roles->is_role($role_name));
+
+                $id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                $this->assertEquals(array($role_name), $user->roles);
+
+                // the user should have all the above caps
+                $this->assertTrue($user->has_cap($role_name));
+                $this->assertTrue($user->has_cap('edit_posts'));
+                $this->assertTrue($user->has_cap('edit_pages'));
+                $this->assertTrue($user->has_cap('level_0'));
+                $this->assertTrue($user->has_cap('level_1'));
+                $this->assertTrue($user->has_cap('level_2'));
+
+                // shouldn't have any other caps
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_published_posts'));
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('level_3'));
+
+                // clean up
+                remove_role($role_name);
+                $this->_flush_roles();
+                $this->assertFalse($wp_roles->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'=>true) );
+                $this->_flush_roles();
+                $this->assertTrue( $wp_roles->is_role($role_name) );
+
+                // assign a user to that role
+                $id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+                // now add a cap to the role
+                $wp_roles->add_cap($role_name, 'sweep_floor');
+                $this->_flush_roles();
+
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+                $this->assertEquals(array($role_name), $user->roles);
+
+                // the user should have all the above caps
+                $this->assertTrue($user->has_cap($role_name));
+                $this->assertTrue($user->has_cap('level_1'));
+                $this->assertTrue($user->has_cap('sweep_floor'));
+
+                // shouldn't have any other caps
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('edit_published_posts'));
+                $this->assertFalse($user->has_cap('upload_files'));
+                $this->assertFalse($user->has_cap('level_4'));
+
+                // clean up
+                remove_role($role_name);
+                $this->_flush_roles();
+                $this->assertFalse($wp_roles->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'=>true, 'sweep_floor'=>true, 'polish_doorknobs'=>true) );
+                $this->_flush_roles();
+                $this->assertTrue( $wp_roles->is_role($role_name) );
+
+                // assign a user to that role
+                $id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+                // now remove a cap from the role
+                $wp_roles->remove_cap($role_name, 'polish_doorknobs');
+                $this->_flush_roles();
+
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+                $this->assertEquals(array($role_name), $user->roles);
+
+                // the user should have all the above caps
+                $this->assertTrue($user->has_cap($role_name));
+                $this->assertTrue($user->has_cap('level_1'));
+                $this->assertTrue($user->has_cap('sweep_floor'));
+
+                // shouldn't have the removed cap
+                $this->assertFalse($user->has_cap('polish_doorknobs'));
+
+                // clean up
+                remove_role($role_name);
+                $this->_flush_roles();
+                $this->assertFalse($wp_roles->is_role($role_name));
+
+        }
+
+        function test_user_add_cap() {
+                // add an extra capability to a user
+
+                // there are two contributors
+                $id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+                $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+
+                // user 1 has an extra capability
+                $user_1 = new WP_User($id_1);
+                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+                $user_1->add_cap('publish_posts');
+
+                // re-fetch both users from the db
+                $user_1 = new WP_User($id_1);
+                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+                $user_2 = new WP_User($id_2);
+                $this->assertTrue($user_2->exists(), "Problem getting user $id_2");
+
+                // make sure they're both still contributors
+                $this->assertEquals(array('contributor'), $user_1->roles);
+                $this->assertEquals(array('contributor'), $user_2->roles);
+
+                // check the extra cap on both users
+                $this->assertTrue($user_1->has_cap('publish_posts'));
+                $this->assertFalse($user_2->has_cap('publish_posts'));
+
+                // make sure the other caps didn't get messed up
+                $this->assertTrue($user_1->has_cap('edit_posts'));
+                $this->assertTrue($user_1->has_cap('read'));
+                $this->assertTrue($user_1->has_cap('level_1'));
+                $this->assertTrue($user_1->has_cap('level_0'));
+                $this->assertFalse($user_1->has_cap('upload_files'));
+                $this->assertFalse($user_1->has_cap('edit_published_posts'));
+                $this->assertFalse($user_1->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->factory->user->create( array( 'role' => 'contributor' ) );
+                $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+
+                // user 1 has an extra capability
+                $user_1 = new WP_User($id_1);
+                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+                $user_1->add_cap('publish_posts');
+
+                // now remove the extra cap
+                $user_1->remove_cap('publish_posts');
+
+                // re-fetch both users from the db
+                $user_1 = new WP_User($id_1);
+                $this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+                $user_2 = new WP_User($id_2);
+                $this->assertTrue($user_2->exists(), "Problem getting user $id_2");
+
+                // make sure they're both still contributors
+                $this->assertEquals(array('contributor'), $user_1->roles);
+                $this->assertEquals(array('contributor'), $user_2->roles);
+
+                // check the removed cap on both users
+                $this->assertFalse($user_1->has_cap('publish_posts'));
+                $this->assertFalse($user_2->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->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // author = user level 2
+                $this->assertEquals( 2, $user->user_level );
+
+                // they get promoted to editor - level should get bumped to 7
+                $user->set_role('editor');
+                $this->assertEquals( 7, $user->user_level );
+
+                // demoted to contributor - level is reduced to 1
+                $user->set_role('contributor');
+                $this->assertEquals( 1, $user->user_level );
+
+                // if they have two roles, user_level should be the max of the two
+                $user->add_role('editor');
+                $this->assertEquals(array('contributor', 'editor'), $user->roles);
+                $this->assertEquals( 7, $user->user_level );
+        }
+
+        function test_user_remove_all_caps() {
+                // user starts as an author
+                $id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // add some extra capabilities
+                $user->add_cap('make_coffee');
+                $user->add_cap('drink_coffee');
+
+                // re-fetch
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                $this->assertTrue($user->has_cap('make_coffee'));
+                $this->assertTrue($user->has_cap('drink_coffee'));
+
+                // all caps are removed
+                $user->remove_all_caps();
+
+                // re-fetch
+                $user = new WP_User($id);
+                $this->assertTrue($user->exists(), "Problem getting user $id");
+
+                // capabilities for the author role should be gone
+#                $this->assertFalse($user->has_cap('edit_posts'));
+#                $this->assertFalse($user->has_cap('edit_published_posts'));
+#                $this->assertFalse($user->has_cap('upload_files'));
+#                $this->assertFalse($user->has_cap('level_2'));
+
+                // the extra capabilities should be gone
+                $this->assertFalse($user->has_cap('make_coffee'));
+                $this->assertFalse($user->has_cap('drink_coffee'));
+
+                // user level should be empty
+                $this->assertEmpty( $user->user_level );
+
+
+        }
+
+        function test_post_meta_caps() {
+                // simple tests for some common meta capabilities
+
+                // Make our author
+                $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+
+                // make a post
+                $post = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );
+
+                // the author of the post
+                $this->assertTrue($author->exists(), "Problem getting user $author->ID");
+
+                // add some other users
+                $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+                $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+                $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+                $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
+
+                // administrators, editors and the post owner can edit it
+                $this->assertTrue($admin->has_cap('edit_post', $post));
+                $this->assertTrue($author->has_cap('edit_post', $post));
+                $this->assertTrue($editor->has_cap('edit_post', $post));
+                // other authors and contributors can't
+                $this->assertFalse($author_2->has_cap('edit_post', $post));
+                $this->assertFalse($contributor->has_cap('edit_post', $post));
+
+                // administrators, editors and the post owner can delete it
+                $this->assertTrue($admin->has_cap('delete_post', $post));
+                $this->assertTrue($author->has_cap('delete_post', $post));
+                $this->assertTrue($editor->has_cap('delete_post', $post));
+                // other authors and contributors can't
+                $this->assertFalse($author_2->has_cap('delete_post', $post));
+                $this->assertFalse($contributor->has_cap('delete_post', $post));
+
+                // Test meta authorization callbacks
+                if ( function_exists( 'register_meta') ) {
+                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post) );
+                        $this->assertTrue( $admin->has_cap('add_post_meta', $post) );
+                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post) );
+
+                        $this->assertFalse( $admin->has_cap('edit_post_meta', $post, '_protected') );
+                        $this->assertFalse( $admin->has_cap('add_post_meta', $post, '_protected') );
+                        $this->assertFalse( $admin->has_cap('delete_post_meta', $post, '_protected') );
+
+                        register_meta( 'post', '_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_yes_you_can' ) );
+                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post, '_protected') );
+                        $this->assertTrue( $admin->has_cap('add_post_meta', $post, '_protected') );
+                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post, '_protected') );
+
+                        $this->assertTrue( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
+                        $this->assertTrue( $admin->has_cap('add_post_meta', $post, 'not_protected') );
+                        $this->assertTrue( $admin->has_cap('delete_post_meta', $post, 'not_protected') );
+
+                        register_meta( 'post', 'not_protected', array( &$this, '_meta_filter' ), array( &$this, '_meta_no_you_cant' ) );
+                        $this->assertFalse( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
+                        $this->assertFalse( $admin->has_cap('add_post_meta', $post, 'not_protected') );
+                        $this->assertFalse( $admin->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->factory->user->create( array( 'role' => 'author' ) ) );
+
+                // make a page
+                $page = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );
+
+                // the author of the page
+                $this->assertTrue($author->exists(), "Problem getting user " . $author->ID);
+
+                // add some other users
+                $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+                $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+                $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+                $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
+
+                // administrators, editors and the post owner can edit it
+                $this->assertTrue($admin->has_cap('edit_page', $page));
+                $this->assertTrue($editor->has_cap('edit_page', $page));
+                // other authors and contributors can't
+                $this->assertFalse($author->has_cap('edit_page', $page));
+                $this->assertFalse($author_2->has_cap('edit_page', $page));
+                $this->assertFalse($contributor->has_cap('edit_page', $page));
+
+                // administrators, editors and the post owner can delete it
+                $this->assertTrue($admin->has_cap('delete_page', $page));
+                $this->assertTrue($editor->has_cap('delete_page', $page));
+                // other authors and contributors can't
+                $this->assertFalse($author->has_cap('delete_page', $page));
+                $this->assertFalse($author_2->has_cap('delete_page', $page));
+                $this->assertFalse($contributor->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>+<?php
+
+/**
+ * @group user
+ * @group capabilities
+ */
+class Tests_User_MapMetaCap extends WP_UnitTestCase {
+        var $super_admins = null;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->user_ids = array();
+
+                $this->user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+                $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+                if ( isset( $GLOBALS['super_admins'] ) )
+                        $this->super_admins = $GLOBALS['super_admins'];
+                $user = new WP_User( $this->user_id );
+                $GLOBALS['super_admins'] = array( $user->user_login );
+
+                $this->post_type = rand_str( 20 );
+                register_post_type( $this->post_type );
+
+                $this->post_id = wp_insert_post( array(
+                        'post_title' => rand_str(),
+                        'post_type' => $this->post_type,
+                        'post_status' => 'private',
+                        'post_author' => $this->author_id,
+                ) );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+
+                $GLOBALS['super_admins'] = $this->super_admins;
+                unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
+        }
+
+        function test_capability_type_post_with_no_extra_caps() {
+
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'post',
+                ) );
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertTrue( $post_type_object->map_meta_cap );
+
+                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_custom_capability_type_with_map_meta_cap() {
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'book',
+                        'map_meta_cap' => true,
+                ) );
+
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_private_books' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_private_books' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_capability_type_post_with_one_renamed_cap() {
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'post',
+                        'capabilities' => array( 'edit_posts' => 'edit_books' ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertFalse( $post_type_object->map_meta_cap );
+
+                $this->assertEquals( array( 'edit_post' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_post' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_post' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_post' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_post' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_post' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_capability_type_post_map_meta_cap_true_with_renamed_cap() {
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'post',
+                        'map_meta_cap' => true,
+                        'capabilities' => array(
+                                'edit_post' => 'edit_book', // maps back to itself.
+                                'edit_others_posts' => 'edit_others_books',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertTrue( $post_type_object->map_meta_cap );
+
+                $this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_capability_type_post_with_all_meta_caps_renamed() {
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'post',
+                        'capabilities' => array(
+                                'edit_post' => 'edit_book',
+                                'read_post' => 'read_book',
+                                'delete_post' => 'delete_book',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertFalse( $post_type_object->map_meta_cap );
+
+                $this->assertEquals( array( 'edit_book' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_book' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_book' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_book' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_book' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_book' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_capability_type_post_with_all_meta_caps_renamed_mapped() {
+                register_post_type( $this->post_type, array(
+                        'capability_type' => 'post',
+                        'map_meta_cap' => true,
+                        'capabilities' => array(
+                                'edit_post' => 'edit_book',
+                                'read_post' => 'read_book',
+                                'delete_post' => 'delete_book',
+                        ),
+                ) );
+
+                $post_type_object = get_post_type_object( $this->post_type );
+
+                $this->assertTrue( $post_type_object->map_meta_cap );
+
+                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'read_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+                $this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+                        map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+        }
+
+        function test_unfiltered_html_cap() {
+                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
+                        $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+                if ( is_multisite() ) {
+                        $this->assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
+                        $this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->user_id ) );
+                } else {
+                        $this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->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->markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
+
+                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
+                        if ( ! DISALLOW_UNFILTERED_HTML )
+                                $this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+                } else {
+                        define( 'DISALLOW_UNFILTERED_HTML', true );
+                }
+
+                $this->assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', $this->user_id ) );
+                $this->assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', $this->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>+<?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->_deprecated_errors = array();
+        }
+
+        public function deprecated_handler( $function, $message, $version ) {
+                $this->_deprecated_errors[] = array(
+                        'function' => $function,
+                        'message' => $message,
+                        'version' => $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->factory->user->create( array( 'role' => $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->user_id] ) ) {
+                                $roles = array_keys( unserialize( $user->meta_value ) );
+                                $found[ $user->user_id ] = $roles[0];
+                        }
+                }
+
+                // make sure every user we created was returned
+                $this->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->factory->user->create( array( 'role' => 'author' ) );
+
+                // get an option that doesn't exist
+                $this->assertFalse(get_user_option($key, $user_id));
+
+                // set and get
+                update_user_option( $user_id, $key, $val );
+                $this->assertEquals( $val, get_user_option($key, $user_id) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_user_option( $user_id, $key, $val2 );
+                $this->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->factory->user->create( array( 'role' => 'author' ) );
+
+                // get a meta key that doesn't exist
+                $this->assertEquals( '', get_usermeta($user_id, $key) );
+
+                // set and get
+                update_usermeta( $user_id, $key, $val );
+                $this->assertEquals( $val, get_usermeta($user_id, $key) );
+
+                // change and get again
+                $val2 = rand_str();
+                update_usermeta( $user_id, $key, $val2 );
+                $this->assertEquals( $val2, get_usermeta($user_id, $key) );
+
+                // delete and get
+                delete_usermeta( $user_id, $key );
+                $this->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->assertEquals( $val, get_usermeta($user_id, $key) );
+                // correct key: deleted
+                delete_usermeta( $user_id, $key, $val );
+                $this->assertEquals( '', get_usermeta($user_id, $key) );
+
+        }
+
+        // test usermeta functions in array mode
+        function test_usermeta_array() {
+                // some values to set
+                $vals = array(
+                        rand_str() => 'val-'.rand_str(),
+                        rand_str() => 'val-'.rand_str(),
+                        rand_str() => 'val-'.rand_str(),
+                );
+
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+                // there is already some stuff in the array
+                $this->assertTrue(is_array(get_usermeta($user_id)));
+
+                foreach ($vals as $k=>$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->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=>$v) {
+                        if ($k == $key_to_delete)
+                                $this->assertFalse(in_array($v, $out));
+                        else
+                                $this->assertTrue(in_array($v, $out));
+                }
+        }
+
+        // Test property magic functions for property get/set/isset.
+        function test_user_properties() {
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                foreach ( $user->data as $key => $data ) {
+                        $this->assertEquals( $data, $user->$key );
+                }
+
+                $this->assertTrue( isset( $user->$key ) );
+                $this->assertFalse( isset( $user->fooooooooo ) );
+
+                $user->$key = 'foo';
+                $this->assertEquals( 'foo', $user->$key );
+                $this->assertEquals( 'foo', $user->data->$key ); // This will fail with WP < 3.3
+
+                foreach ( (array) $user as $key => $value ) {
+                        $this->assertEquals( $value, $user->$key );
+                }
+        }
+
+        /**
+         * Test the magic __unset method
+         *
+         * @ticket 20043
+         */
+        public function test_user_unset() {
+                // New user
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                // Test custom fields
+                $user->customField = 123;
+                $this->assertEquals( $user->customField, 123 );
+                unset( $user->customField );
+                $this->assertFalse( isset( $user->customField ) );
+
+                // Test 'id' (lowercase)
+                add_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3 );
+                unset( $user->id );
+                $this->assertCount( 1, $this->_deprecated_errors );
+                $this->assertEquals( 'WP_User->id', $this->_deprecated_errors[0]['function'] );
+                $this->assertEquals( '2.1', $this->_deprecated_errors[0]['version'] );
+                remove_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3);
+
+                // Test 'ID'
+                $this->assertNotEmpty( $user->ID );
+                unset( $user->ID );
+                $this->assertEmpty( $user->ID );
+        }
+
+        // Test meta property magic functions for property get/set/isset.
+        function test_user_meta_properties() {
+                global $wpdb;
+
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                update_user_option( $user_id, 'foo', 'foo', true );
+
+                $this->assertTrue( isset( $user->foo ) );
+
+                $this->assertEquals( 'foo', $user->foo );
+        }
+
+        function test_id_property_back_compat() {
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $this->assertTrue( isset( $user->id ) );
+                $this->assertEquals( $user->ID, $user->id );
+                $user->id = 1234;
+                $this->assertEquals( $user->ID, $user->id );
+        }
+
+        /**
+         * ticket 19265
+         */
+        function test_user_level_property_back_compat() {
+                $roles = array(
+                        'administrator' => 10,
+                        'editor' => 7,
+                        'author' => 2,
+                        'contributor' => 1,
+                        'subscriber' => 0,
+                );
+
+                foreach ( $roles as $role => $level ) {
+                        $user_id = $this->factory->user->create( array( 'role' => $role ) );
+                        $user = new WP_User( $user_id );
+
+                        $this->assertTrue( isset( $user->user_level ) );
+                        $this->assertEquals( $level, $user->user_level );
+                }
+        }
+
+        function test_construction() {
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+                $user = new WP_User( $user_id );
+                $this->assertInstanceOf( 'WP_User', $user );
+                $this->assertEquals( $user_id, $user->ID );
+
+                $user2 = new WP_User( 0, $user->user_login );
+                $this->assertInstanceOf( 'WP_User', $user2 );
+                $this->assertEquals( $user_id, $user2->ID );
+                $this->assertEquals( $user->user_login, $user2->user_login );
+
+                $user3 = new WP_User();
+                $this->assertInstanceOf( 'WP_User', $user3 );
+                $this->assertEquals( 0, $user3->ID );
+                $this->assertFalse( isset( $user3->user_login ) );
+
+                $user3->init( $user->data );
+                $this->assertEquals( $user_id, $user3->ID );
+
+                $user4 = new WP_User( $user->user_login );
+                $this->assertInstanceOf( 'WP_User', $user4 );
+                $this->assertEquals( $user_id, $user4->ID );
+                $this->assertEquals( $user->user_login, $user4->user_login );
+
+                $user5 = new WP_User( null, $user->user_login );
+                $this->assertInstanceOf( 'WP_User', $user5 );
+                $this->assertEquals( $user_id, $user5->ID );
+                $this->assertEquals( $user->user_login, $user5->user_login );
+        }
+
+        function test_get() {
+                $user_id = $this->factory->user->create( array(
+                        'role' => 'author',
+                        'user_login' => 'test_wp_user_get',
+                        'user_pass' => 'password',
+                        'user_email' => 'test@test.com',
+                ) );
+
+                $user = new WP_User( $user_id );
+                $this->assertEquals( 'test_wp_user_get', $user->get( 'user_login' ) );
+                $this->assertEquals( 'test@test.com', $user->get( 'user_email' ) );
+                $this->assertEquals( 0, $user->get( 'use_ssl' ) );
+                $this->assertEquals( '', $user->get( 'field_that_does_not_exist' ) );
+
+                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+                $this->assertEquals( 'abcdefg', $user->get( 'dashed-key' ) );
+        }
+
+        function test_has_prop() {
+                $user_id = $this->factory->user->create( array(
+                        'role' => 'author',
+                        'user_login' => 'test_wp_user_has_prop',
+                        'user_pass' => 'password',
+                        'user_email' => 'test2@test.com',
+                ) );
+
+                $user = new WP_User( $user_id );
+                $this->assertTrue( $user->has_prop( 'user_email') );
+                $this->assertTrue( $user->has_prop( 'use_ssl' ) );
+                $this->assertFalse( $user->has_prop( 'field_that_does_not_exist' ) );
+
+                update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+                $this->assertTrue( $user->has_prop( 'dashed-key' ) );
+        }
+
+        function test_update_user() {
+                $user_id = $this->factory->user->create( array(
+                        'role' => 'author',
+                        'user_login' => 'test_wp_update_user',
+                        'user_pass' => 'password',
+                        'user_email' => 'test3@test.com',
+                ) );
+                $user = new WP_User( $user_id );
+
+                update_user_meta( $user_id, 'description', 'about me' );
+                $this->assertEquals( 'about me', $user->get( 'description' ) );
+
+                $user_data = array( 'ID' => $user_id, 'display_name' => 'test user' );
+                wp_update_user( $user_data );
+
+                $user = new WP_User( $user_id );
+                $this->assertEquals( 'test user', $user->get( 'display_name' ) );
+
+                // Make sure there is no collateral damage to fields not in $user_data
+                $this->assertEquals( 'about me', $user->get( 'description' ) );
+
+                // Test update of fields in _get_additional_user_keys()
+                $user_data = array( 'ID' => $user_id, 'use_ssl' => 1, 'show_admin_bar_front' => 1,
+                                                 'rich_editing' => 1, 'first_name' => 'first', 'last_name' => 'last',
+                                                 'nickname' => 'nick', 'comment_shortcuts' => 1, 'admin_color' => 'classic',
+                                                 'description' => 'describe', 'aim' => 'aim', 'yim' => 'yim', 'jabber' => 'jabber' );
+                wp_update_user( $user_data );
+
+                $user = new WP_User( $user_id );
+                foreach ( $user_data as $key => $value )
+                        $this->assertEquals( $value, $user->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->assertEquals( array(), get_blogs_of_user( 0 ) );
+
+                $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+                $blogs = get_blogs_of_user( $user_id );
+                $this->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->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->factory->user->create( array( 'role' => 'subscriber' ) );
+                wp_set_current_user( $user_id );
+
+                $this->assertTrue( is_user_member_of_blog() );
+                $this->assertTrue( is_user_member_of_blog( 0, 0 ) );
+                $this->assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) );
+                $this->assertTrue( is_user_member_of_blog( $user_id ) );
+                $this->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->assertFalse( is_user_member_of_blog( $user_id ) );
+                $this->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->factory->user->create( array( 'role' => 'subscriber' ) );
+                wp_set_current_user( $user_id );
+
+                $this->assertNotEmpty( $userdata );
+                $this->assertInstanceOf( 'WP_User', $userdata );
+                $this->assertEquals( $userdata->ID, $user_id );
+                $prefix = $wpdb->get_blog_prefix();
+                $cap_key = $prefix . 'capabilities';
+                $this->assertTrue( isset( $userdata->$cap_key ) );
+        }
+
+        /**
+         * ticket 19769
+         */
+        function test_global_userdata_is_null_when_logged_out() {
+                global $userdata;
+                wp_set_current_user(0);
+                $this->assertNull( $userdata );
+        }
+
+        function test_exists() {
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $this->assertTrue( $user->exists() );
+
+                $user = new WP_User( 123456789 );
+
+                $this->assertFalse( $user->exists() );
+
+                $user = new WP_User( 0 );
+
+                $this->assertFalse( $user->exists() );
+        }
+
+        function test_global_authordata() {
+                global $authordata, $id;
+
+                $old_post_id = $id;
+
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $post = array(
+                        'post_author' => $user_id,
+                        'post_status' => 'publish',
+                        'post_content' => rand_str(),
+                        'post_title' => rand_str(),
+                        'post_type' => 'post'
+                );
+
+                // insert a post and make sure the ID is ok
+                $post_id = wp_insert_post( $post );
+                $this->assertTrue( is_numeric( $post_id ) );
+
+                setup_postdata( get_post( $post_id ) );
+
+                $this->assertNotEmpty( $authordata );
+                $this->assertInstanceOf( 'WP_User', $authordata );
+                $this->assertEquals( $authordata->ID, $user_id );
+
+                setup_postdata( get_post( $old_post_id ) );
+        }
+
+        function test_delete_user() {
+                $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+                $user = new WP_User( $user_id );
+
+                $post = array(
+                        'post_author' => $user_id,
+                        'post_status' => 'publish',
+                        'post_content' => rand_str(),
+                        'post_title' => rand_str(),
+                        'post_type' => 'post',
+                );
+
+                // insert a post and make sure the ID is ok
+                $post_id = wp_insert_post($post);
+                $this->assertTrue(is_numeric($post_id));
+                $this->assertTrue($post_id > 0);
+
+                $post = get_post( $post_id );
+                $this->assertEquals( $post_id, $post->ID );
+
+                $post = array(
+                        'post_author' => $user_id,
+                        'post_status' => 'publish',
+                        'post_content' => rand_str(),
+                        'post_title' => rand_str(),
+                        'post_type' => 'nav_menu_item',
+                );
+
+                // insert a post and make sure the ID is ok
+                $nav_id = wp_insert_post($post);
+                $this->assertTrue(is_numeric($nav_id));
+                $this->assertTrue($nav_id > 0);
+
+                $post = get_post( $nav_id );
+                $this->assertEquals( $nav_id, $post->ID );
+
+                wp_delete_user( $user_id );
+                $user = new WP_User( $user_id );
+                if ( is_multisite() )
+                        $this->assertTrue( $user->exists() );
+                else
+                        $this->assertFalse( $user->exists() );
+
+                $this->assertNotNull( get_post( $post_id ) );
+                $this->assertEquals( 'trash', get_post( $post_id )->post_status );
+                // nav_menu_item is delete_with_user = false so the nav post should remain published.
+                $this->assertNotNull( get_post( $nav_id ) );
+                $this->assertEquals( 'publish', get_post( $nav_id )->post_status );
+                wp_delete_post( $nav_id, true );
+                $this->assertNull( get_post( $nav_id ) );
+                wp_delete_post( $post_id, true );
+                $this->assertNull( get_post( $post_id ) );
+        }
+
+        /**
+         * @ticket 13317
+         */
+        function test_get_userdata() {
+                $this->assertFalse( get_userdata( 0 ) );
+                $this->assertFalse( get_userdata( '0' ) );
+                $this->assertFalse( get_userdata( 'string' ) );
+                $this->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>+<?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->wp_getOptions( array( 1, 'username', 'password' ) );
+
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 405, $result->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_no_posts() {
+                $this->make_user_by_role( 'author' );
+
+                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+        }
+
+        function test_no_editable_posts() {
+                $this->make_user_by_role( 'author' );
+                $editor = $this->make_user_by_role( 'editor' );
+                $this->factory->post->create( array( 'post_author' => $editor ) );
+
+                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 0, count( $result ) );
+        }
+
+        function test_date() {
+                $this->make_user_by_role( 'author' );
+
+                $this->factory->post->create();
+
+                $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+                $this->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->post_date, false ), 'Ymd\TH:i:s' ) );
+
+                        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                        $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+                        $this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
+                        $this->assertEquals( $date_gmt, $result['date_created_gmt']->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_editPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $post = array();
+                $result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_edit_own_post() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' => $new_title );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $new_title, $out->post_title );
+        }
+
+        function test_capable_edit_others_post() {
+                $this->make_user_by_role( 'editor' );
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' => $new_title );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $new_title, $out->post_title );
+        }
+
+        function test_incapable_edit_others_post() {
+                $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $original_title = 'Post test';
+                $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'title' => $new_title );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $original_title, $out->post_title );
+        }
+
+        function test_capable_reassign_author() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'wp_author_id' => $author_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $author_id, $out->post_author );
+        }
+
+        function test_incapable_reassign_author() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'wp_author_id' => $author_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $contributor_id, $out->post_author );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $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' => $attachment_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->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' => 'Updated post' );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create another attachment
+                $attachment2 = array_merge( $attachment, array( 'title' => 'Post Thumbnail 2' ) );
+                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+                // change the post's post_thumbnail
+                $post4 = array( 'wp_post_thumbnail' => $attachment2_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // unset the post's post_thumbnail
+                $post5 = array( 'wp_post_thumbnail' => '' );
+                $result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_edit_basic_post_info() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Title', 'post_content' => 'Content', 'post_excerpt' => 'Excerpt', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'title' => 'New Title', 'post_author' => $contributor_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $post2['title'], $out->post_title );
+
+                $post3 = array( 'description' => 'New Content', 'post_author' => $contributor_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $post2['title'], $out->post_title );
+                $this->assertEquals( $post3['description'], $out->post_content );
+
+                $post4 = array( 'mt_excerpt' => 'New Excerpt', 'post_author' => $contributor_id );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $post2['title'], $out->post_title );
+                $this->assertEquals( $post3['description'], $out->post_content );
+                $this->assertEquals( $post4['mt_excerpt'], $out->post_excerpt );
+        }
+
+        // Not allowed since [19914]
+        function test_change_post_type() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Title', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_type' => 'page' );
+                $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $result->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>+<?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->make_user_by_role( 'author' );
+                $this->post_date_ts = strtotime( '+1 day' );
+                $this->post_data = array(
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str( 2000 ),
+                        'post_excerpt' => rand_str( 100 ),
+                        'post_author' => $author_id,
+                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+                );
+                $this->post_id = wp_insert_post( $this->post_data );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'subscriber', 'subscriber' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        /**
+         * @ticket 20336
+         */
+        function test_invalid_postid() {
+                $result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post' );
+                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this->assertInternalType( 'string', $result['userid'] );
+                $this->assertInternalType( 'int', $result['postid'] );
+                $this->assertInternalType( 'string', $result['description'] );
+                $this->assertInternalType( 'string', $result['title'] );
+                $this->assertInternalType( 'string', $result['link'] );
+                $this->assertInternalType( 'string', $result['permaLink'] );
+                $this->assertInternalType( 'array', $result['categories'] );
+                $this->assertInternalType( 'string', $result['mt_excerpt'] );
+                $this->assertInternalType( 'string', $result['mt_text_more'] );
+                $this->assertInternalType( 'string', $result['wp_more_text'] );
+                $this->assertInternalType( 'int', $result['mt_allow_comments'] );
+                $this->assertInternalType( 'int', $result['mt_allow_pings'] );
+                $this->assertInternalType( 'string', $result['mt_keywords'] );
+                $this->assertInternalType( 'string', $result['wp_slug'] );
+                $this->assertInternalType( 'string', $result['wp_password'] );
+                $this->assertInternalType( 'string', $result['wp_author_id'] );
+                $this->assertInternalType( 'string', $result['wp_author_display_name'] );
+                $this->assertInternalType( 'string', $result['post_status'] );
+                $this->assertInternalType( 'array', $result['custom_fields'] );
+                $this->assertInternalType( 'string', $result['wp_post_format'] );
+                $this->assertInternalType( 'bool', $result['sticky'] );
+
+
+                // Check expected values
+                $this->assertStringMatchesFormat( '%d', $result['userid'] );
+                $this->assertEquals( $this->post_data['post_title'], $result['title'] );
+                $this->assertEquals( 'draft', $result['post_status'] );
+                $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+                $this->assertEquals( $this->post_data['post_excerpt'], $result['mt_excerpt'] );
+                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+
+                $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
+
+                set_post_thumbnail( $this->post_id, $attachment_id );
+
+                $fields = array( 'post' );
+                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
+                $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+                $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_date() {
+                $fields = array( 'post' );
+                $result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+                $this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
+                $this->assertEquals( $this->post_date_ts, $result['date_modified']->getTimestamp() );
+
+                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->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->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this->assertEquals( $post_date_gmt, $result['date_created_gmt']->getTimestamp() );
+                $this->assertEquals( $post_modified_gmt, $result['date_modified_gmt']->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>+<?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->make_user_by_role( 'author' );
+                $this->post_date_ts = strtotime( '+1 day' );
+                $this->post_data = array(
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str( 2000 ),
+                        'post_excerpt' => rand_str( 100 ),
+                        'post_author' => $author_id,
+                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+                );
+                $this->post_id = wp_insert_post( $this->post_data );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_no_editable_posts() {
+                wp_delete_post( $this->post_id );
+
+                $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 0, count( $result ) );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post' );
+                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $post = get_post( $result['postid'] );
+
+                        // Check data types
+                        $this->assertInternalType( 'string', $result['userid'] );
+                        $this->assertInternalType( 'string', $result['postid'] );
+                        $this->assertInternalType( 'string', $result['description'] );
+                        $this->assertInternalType( 'string', $result['title'] );
+                        $this->assertInternalType( 'string', $result['link'] );
+                        $this->assertInternalType( 'string', $result['permaLink'] );
+                        $this->assertInternalType( 'array', $result['categories'] );
+                        $this->assertInternalType( 'string', $result['mt_excerpt'] );
+                        $this->assertInternalType( 'string', $result['mt_text_more'] );
+                        $this->assertInternalType( 'string', $result['wp_more_text'] );
+                        $this->assertInternalType( 'int', $result['mt_allow_comments'] );
+                        $this->assertInternalType( 'int', $result['mt_allow_pings'] );
+                        $this->assertInternalType( 'string', $result['mt_keywords'] );
+                        $this->assertInternalType( 'string', $result['wp_slug'] );
+                        $this->assertInternalType( 'string', $result['wp_password'] );
+                        $this->assertInternalType( 'string', $result['wp_author_id'] );
+                        $this->assertInternalType( 'string', $result['wp_author_display_name'] );
+                        $this->assertInternalType( 'string', $result['post_status'] );
+                        $this->assertInternalType( 'array', $result['custom_fields'] );
+                        $this->assertInternalType( 'string', $result['wp_post_format'] );
+
+                        // Check expected values
+                        $this->assertStringMatchesFormat( '%d', $result['userid'] );
+                        $this->assertStringMatchesFormat( '%d', $result['postid'] );
+                        $this->assertEquals( $post->post_title, $result['title'] );
+                        $this->assertEquals( 'draft', $result['post_status'] );
+                        $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+                        $this->assertEquals( $post->post_excerpt, $result['mt_excerpt'] );
+                        $this->assertEquals( url_to_postid( $result['link'] ), $post->ID );
+
+                        $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
+                set_post_thumbnail( $this->post_id, $attachment_id );
+
+                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( $this->post_id, 'author', 'author' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
+                        $this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+
+                        if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this->post_id ) {
+                                $attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
+
+                                $this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+                        }
+                }
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_date() {
+                $this->make_user_by_role( 'editor' );
+
+                $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
+                $this->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->post_date, false ), 'Ymd\TH:i:s' ) );
+                        $date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_modified, false ), 'Ymd\TH:i:s' ) );
+
+                        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                        $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                        $this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+                        $this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+                        $this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
+                        $this->assertEquals( $date_gmt, $result['date_created_gmt']->getTimestamp() );
+                        $this->assertEquals( strtotime( $post->post_date ), $result['date_modified']->getTimestamp() );
+                        $this->assertEquals( $date_modified_gmt, $result['date_modified_gmt']->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_newPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $post = array();
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $post = array();
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_no_content() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array();
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
+        }
+
+        function test_basic_content() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_ignore_id() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test', 'ID' => 103948 );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertNotEquals( '103948', $result );
+        }
+
+        function test_capable_publish() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test', 'post_status' => 'publish' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_publish() {
+                $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'title' => 'Test', 'post_status' => 'publish' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_other_author() {
+                $this->make_user_by_role( 'editor' );
+                $other_author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_other_author() {
+                $this->make_user_by_role( 'contributor' );
+                $other_author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        /**
+         * @ticket 20356
+         */
+        function test_invalid_author() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+        }
+
+        function test_empty_author() {
+                $my_author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this->assertEquals( $my_author_id, $out->post_author );
+                $this->assertEquals( 'Test', $out->post_title );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+                $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_incapable_set_post_type_as_page() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'title' => 'Test', 'post_type' => 'page' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_set_post_type_as_page() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'title' => 'Test', 'post_type' => 'page' );
+                $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this->assertEquals( 'Test', $out->post_title );
+                $this->assertEquals( 'page', $out->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_deletePost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_invalid_post() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+                $post_id = $this->factory->post->create();
+
+                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_post_deleted() {
+                $this->make_user_by_role( 'editor' );
+                $post_id = $this->factory->post->create();
+
+                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue( $result );
+
+                $post = get_post( $post_id );
+                $this->assertEquals( 'trash', $post->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_deleteTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_invalid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+                $this->assertEquals( __('Invalid term ID'), $result->message );
+        }
+
+        function test_term_deleted() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertInternalType( 'boolean', $result );
+        }
+}
</ins></span></pre></div>
<a id="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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_edit_own_post() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' => $new_title );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $new_title, $out->post_title );
+        }
+
+        function test_capable_edit_others_post() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' => $new_title );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $new_title, $out->post_title );
+        }
+
+        function test_incapable_edit_others_post() {
+                $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $original_title = 'Post test';
+                $post = array( 'post_title' => $original_title, 'post_author' => $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $new_title = 'Post test (updated)';
+                $post2 = array( 'post_title' => $new_title );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $original_title, $out->post_title );
+        }
+
+        function test_capable_reassign_author() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_author' => $author_id );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $author_id, $out->post_author );
+        }
+
+        function test_incapable_reassign_author() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+                $post_id = wp_insert_post( $post );
+
+                $post2 = array( 'post_author' => $author_id );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $contributor_id, $out->post_author );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
+                $post_id = wp_insert_post( $post );
+
+                $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $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' => $attachment_id );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // fetch the post to verify that it appears
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertArrayHasKey( 'post_thumbnail', $result );
+                $this->assertInternalType( 'array', $result['post_thumbnail'] );
+                $this->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' => 'Updated post' );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // create another attachment
+                $attachment2 = array_merge( $attachment, array( 'post_title' => 'Post Thumbnail 2' ) );
+                $attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+                // change the post's post_thumbnail
+                $post4 = array( 'post_thumbnail' => $attachment2_id );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // unset the post's post_thumbnail
+                $post5 = array( 'post_thumbnail' => '' );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+                // use invalid ID
+                $post6 = array( 'post_thumbnail' => 398420983409 );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_edit_custom_fields() {
+                $contributor_id = $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Post test', 'post_author' => $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' => $new_title,
+                        'custom_fields' =>
+                                array(
+                                        array( 'id' => $mid_delete ),
+                                        array( 'id' => $mid_edit, 'key' => 'custom_field_key', 'value' => '87654321' ),
+                                        array( 'key' => 'custom_field_to_create', 'value' => '12345678' )
+                                )
+                );
+
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue($result);
+
+                $out = wp_get_single_post( $post_id );
+                $this->assertEquals( $new_title, $out->post_title );
+
+                $edited_object = get_metadata_by_mid( 'post', $mid_edit );
+                $this->assertEquals( '87654321', $edited_object->meta_value );
+                $this->assertFalse( get_metadata_by_mid( 'post', $mid_delete ) );
+
+                $created_object = get_post_meta( $post_id, 'custom_field_to_create', true );
+                $this->assertEquals( $created_object, '12345678' );
+        }
+
+        function test_capable_unsticky() {
+                $editor_id = $this->make_user_by_role( 'editor' );
+
+                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
+                stick_post( $post_id );
+
+                $post2 = array( 'sticky' => false );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->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->make_user_by_role( 'editor' );
+                $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
+                stick_post( $post_id );
+
+                $post2 = array( 'post_password' => 'foobar', 'sticky' => false );
+                $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->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>+<?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->parent_term = wp_insert_term( 'parent' . rand_str() , 'category' );
+                $this->child_term = wp_insert_term( 'child' . rand_str() , 'category' );
+                $this->post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'not_existing' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'category' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to edit terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_term_not_exists() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+                $this->assertEquals( __( 'Invalid term ID' ), $result->message );
+        }
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_empty_term_name() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->parent_term['term_id'], array( 'taxonomy' => 'category', 'name' => '' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
+        }
+
+        function test_parent_for_nonhierarchical() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->post_tag['term_id'], array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term['term_id'] ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( "This taxonomy is not hierarchical so you can't set a parent." ), $result->message );
+        }
+
+        function test_parent_empty() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_parent_invalid() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+        }
+
+        function test_parent_not_existing() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
+        }
+
+        function test_parent_duplicate_slug() {
+                $this->make_user_by_role( 'editor' );
+
+                $parent_term = get_term_by( 'id', $this->parent_term['term_id'], 'category' );
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( htmlspecialchars( sprintf( __('The slug &#8220;%s&#8221; is already in use by another term'), $parent_term->slug ) ), $result->message );
+        }
+
+        function test_edit_all_fields() {
+                $this->make_user_by_role( 'editor' );
+
+                $fields = array( 'taxonomy' => 'category', 'name' => 'Child 2', 'parent' => $this->parent_term['term_id'], 'description' => 'Child term', 'slug' => 'child_2' );
+                $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], $fields ) );
+
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->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>+<?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->post_id = $this->factory->post->create();
+
+                $this->parent_comment_data = array(
+                        'comment_post_ID' => $this->post_id,
+                        'comment_author' => 'Test commenter',
+                        'comment_author_url' => 'http://example.com/',
+                        'comment_author_email' => 'example@example.com',
+                        'comment_content' => rand_str( 100 ),
+                );
+                $this->parent_comment_id = wp_insert_comment( $this->parent_comment_data );
+
+                $this->child_comment_data = array(
+                        'comment_post_ID' => $this->post_id,
+                        'comment_author' => 'Test commenter 2',
+                        'comment_author_url' => 'http://example.org/',
+                        'comment_author_email' => 'example@example.org',
+                        'comment_parent' => $this->parent_comment_id,
+                        'comment_content' => rand_str( 100 )
+                );
+                $this->child_comment_id = wp_insert_comment( $this->child_comment_data );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', $this->parent_comment_id ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'contributor' );
+
+                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', $this->parent_comment_id ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_valid_comment() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->parent_comment_id ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this->assertInternalType( 'string', $result['user_id'] );
+                $this->assertInternalType( 'string', $result['comment_id'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this->assertInternalType( 'string', $result['parent'] );
+                $this->assertInternalType( 'string', $result['status'] );
+                $this->assertInternalType( 'string', $result['content'] );
+                $this->assertInternalType( 'string', $result['link'] );
+                $this->assertInternalType( 'string', $result['post_id'] );
+                $this->assertInternalType( 'string', $result['post_title'] );
+                $this->assertInternalType( 'string', $result['author'] );
+                $this->assertInternalType( 'string', $result['author_url'] );
+                $this->assertInternalType( 'string', $result['author_email'] );
+                $this->assertInternalType( 'string', $result['author_ip'] );
+                $this->assertInternalType( 'string', $result['type'] );
+
+                // Check expected values
+                $this->assertStringMatchesFormat( '%d', $result['user_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['comment_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['parent'] );
+                $this->assertStringMatchesFormat( '%d', $result['post_id'] );
+                $this->assertEquals( $this->parent_comment_id, $result['comment_id'] );
+                $this->assertEquals( 0, $result['parent'] );
+                $this->assertEquals( $this->parent_comment_data['comment_content'], $result['content'] );
+                $this->assertEquals( $this->post_id, $result['post_id'] );
+                $this->assertEquals( $this->parent_comment_data['comment_author'], $result['author'] );
+                $this->assertEquals( $this->parent_comment_data['comment_author_url'], $result['author_url'] );
+                $this->assertEquals( $this->parent_comment_data['comment_author_email'], $result['author_email'] );
+        }
+
+        function test_valid_child_comment() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->child_comment_id ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertEquals( $this->child_comment_id, $result['comment_id'] );
+                $this->assertEquals( $this->parent_comment_id, $result['parent'] );
+        }
+
+        function test_invalid_id() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
+        var $post_id;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->post_id = $this->factory->post->create();
+                $this->factory->comment->create_post_comments( $this->post_id, 15 );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'contributor' );
+
+                $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_user() {
+                $this->make_user_by_role( 'editor' );
+
+                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $comment = get_comment( $result['comment_id'], ARRAY_A );
+                        $this->assertEquals( $comment['comment_post_ID'], $result['post_id'] );
+                }
+        }
+
+        function test_post_filter() {
+                $this->make_user_by_role( 'editor' );
+
+                $filter = array(
+                        'post_id' => $this->post_id
+                );
+                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $this->assertEquals( $this->post_id, $result['post_id'] );
+                }
+        }
+
+        function test_number_filter() {
+                $this->make_user_by_role( 'editor' );
+
+                $filter = array(
+                        'post_id' => $this->post_id,
+                );
+                $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                // if no 'number' filter is specified, default should be 10
+                $this->assertEquals( 10, count( $results ) );
+
+                // explicitly set a 'number' filter and verify that only that many are returned
+                $filter['number'] = 5;
+                $results2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
+                $this->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>+<?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->post_id = wp_insert_post( array(
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str(),
+                        'post_status' => '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->attachment_data = array(
+                        'post_title' => basename( $upload['file'] ),
+                        'post_content' => '',
+                        'post_type' => 'attachment',
+                        'post_parent' => $this->post_id,
+                        'post_mime_type' => $mime['type'],
+                        'guid' => $upload[ 'url' ]
+                );
+
+                $id = wp_insert_attachment( $this->attachment_data, $upload[ 'file' ], $this->post_id );
+                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+                $this->attachment_id = $id;
+
+                set_post_thumbnail( $this->post_id, $this->attachment_id );
+        }
+
+        function tearDown() {
+                remove_theme_support( 'post-thumbnails' );
+
+                parent::tearDown();
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_valid_media_item() {
+                $this->make_user_by_role( 'author' );
+
+                $fields = array( 'post' );
+                $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this->assertInternalType( 'string', $result['attachment_id'] );
+                $this->assertInternalType( 'int', $result['parent'] );
+                $this->assertInternalType( 'string', $result['title'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+                $this->assertInternalType( 'string', $result['caption'] );
+                $this->assertInternalType( 'string', $result['description'] );
+                $this->assertInternalType( 'string', $result['link'] );
+                $this->assertInternalType( 'string', $result['thumbnail'] );
+                $this->assertInternalType( 'array', $result['metadata'] );
+
+                // Check expected values
+                $this->assertStringMatchesFormat( '%d', $result['attachment_id'] );
+                $this->assertEquals( $this->attachment_data['post_title'], $result['title'] );
+                $this->assertEquals( wp_get_attachment_url( $this->attachment_id ), $result['link'] );
+                $this->assertEquals( wp_get_attachment_thumb_url( $this->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getOptions extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_valid_username_password() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+                $this->assertInternalType( 'array', $result );
+                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
+        }
+
+        function test_option_value() {
+                $this->make_user_by_role( 'administrator' );
+
+                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
+                $this->assertInternalType( 'array', $result );
+
+                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this->assertFalse( $result['default_comment_status']['readonly'] );
+        }
+
+        /**
+         * @ticket 20201
+         */
+        function test_option_values_subscriber() {
+                global $wp_version;
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+                $this->assertInternalType( 'array', $result );
+
+                // Read Only options
+                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
+                $this->assertTrue( $result['software_name']['readonly'] );
+
+                $this->assertEquals( $wp_version, $result['software_version']['value'] );
+                $this->assertTrue( $result['software_version']['readonly'] );
+
+                /* TODO: Gives junk data in Test Environment
+                $this->assertEquals( get_site_url(), $result['site-url']['value'] );
+                $this->assertTrue( $result['site-url']['readonly'] );
+                */
+
+                $this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+                $this->assertTrue( $result['image_default_link_type']['readonly'] );
+
+                $this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+                $this->assertTrue( $result['image_default_size']['readonly'] );
+
+                $this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+                $this->assertTrue( $result['image_default_align']['readonly'] );
+
+                $this->assertEquals( get_template(), $result['template']['value'] );
+                $this->assertTrue( $result['template']['readonly'] );
+
+                $this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+                $this->assertTrue( $result['stylesheet']['readonly'] );
+
+                $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+                $this->assertTrue( $result['post_thumbnail']['readonly'] );
+
+                // Updatable options
+                $this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+                $this->assertTrue( $result['time_zone']['readonly'] );
+
+                $this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+                $this->assertTrue( $result['blog_title']['readonly'] );
+
+                $this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+                $this->assertTrue( $result['blog_tagline']['readonly'] );
+
+                $this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+                $this->assertTrue( $result['date_format']['readonly'] );
+
+                $this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+                $this->assertTrue( $result['time_format']['readonly'] );
+
+                $this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+                $this->assertTrue( $result['users_can_register']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+                $this->assertTrue( $result['thumbnail_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+                $this->assertTrue( $result['thumbnail_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+                $this->assertTrue( $result['thumbnail_crop']['readonly'] );
+
+                $this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+                $this->assertTrue( $result['medium_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+                $this->assertTrue( $result['medium_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+                $this->assertTrue( $result['large_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+                $this->assertTrue( $result['large_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this->assertTrue( $result['default_comment_status']['readonly'] );
+
+                $this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+                $this->assertTrue( $result['default_ping_status']['readonly'] );
+        }
+
+        function test_option_values_admin() {
+                global $wp_version;
+
+                $this->make_user_by_role( 'administrator' );
+
+                $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator' ) );
+                $this->assertInternalType( 'array', $result );
+
+                // Read Only options
+                $this->assertEquals( 'WordPress', $result['software_name']['value'] );
+                $this->assertTrue( $result['software_name']['readonly'] );
+
+                $this->assertEquals( $wp_version, $result['software_version']['value'] );
+                $this->assertTrue( $result['software_version']['readonly'] );
+
+                /* TODO: Gives junk data in Test Environment
+                $this->assertEquals( get_site_url(), $result['site-url']['value'] );
+                $this->assertTrue( $result['site-url']['readonly'] );
+                */
+
+                $this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+                $this->assertTrue( $result['image_default_link_type']['readonly'] );
+
+                $this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+                $this->assertTrue( $result['image_default_size']['readonly'] );
+
+                $this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+                $this->assertTrue( $result['image_default_align']['readonly'] );
+
+                $this->assertEquals( get_template(), $result['template']['value'] );
+                $this->assertTrue( $result['template']['readonly'] );
+
+                $this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+                $this->assertTrue( $result['stylesheet']['readonly'] );
+
+                $this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+                $this->assertTrue( $result['post_thumbnail']['readonly'] );
+
+                // Updatable options
+                $this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+                $this->assertFalse( $result['time_zone']['readonly'] );
+
+                $this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+                $this->assertFalse( $result['blog_title']['readonly'] );
+
+                $this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+                $this->assertFalse( $result['blog_tagline']['readonly'] );
+
+                $this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+                $this->assertFalse( $result['date_format']['readonly'] );
+
+                $this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+                $this->assertFalse( $result['time_format']['readonly'] );
+
+                $this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+                $this->assertFalse( $result['users_can_register']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+                $this->assertFalse( $result['thumbnail_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+                $this->assertFalse( $result['thumbnail_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+                $this->assertFalse( $result['thumbnail_crop']['readonly'] );
+
+                $this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+                $this->assertFalse( $result['medium_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+                $this->assertFalse( $result['medium_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+                $this->assertFalse( $result['large_size_w']['readonly'] );
+
+                $this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+                $this->assertFalse( $result['large_size_h']['readonly'] );
+
+                $this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+                $this->assertFalse( $result['default_comment_status']['readonly'] );
+
+                $this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+                $this->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>+<?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->post_date_ts = strtotime( '+1 day' );
+                $this->post_data = array(
+                        'post_type' => 'page',
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str( 2000 ),
+                        'post_excerpt' => rand_str( 100 ),
+                        'post_author' => $this->make_user_by_role( 'author' ),
+                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+                );
+                $this->post_id = wp_insert_post( $this->post_data );
+        }
+
+        function tearDown() {
+                parent::tearDown();
+
+                wp_delete_post( $this->post_id );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        /**
+         * @ticket 20336
+         */
+        function test_invalid_pageid() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+        }
+
+        function test_valid_page() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this->assertInternalType( 'string', $result['userid'] );
+                $this->assertInternalType( 'int', $result['page_id'] );
+                $this->assertInternalType( 'string', $result['page_status'] );
+                $this->assertInternalType( 'string', $result['description'] );
+                $this->assertInternalType( 'string', $result['title'] );
+                $this->assertInternalType( 'string', $result['link'] );
+                $this->assertInternalType( 'string', $result['permaLink'] );
+                $this->assertInternalType( 'array', $result['categories'] );
+                $this->assertInternalType( 'string', $result['excerpt'] );
+                $this->assertInternalType( 'string', $result['text_more'] );
+                $this->assertInternalType( 'int', $result['mt_allow_comments'] );
+                $this->assertInternalType( 'int', $result['mt_allow_pings'] );
+                $this->assertInternalType( 'string', $result['wp_slug'] );
+                $this->assertInternalType( 'string', $result['wp_password'] );
+                $this->assertInternalType( 'string', $result['wp_author'] );
+                $this->assertInternalType( 'int', $result['wp_page_parent_id'] );
+                $this->assertInternalType( 'string', $result['wp_page_parent_title'] );
+                $this->assertInternalType( 'int', $result['wp_page_order'] );
+                $this->assertInternalType( 'string', $result['wp_author_id'] );
+                $this->assertInternalType( 'string', $result['wp_author_display_name'] );
+                $this->assertInternalType( 'array', $result['custom_fields'] );
+                $this->assertInternalType( 'string', $result['wp_page_template'] );
+
+                // Check expected values
+                $this->assertStringMatchesFormat( '%d', $result['userid'] );
+                $this->assertEquals( 'draft', $result['page_status'] );
+                $this->assertEquals( $this->post_data['post_title'], $result['title'] );
+                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+                $this->assertEquals( $this->post_data['post_excerpt'], $result['excerpt'] );
+                $this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+        }
+
+        function test_date() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+                $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
+                $this->assertEquals( $date_gmt, $result['date_created_gmt']->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>+<?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->post_date_ts = strtotime( '+1 day' );
+                $this->post_data = array(
+                        'post_type' => 'page',
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str( 2000 ),
+                        'post_excerpt' => rand_str( 100 ),
+                        'post_author' => $this->make_user_by_role( 'author' ),
+                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+                );
+                $this->post_id = wp_insert_post( $this->post_data );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'contributor' );
+
+                $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_date() {
+                $this->make_user_by_role( 'editor' );
+
+                $results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $result ) {
+                        $page = get_post( $result->page_id );
+                        $date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date, false ), 'Ymd\TH:i:s' ) );
+
+                        $this->assertInstanceOf( 'IXR_Date', $result->dateCreated );
+                        $this->assertInstanceOf( 'IXR_Date', $result->date_created_gmt );
+
+                        $this->assertEquals( strtotime( $page->post_date ), $result->dateCreated->getTimestamp() );
+                        $this->assertEquals( $date_gmt, $result->date_created_gmt->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>+<?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->post_date_ts = strtotime( '+1 day' );
+ $this->post_data = array(
+ 'post_type' => 'page',
+ 'post_title' => rand_str(),
+ 'post_content' => rand_str( 2000 ),
+ 'post_excerpt' => rand_str( 100 ),
+ 'post_author' => $this->make_user_by_role( 'administrator' ),
+ 'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+ );
+ $this->post_id = wp_insert_post( $this->post_data );
+ $this->editor_id = $this->make_user_by_role( 'editor' );
+ }
+
+ function test_invalid_username_password() {
+ $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) );
+ $this->assertInstanceOf( 'IXR_Error', $result );
+ $this->assertEquals( 403, $result->code );
+ }
+
+ function test_incapable_user() {
+                $this->make_user_by_role( 'contributor' );
+
+ $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) );
+ $this->assertInstanceOf( 'IXR_Error', $result );
+ $this->assertEquals( 401, $result->code );
+ }
+
+ function test_capable_user() {
+ $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) );
+ $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+ foreach( $results as $result ) {
+ $page = get_post( $result['page_id'] );
+ $this->assertEquals( $page->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->editor_id && $args[0] == $this->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->myxmlrpcserver->wp_getPages( array( 1, 'editor', 'editor' ) );
+ $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+ $found_incapable = false;
+ foreach( $results as $result ) {
+ // WP#20629
+ $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+ if ( $result['page_id'] == $this->post_id ) {
+ $found_incapable = true;
+ break;
+ }
+ }
+ $this->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>+<?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->post_date_ts = strtotime( '+1 day' );
+                $this->post_data = array(
+                        'post_title' => rand_str(),
+                        'post_content' => rand_str( 2000 ),
+                        'post_excerpt' => rand_str( 100 ),
+                        'post_author' => $this->make_user_by_role( 'author' ),
+                        'post_date' => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+                );
+                $this->post_id = wp_insert_post( $this->post_data );
+                $this->post_custom_field = array( 'key' => 'test_custom_field', 'value' => 12345678);
+                $this->post_custom_field['id'] = add_post_meta( $this->post_id, $this->post_custom_field['key'], $this->post_custom_field['value'] );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_valid_post() {
+                add_theme_support( 'post-thumbnails' );
+
+                $fields = array( 'post', 'custom_fields' );
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // Check data types
+                $this->assertInternalType( 'string', $result['post_id'] );
+                $this->assertInternalType( 'string', $result['post_title'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+                $this->assertInternalType( 'string', $result['post_status'] );
+                $this->assertInternalType( 'string', $result['post_type'] );
+                $this->assertInternalType( 'string', $result['post_name'] );
+                $this->assertInternalType( 'string', $result['post_author'] );
+                $this->assertInternalType( 'string', $result['post_password'] );
+                $this->assertInternalType( 'string', $result['post_excerpt'] );
+                $this->assertInternalType( 'string', $result['post_content'] );
+                $this->assertInternalType( 'string', $result['link'] );
+                $this->assertInternalType( 'string', $result['comment_status'] );
+                $this->assertInternalType( 'string', $result['ping_status'] );
+                $this->assertInternalType( 'bool', $result['sticky'] );
+                $this->assertInternalType( 'string', $result['post_format'] );
+                $this->assertInternalType( 'array', $result['post_thumbnail'] );
+                $this->assertInternalType( 'array', $result['custom_fields'] );
+
+                // Check expected values
+                $this->assertStringMatchesFormat( '%d', $result['post_id'] );
+                $this->assertEquals( $this->post_data['post_title'], $result['post_title'] );
+                $this->assertEquals( 'draft', $result['post_status'] );
+                $this->assertEquals( 'post', $result['post_type'] );
+                $this->assertStringMatchesFormat( '%d', $result['post_author'] );
+                $this->assertEquals( $this->post_data['post_excerpt'], $result['post_excerpt'] );
+                $this->assertEquals( $this->post_data['post_content'], $result['post_content'] );
+                $this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+                $this->assertEquals( $this->post_custom_field['id'], $result['custom_fields'][0]['id'] );
+                $this->assertEquals( $this->post_custom_field['key'], $result['custom_fields'][0]['key'] );
+                $this->assertEquals( $this->post_custom_field['value'], $result['custom_fields'][0]['value'] );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_no_fields() {
+                $fields = array();
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // when no fields are requested, only the IDs should be returned
+                $this->assertEquals( 1, count( $result ) );
+                $this->assertEquals( array( 'post_id' ), array_keys( $result ) );
+        }
+
+        function test_default_fields() {
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertArrayHasKey( 'post_id', $result );
+                $this->assertArrayHasKey( 'link', $result ); // random field from 'posts' group
+                $this->assertArrayHasKey( 'terms', $result );
+                $this->assertArrayHasKey( 'custom_fields', $result );
+        }
+
+        function test_date() {
+                $fields = array( 'post' );
+                $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+                $this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+
+                $this->assertEquals( $this->post_date_ts, $result['post_date']->getTimestamp() );
+                $this->assertEquals( $this->post_date_ts, $result['post_modified']->getTimestamp() );
+
+                $post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->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->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+                $this->assertEquals( $post_date_gmt, $result['post_date_gmt']->getTimestamp() );
+                $this->assertEquals( $post_modified_gmt, $result['post_modified_gmt']->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostType extends WP_XMLRPC_UnitTestCase {
+        var $cpt_name;
+        var $cpt_args;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->cpt_name = 'post_type_test';
+                $this->cpt_args = array(
+                        'public' => false,
+                        'show_ui' => true,
+                        'show_in_menu' => true,
+                        'menu_position' => 7,
+                        'menu_icon' => 'cpt_icon.png',
+                        'taxonomies' => array( 'category', 'post_tag' ),
+                        'hierarchical' => true
+                );
+                register_post_type( $this->cpt_name, $this->cpt_args );
+        }
+
+        function tearDown() {
+                _unregister_post_type( $this->cpt_name );
+
+                parent::tearDown();
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'username', 'password', 'post' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_invalid_post_type_name() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_valid_post_type_name() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_valid_type() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // check data types
+                $this->assertInternalType( 'string', $result['name'] );
+                $this->assertInternalType( 'string', $result['label'] );
+                $this->assertInternalType( 'bool', $result['hierarchical'] );
+                $this->assertInternalType( 'bool', $result['public'] );
+                $this->assertInternalType( 'bool', $result['_builtin'] );
+                $this->assertInternalType( 'bool', $result['map_meta_cap'] );
+                $this->assertInternalType( 'bool', $result['has_archive'] );
+                $this->assertInternalType( 'bool', $result['show_ui'] );
+                $this->assertInternalType( 'int', $result['menu_position'] );
+                $this->assertInternalType( 'string', $result['menu_icon'] );
+                $this->assertInternalType( 'array', $result['labels'] );
+                $this->assertInternalType( 'array', $result['cap'] );
+                $this->assertInternalType( 'array', $result['taxonomies'] );
+                $this->assertInternalType( 'array', $result['supports'] );
+
+                // check label data types
+                $this->assertInternalType( 'string', $result['labels']['name'] );
+                $this->assertInternalType( 'string', $result['labels']['singular_name'] );
+                $this->assertInternalType( 'string', $result['labels']['add_new'] );
+                $this->assertInternalType( 'string', $result['labels']['add_new_item'] );
+                $this->assertInternalType( 'string', $result['labels']['edit_item'] );
+                $this->assertInternalType( 'string', $result['labels']['new_item'] );
+                $this->assertInternalType( 'string', $result['labels']['view_item'] );
+                $this->assertInternalType( 'string', $result['labels']['search_items'] );
+                $this->assertInternalType( 'string', $result['labels']['not_found'] );
+                $this->assertInternalType( 'string', $result['labels']['not_found_in_trash'] );
+                $this->assertInternalType( 'string', $result['labels']['parent_item_colon'] );
+                $this->assertInternalType( 'string', $result['labels']['all_items'] );
+                $this->assertInternalType( 'string', $result['labels']['menu_name'] );
+                $this->assertInternalType( 'string', $result['labels']['name_admin_bar'] );
+
+                // check cap data types
+                $this->assertInternalType( 'string', $result['cap']['edit_post'] );
+                $this->assertInternalType( 'string', $result['cap']['read_post'] );
+                $this->assertInternalType( 'string', $result['cap']['delete_post'] );
+                $this->assertInternalType( 'string', $result['cap']['edit_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['edit_others_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['publish_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['read_private_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['read'] );
+                $this->assertInternalType( 'string', $result['cap']['delete_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['delete_private_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['delete_published_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['delete_others_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['edit_private_posts'] );
+                $this->assertInternalType( 'string', $result['cap']['edit_published_posts'] );
+
+                // check taxonomy data types
+                foreach ( $result['taxonomies'] as $taxonomy ) {
+                        $this->assertInternalType( 'string', $taxonomy );
+                }
+
+                // check taxonomy data types
+                foreach ( $result['supports'] as $key => $value ) {
+                        $this->assertInternalType( 'string', $key );
+                        $this->assertInternalType( 'bool', $value );
+                }
+
+                // Check expected values
+                $this->assertEquals( $this->cpt_name, $result['name'] );
+                foreach ( $this->cpt_args as $key => $value ) {
+                        $this->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertInternalType( 'array', $result );
+                $this->assertEquals( 0, count( $result ) );
+        }
+
+        function test_capable_user() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertInternalType( 'array', $result );
+                $this->assertGreaterThan( 0, count( $result ) );
+        }
+
+        function test_simple_filter() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertInternalType( 'array', $result );
+
+                // verify that pages is in the result, and post is not
+                $result_names = wp_list_pluck( $result, 'name' );
+                $this->assertContains( 'page', $result_names );
+                $this->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        /**
+         * @ticket 20991
+         */
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $filter = array( 'post_type' => 'page' );
+                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_user() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_invalid_post_type() {
+                $this->make_user_by_role( 'editor' );
+
+                $filter = array( 'post_type' => 'invalid_post_type_name' );
+                $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_filters() {
+                $this->make_user_by_role( 'editor' );
+
+                $cpt_name = 'test_wp_getposts_cpt';
+                register_post_type( $cpt_name, array(
+                        'taxonomies' => array( 'post_tag', 'category' ),
+                        'public' => true
+                ));
+
+                $num_posts = 17;
+                $post_ids = $this->factory->post->create_many( $num_posts, array( 'post_type' => $cpt_name ) );
+
+                // get them all
+                $filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 );
+                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertEquals( $num_posts, count( $results ) );
+
+                // page through results
+                $posts_found = array();
+                $filter['number'] = 5;
+                $filter['offset'] = 0;
+                do {
+                        $presults = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+                        foreach( $presults as $post ) {
+                                $posts_found[] = $post['post_id'];
+                        }
+                        $filter['offset'] += $filter['number'];
+                } while ( count( $presults ) > 0 );
+                // verify that $post_ids matches $posts_found
+                $this->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->factory->comment->create_post_comments( $post, rand( 1, 20 ) );
+                }
+
+                // get results ordered by comment count
+                $filter2 = array( 'post_type' => $cpt_name, 'number' => $num_posts, 'orderby' => 'comment_count', 'order' => 'DESC' );
+                $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
+                $last_comment_count = 100;
+                foreach ( $results2 as $post ) {
+                        $comment_count = intval( get_comments_number( $post['post_id'] ) );
+                        $this->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->post_status = 'draft';
+                wp_update_post( $post );
+                $filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );
+                $results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
+                $this->assertEquals( 1, count( $results3 ) );
+                $this->assertEquals( $post->ID, $results3[0]['post_id'] );
+
+                _unregister_post_type( $cpt_name );
+        }
+
+        function test_fields() {
+                $this->make_user_by_role( 'editor' );
+                $this->factory->post->create();
+
+                // check default fields
+                $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
+                $this->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->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->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
+                $expected_fields = array_merge( $fields, array( 'post_id' ) );
+                foreach ( array_keys( $results2[0] ) as $field ) {
+                        $this->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTaxonomies extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_taxonomy_validated() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+}
</ins><span class="cx">\ 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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_taxonomy_validated() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_prepare_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+                $taxonomy = get_taxonomy( 'category' );
+                $this->assertEquals( 'category', $result['name'], 'name' );
+                $this->assertEquals( true, $result['_builtin'], '_builtin' );
+                $this->assertEquals( $taxonomy->show_ui, $result['show_ui'], 'show_ui' );
+                $this->assertEquals( $taxonomy->public, $result['public'], 'public' );
+                $this->assertEquals( $taxonomy->hierarchical, $result['hierarchical'], 'hierarchical' );
+                $this->assertEquals( (array) $taxonomy->labels, $result['labels'], 'labels' );
+                $this->assertEquals( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
+                $this->assertEquals( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
+        }
+}
</ins><span class="cx">\ 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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTerm extends WP_XMLRPC_UnitTestCase {
+        var $term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( __('Empty Term'), $result->message );
+        }
+
+        function test_invalid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+                $this->assertEquals( __('Invalid term ID'), $result->message );
+        }
+
+        function test_valid_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $term = get_term( $this->term['term_id'], 'category', ARRAY_A );
+
+                $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $result, $term );
+
+                // Check DataTypes
+                $this->assertInternalType( 'string', $result['name'] );
+                $this->assertInternalType( 'string', $result['slug'] );
+                $this->assertInternalType( 'string', $result['taxonomy'] );
+                $this->assertInternalType( 'string', $result['description'] );
+                $this->assertInternalType( 'int', $result['count'] );
+
+                // We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+                $this->assertStringMatchesFormat( '%d', $result['term_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['term_group'] );
+                $this->assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
+                $this->assertStringMatchesFormat( '%d', $result['parent'] );
+
+                // Check Data
+                $this->assertEquals( 0, $result['count'] );
+                $this->assertEquals( $term['name'], $result['name'] );
+                $this->assertEquals( $term['slug'], $result['slug'] );
+                $this->assertEquals( 'category', $result['taxonomy'] );
+                $this->assertEquals( $term['description'], $result['description'] );
+        }
+}
</ins></span></pre></div>
<a id="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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTerms extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_valid_terms() {
+                $this->make_user_by_role( 'editor' );
+
+                // make sure there's at least one category
+                $cat = wp_insert_term( 'term' . rand_str() , 'category' );
+
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                foreach( $results as $term ) {
+                        $this->assertInternalType( 'int', $term['count'] );
+
+                        // We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+                        $this->assertStringMatchesFormat( '%d', $term['term_id'] );
+                        $this->assertStringMatchesFormat( '%d', $term['term_group'] );
+                        $this->assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
+                        $this->assertStringMatchesFormat( '%d', $term['parent'] );
+                }
+        }
+
+        function test_custom_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                // create a taxonomy and some terms for it
+                $tax_name = 'wp_getTerms_custom_taxonomy';
+                $num_terms = 12;
+                register_taxonomy( $tax_name, 'post' );
+                for( $i = 0; $i < $num_terms; $i++ )
+                        wp_insert_term( rand_str( 10 ), $tax_name );
+
+
+                // test fetching all terms
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+                $this->assertEquals( $num_terms, count( $results ) );
+                foreach ( $results as $term ) {
+                        $this->assertEquals( $tax_name, $term['taxonomy'] );
+                }
+
+                // test paged results
+                $filter = array( 'number' => 5 );
+                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertEquals( 5, count( $results2 ) );
+                $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
+
+                $filter['offset'] = 10;
+                $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results3 );
+                $this->assertEquals( $num_terms - 10, count( $results3 ) );
+                $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
+
+                // test hide_empty (since none have been attached to posts yet, all should be hidden
+                $filter = array( 'hide_empty' => true );
+                $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results4 );
+                $this->assertEquals( 0, count( $results4 ) );
+
+                unset($GLOBALS['wp_taxonomies'][$tax_name]);
+        }
+
+        function test_term_ordering() {
+                $this->make_user_by_role( 'editor' );
+
+                $cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+
+                $this->factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
+                $this->factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
+
+                $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertNotEquals( 0, count( $results ) );
+
+                foreach( $results as $term ) {
+                        if ( $term['term_id'] == $cat1 ) {
+                                break; // found cat1 first as expected
+                        }
+                        else if ( $term['term_id'] == $cat2 ) {
+                                $this->assertFalse( false, 'Incorrect category ordering.' );
+                        }
+                }
+        }
+
+        function test_terms_search() {
+                $this->make_user_by_role( 'editor' );
+
+                $name = rand_str( 30 );
+                $name_id = wp_create_category( $name );
+
+                // search by full name
+                $filter = array( 'search' => $name );
+                $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results );
+                $this->assertEquals( 1, count( $results ) );
+                $this->assertEquals( $name, $results[0]['name'] );
+                $this->assertEquals( $name_id, $results[0]['term_id'] );
+
+                // search by partial name
+                $filter = array( 'search' => substr( $name, 0, 10 ) );
+                $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $results2 );
+                $this->assertEquals( 1, count( $results2 ) );
+                $this->assertEquals( $name, $results2[0]['name'] );
+                $this->assertEquals( $name_id, $results2[0]['term_id'] );
+        }
+}
</ins></span></pre></div>
<a id="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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase {
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_no_content() {
+                $this->make_user_by_role( 'author' );
+
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+                $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
+        }
+
+        function test_basic_content() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Test' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_ignore_id() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Test', 'ID' => 103948 );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertNotEquals( '103948', $result );
+        }
+
+        function test_capable_publish() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_publish() {
+                $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_private() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_private() {
+                $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_other_author() {
+                $other_author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+        }
+
+        function test_incapable_other_author() {
+                $other_author_id = $this->make_user_by_role( 'author' );
+                $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_invalid_author() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_author' => 99999999 );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 404, $result->code );
+        }
+
+        function test_empty_author() {
+                $my_author_id = $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Test' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+
+                $out = wp_get_single_post( $result );
+                $this->assertEquals( $my_author_id, $out->post_author );
+                $this->assertEquals( 'Test', $out->post_title );
+        }
+
+        function test_post_thumbnail() {
+                add_theme_support( 'post-thumbnails' );
+
+                $this->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->assertTrue( empty( $upload['error'] ) );
+
+                $attachment = array(
+                        'post_title' => 'Post Thumbnail',
+                        'post_type' => 'attachment',
+                        'post_mime_type' => 'image/jpeg',
+                        'guid' => $upload['url']
+                );
+                $attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+                remove_theme_support( 'post-thumbnails' );
+        }
+
+        function test_invalid_post_status() {
+                $this->make_user_by_role( 'author' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 'draft', get_post_status( $result ) );
+        }
+
+        function test_incapable_sticky() {
+                $this->make_user_by_role( 'contributor' );
+
+                $post = array( 'post_title' => 'Test', 'sticky' => true );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_capable_sticky() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'sticky' => true );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertTrue( is_sticky( $result ) );
+        }
+
+        function test_private_sticky() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+        }
+
+        function test_post_format() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_format' => 'quote' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 'quote', get_post_format( $result ) );
+        }
+
+        function test_invalid_post_format() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( '', get_post_format( $result ) );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array(
+                        'post_title' => 'Test',
+                        'terms' => array(
+                                'foobar_nonexistant' => array( 1 )
+                        )
+                );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+
+                $post2 = array(
+                        'post_title' => 'Test',
+                        'terms_names' => array(
+                                'foobar_nonexistant' => array( 1 )
+                        )
+                );
+                $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result2 );
+                $this->assertEquals( 401, $result2->code );
+        }
+
+        function test_invalid_term_id() {
+                $this->make_user_by_role( 'editor' );
+
+                $post = array(
+                        'post_title' => 'Test',
+                        'terms' => array(
+                                'post_tag' => array( 1390490823409 )
+                        )
+                );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_terms() {
+                $this->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' => 'Test',
+                        'terms' => array(
+                                'post_tag' => array( $tag2['term_id'], $tag3['term_id'] )
+                        )
+                );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' => 'ids' ) );
+                $this->assertNotContains( $tag1['term_id'], $post_tags );
+                $this->assertContains( $tag2['term_id'], $post_tags );
+                $this->assertContains( $tag3['term_id'], $post_tags );
+        }
+
+        function test_terms_names() {
+                $this->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' => 'Test',
+                        'terms_names' => array(
+                                'category' => array( $cat1_name, $cat2_name )
+                        )
+                );
+                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                // verify that cat2 was created
+                $cat2 = get_term_by( 'name', $cat2_name, 'category' );
+                $this->assertNotEmpty( $cat2 );
+                // check that both categories were set on the post
+                $post_cats = wp_get_object_terms( $result, 'category', array( 'fields' => 'ids' ) );
+                $this->assertContains( $cat1, $post_cats );
+                $this->assertContains( $cat2->term_id, $post_cats );
+
+                // create a second post attempting to use the ambiguous name
+                $post2 = array(
+                        'post_title' => 'Test',
+                        'terms_names' => array(
+                                'category' => array( $cat1_name, $ambiguous_name )
+                        )
+                );
+                $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+                $this->assertInstanceOf( 'IXR_Error', $result2 );
+                $this->assertEquals( 401, $result2->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newTerm extends WP_XMLRPC_UnitTestCase {
+        var $parent_term;
+
+        function setUp() {
+                parent::setUp();
+
+                $this->parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
+                $this->parent_term = $this->parent_term['term_id'];
+        }
+
+        function test_invalid_username_password() {
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+        }
+
+        function test_empty_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_invalid_taxonomy() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+        }
+
+        function test_incapable_user() {
+                $this->make_user_by_role( 'subscriber' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 401, $result->code );
+                $this->assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result->message );
+        }
+
+        function test_empty_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
+        }
+
+        function test_parent_for_nonhierarchical() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message );
+        }
+
+        function test_parent_invalid() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 500, $result->code );
+        }
+
+        function test_parent_not_existing() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
+                $this->assertInstanceOf( 'IXR_Error', $result );
+                $this->assertEquals( 403, $result->code );
+                $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
+        }
+
+
+        function test_add_term() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_add_term_with_parent() {
+                $this->make_user_by_role( 'editor' );
+
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->assertStringMatchesFormat( '%d', $result );
+        }
+
+        function test_add_term_with_all() {
+                $this->make_user_by_role( 'editor' );
+
+                $taxonomy = array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
+                $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+                $this->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>+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
+        function test_valid_attachment() {
+                $this->make_user_by_role( 'editor' );
+
+                // create attachment
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents( $filename );
+                $data = array(
+                        'name' => 'a2-small.jpg',
+                        'type' => 'image/jpeg',
+                        'bits' => base64_encode( $contents )
+                );
+
+
+                $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
+                $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+                // check data types
+                $this->assertInternalType( 'string', $result['id'] );
+                $this->assertStringMatchesFormat( '%d', $result['id'] );
+                $this->assertInternalType( 'string', $result['file'] );
+                $this->assertInternalType( 'string', $result['url'] );
+                $this->assertInternalType( 'string', $result['type'] );
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>