<!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][909] trunk/tests: Complete the renaming described in [904].</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/909">909</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-07-19 01:52:37 +0000 (Thu, 19 Jul 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Complete the renaming described in <a href="http://unit-tests.trac.wordpress.org/changeset/904">[904]</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsactionsphp">trunk/tests/actions.php</a></li>
<li><a href="#trunktestsadminincludesMiscphp">trunk/tests/admin/includesMisc.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="#trunktestsajaxEditCommentphp">trunk/tests/ajax/EditComment.php</a></li>
<li><a href="#trunktestscachephp">trunk/tests/cache.php</a></li>
<li><a href="#trunktestsdbphp">trunk/tests/db.php</a></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="#trunktestsfilephp">trunk/tests/file.php</a></li>
<li><a href="#trunktestsfiltersphp">trunk/tests/filters.php</a></li>
<li><a href="#trunktestsuserphp">trunk/tests/user.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsauthphp">trunk/tests/auth.php</a></li>
<li><a href="#trunktestsformattingAutopphp">trunk/tests/formatting/Autop.php</a></li>
<li><a href="#trunktestsformattingCleanPrephp">trunk/tests/formatting/CleanPre.php</a></li>
<li><a href="#trunktestsformattingConvertCharsphp">trunk/tests/formatting/ConvertChars.php</a></li>
<li><a href="#trunktestsformattingEscAttrphp">trunk/tests/formatting/EscAttr.php</a></li>
<li><a href="#trunktestsformattingEscHtmlphp">trunk/tests/formatting/EscHtml.php</a></li>
<li><a href="#trunktestsformattingEscUrlphp">trunk/tests/formatting/EscUrl.php</a></li>
<li><a href="#trunktestsformattingHtmlExcerptphp">trunk/tests/formatting/HtmlExcerpt.php</a></li>
<li><a href="#trunktestsformattingIsEmailphp">trunk/tests/formatting/IsEmail.php</a></li>
<li><a href="#trunktestsformattingJSEscapephp">trunk/tests/formatting/JSEscape.php</a></li>
<li><a href="#trunktestsformattingLikeEscapephp">trunk/tests/formatting/LikeEscape.php</a></li>
<li><a href="#trunktestsformattingMakeClickablephp">trunk/tests/formatting/MakeClickable.php</a></li>
<li><a href="#trunktestsformattingRemoveAccentsphp">trunk/tests/formatting/RemoveAccents.php</a></li>
<li><a href="#trunktestsformattingSanitizeFileNamephp">trunk/tests/formatting/SanitizeFileName.php</a></li>
<li><a href="#trunktestsformattingSanitizeMimeTypephp">trunk/tests/formatting/SanitizeMimeType.php</a></li>
<li><a href="#trunktestsformattingSanitizeOrderbyphp">trunk/tests/formatting/SanitizeOrderby.php</a></li>
<li><a href="#trunktestsformattingSanitizeTextFieldphp">trunk/tests/formatting/SanitizeTextField.php</a></li>
<li><a href="#trunktestsformattingSanitizeTitlephp">trunk/tests/formatting/SanitizeTitle.php</a></li>
<li><a href="#trunktestsformattingSanitizeTitleWithDashesphp">trunk/tests/formatting/SanitizeTitleWithDashes.php</a></li>
<li><a href="#trunktestsformattingSanitizeUserphp">trunk/tests/formatting/SanitizeUser.php</a></li>
<li><a href="#trunktestsformattingSlashitphp">trunk/tests/formatting/Slashit.php</a></li>
<li><a href="#trunktestsformattingSmiliesphp">trunk/tests/formatting/Smilies.php</a></li>
<li><a href="#trunktestsformattingStripSlashesDeepphp">trunk/tests/formatting/StripSlashesDeep.php</a></li>
<li><a href="#trunktestsformattingWPSpecialcharsphp">trunk/tests/formatting/WPSpecialchars.php</a></li>
<li><a href="#trunktestsformattingWPTexturizephp">trunk/tests/formatting/WPTexturize.php</a></li>
<li><a href="#trunktestsformattingWPTrimWordsphp">trunk/tests/formatting/WPTrimWords.php</a></li>
<li><a href="#trunktestsformattingZeroisephp">trunk/tests/formatting/Zeroise.php</a></li>
<li><a href="#trunktestsformattingredirectphp">trunk/tests/formatting/redirect.php</a></li>
<li>trunk/tests/functions/</li>
<li><a href="#trunktestsfunctionslistFilterphp">trunk/tests/functions/listFilter.php</a></li>
<li><a href="#trunktestsfunctionsphp">trunk/tests/functions.php</a></li>
<li><a href="#trunktestshttpfunctionsphp">trunk/tests/http/functions.php</a></li>
<li>trunk/tests/image/</li>
<li><a href="#trunktestsimagedimensionsphp">trunk/tests/image/dimensions.php</a></li>
<li><a href="#trunktestsimagefunctionsphp">trunk/tests/image/functions.php</a></li>
<li><a href="#trunktestsimagemetaphp">trunk/tests/image/meta.php</a></li>
<li><a href="#trunktestsimageresizephp">trunk/tests/image/resize.php</a></li>
<li><a href="#trunktestsimagesizephp">trunk/tests/image/size.php</a></li>
<li>trunk/tests/import/</li>
<li><a href="#trunktestsimportbasephp">trunk/tests/import/base.php</a></li>
<li><a href="#trunktestsimportimportphp">trunk/tests/import/import.php</a></li>
<li><a href="#trunktestsimportparserphp">trunk/tests/import/parser.php</a></li>
<li><a href="#trunktestsimportpostmetaphp">trunk/tests/import/postmeta.php</a></li>
<li><a href="#trunktestsmailphp">trunk/tests/mail.php</a></li>
<li><a href="#trunktestspostattachmentsphp">trunk/tests/post/attachments.php</a></li>
<li><a href="#trunktestspostgalleryphp">trunk/tests/post/gallery.php</a></li>
<li><a href="#trunktestspostmetaphp">trunk/tests/post/meta.php</a></li>
<li><a href="#trunktestspostoutputphp">trunk/tests/post/output.php</a></li>
<li><a href="#trunktestsposttypesphp">trunk/tests/post/types.php</a></li>
<li><a href="#trunktestspostphp">trunk/tests/post.php</a></li>
<li><a href="#trunkteststaxonomyphp">trunk/tests/taxonomy.php</a></li>
<li><a href="#trunkteststermphp">trunk/tests/term.php</a></li>
<li><a href="#trunkteststhemesupportphp">trunk/tests/theme/support.php</a></li>
<li><a href="#trunkteststhemethemeDirphp">trunk/tests/theme/themeDir.php</a></li>
<li><a href="#trunkteststhemethemeDirLargephp">trunk/tests/theme/themeDirLarge.php</a></li>
<li><a href="#trunkteststhemephp">trunk/tests/theme.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/tests/test-xmlrpc-api/</li>
<li><a href="#trunkteststest_imagephp">trunk/tests/test_image.php</a></li>
<li><a href="#trunkteststest_import_wpphp">trunk/tests/test_import_wp.php</a></li>
<li><a href="#trunkteststest_includes_formattingphp">trunk/tests/test_includes_formatting.php</a></li>
<li><a href="#trunkteststest_includes_functionsphp">trunk/tests/test_includes_functions.php</a></li>
<li><a href="#trunkteststest_includes_pluggablephp">trunk/tests/test_includes_pluggable.php</a></li>
<li><a href="#trunkteststest_includes_postphp">trunk/tests/test_includes_post.php</a></li>
<li><a href="#trunkteststest_includes_taxonomyphp">trunk/tests/test_includes_taxonomy.php</a></li>
<li><a href="#trunkteststest_includes_themephp">trunk/tests/test_includes_theme.php</a></li>
<li><a href="#trunkteststest_post_outputphp">trunk/tests/test_post_output.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/actions.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/actions.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/actions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @group hooks
</span><span class="cx">  */
</span><del>-class WPTestActions extends WP_UnitTestCase {
</del><ins>+class Tests_Actions extends WP_UnitTestCase {
</ins><span class="cx"> 
</span><span class="cx">         function test_simple_action() {
</span><span class="cx">                 $a = new MockAction();
</span></span></pre></div>
<a id="trunktestsadminincludesMiscphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/admin/includesMisc.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesMisc.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/admin/includesMisc.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group admin
</span><span class="cx">  */
</span><del>-class TestShortenUrl extends WP_UnitTestCase {
</del><ins>+class Tests_Admin_includesMisc extends WP_UnitTestCase {
</ins><span class="cx">         function test_shorten_url() {
</span><span class="cx">                 $tests = array(
</span><span class="cx">                         // strip slashes
</span></span></pre></div>
<a id="trunktestsadminincludesScreenphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/admin/includesScreen.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesScreen.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/admin/includesScreen.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group admin
</span><span class="cx">  */
</span><del>-class WPTestScreen extends WP_UnitTestCase {
</del><ins>+class Tests_Admin_includesScreen extends WP_UnitTestCase {
</ins><span class="cx">         var $core_screens = array(
</span><span class="cx">                 'index.php' =&gt; array( 'base' =&gt; 'dashboard', 'id' =&gt; 'dashboard' ),
</span><span class="cx">                 'edit.php' =&gt; array( 'base' =&gt; 'edit', 'id' =&gt; 'edit-post', 'post_type' =&gt; 'post' ),
</span></span></pre></div>
<a id="trunktestsadminincludesTemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/admin/includesTemplate.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesTemplate.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/admin/includesTemplate.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group admin
</span><span class="cx">  */
</span><del>-class WPTestCheckedSelected extends WP_UnitTestCase {
</del><ins>+class Tests_Admin_includesTemplate extends WP_UnitTestCase {
</ins><span class="cx">         function test_equal() {
</span><span class="cx">                 $this-&gt;assertEquals(' selected=\'selected\'', selected('foo','foo',false));
</span><span class="cx">                 $this-&gt;assertEquals(' checked=\'checked\'', checked('foo','foo',false));
</span></span></pre></div>
<a id="trunktestsadminincludesThemephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/admin/includesTheme.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/admin/includesTheme.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/admin/includesTheme.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group themes
</span><span class="cx">  */
</span><del>-class TestPageTemplates extends WP_UnitTestCase {
</del><ins>+class Tests_Admin_includesTheme extends WP_UnitTestCase {
</ins><span class="cx">         function setUp() {
</span><span class="cx">                 parent::setUp();
</span><span class="cx">                 $this-&gt;theme_root = DIR_TESTDATA . '/themedir1';
</span></span></pre></div>
<a id="trunktestsajaxEditCommentphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/ajax/EditComment.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/ajax/EditComment.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/ajax/EditComment.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">  * @group      ajax
</span><span class="cx">  * @runTestsInSeparateProcesses
</span><span class="cx">  */
</span><del>-class Tests_Ajax_EditComments extends WP_Ajax_UnitTestCase {
</del><ins>+class Tests_Ajax_EditComment extends WP_Ajax_UnitTestCase {
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * A post with at least one comment
</span></span></pre></div>
<a id="trunktestsauthphpfromrev904trunkteststest_includes_pluggablephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/auth.php (from rev 904, trunk/tests/test_includes_pluggable.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/auth.php                                (rev 0)
+++ trunk/tests/auth.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;?php
+
+/**
+ * @group pluggable
+ */
+class Tests_Auth extends WP_UnitTestCase {
+        var $user_id;
+
+        function setUp() {
+                parent::setUp();
+                $this-&gt;user_id = $this-&gt;factory-&gt;user-&gt;create();
+        }
+
+        function test_auth_cookie_valid() {
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
+                $this-&gt;assertEquals( $this-&gt;user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
+        }
+
+        function test_auth_cookie_invalid() {
+                // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
+                // as an ajax test may have defined DOING_AJAX, failing the test.
+
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() - 7200, 'auth' );
+                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' );
+
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
+                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' );
+
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
+                list($a, $b, $c) = explode('|', $cookie);
+                $cookie = $a . '|' . ($b + 1) . '|' . $c;
+                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $this-&gt;user_id, 'auth' ), 'altered cookie' );
+        }
+
+        function test_auth_cookie_scheme() {
+                // arbitrary scheme name
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'foo' );
+                $this-&gt;assertEquals( $this-&gt;user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );
+
+                // wrong scheme name - should fail
+                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'foo' );
+                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestscachephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/cache.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/cache.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/cache.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group cache
</span><span class="cx">  */
</span><del>-class TestObjectCache extends WP_UnitTestCase {
</del><ins>+class Tests_Cache extends WP_UnitTestCase {
</ins><span class="cx">         var $cache = NULL;
</span><span class="cx"> 
</span><span class="cx">         function setUp() {
</span></span></pre></div>
<a id="trunktestsdbphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/db.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/db.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/db.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @group wpdb
</span><span class="cx">  */
</span><del>-class TestWPDB extends WP_UnitTestCase {
</del><ins>+class Tests_DB extends WP_UnitTestCase {
</ins><span class="cx"> 
</span><span class="cx">         /**
</span><span class="cx">          * Query log
</span></span></pre></div>
<a id="trunktestsdependenciesscriptsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/dependencies/scripts.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/dependencies/scripts.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/dependencies/scripts.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx">  * @group dependencies
</span><span class="cx">  * @group scripts
</span><span class="cx">  */
</span><del>-class TestWP_Scripts extends WP_UnitTestCase {
</del><ins>+class Tests_Dependencies_Scripts extends WP_UnitTestCase {
</ins><span class="cx">         var $old_wp_scripts;
</span><span class="cx"> 
</span><span class="cx">         function setUp() {
</span><span class="lines">@@ -12,7 +12,6 @@
</span><span class="cx">                 remove_action( 'wp_default_scripts', 'wp_default_scripts' );
</span><span class="cx">                 $GLOBALS['wp_scripts'] = new WP_Scripts();
</span><span class="cx">                 $GLOBALS['wp_scripts']-&gt;default_version = get_bloginfo( 'version' );
</span><del>-
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function tearDown() {
</span></span></pre></div>
<a id="trunktestsdependenciesstylesphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/dependencies/styles.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/dependencies/styles.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/dependencies/styles.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx">  * @group dependencies
</span><span class="cx">  * @group scripts
</span><span class="cx">  */
</span><del>-class TestWP_Styles extends WP_UnitTestCase {
</del><ins>+class Tests_Dependencies_Styles extends WP_UnitTestCase {
</ins><span class="cx">         var $old_wp_styles;
</span><span class="cx"> 
</span><span class="cx">         function setUp() {
</span></span></pre></div>
<a id="trunktestsfilephp"></a>
<div class="modfile"><h4>Modified: trunk/tests/file.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/file.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/file.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,5 +1,8 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><ins>+/**
+ * @group file
+ */
</ins><span class="cx"> class Tests_File extends WP_UnitTestCase {
</span><span class="cx"> 
</span><span class="cx">         function setUp() {
</span><span class="lines">@@ -8,6 +11,52 @@
</span><span class="cx">                 $this-&gt;badchars = '&quot;\'[]*&amp;?$';
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /**
+         * @group plugins
+         * @group themes
+         */
+        function test_get_file_data() {
+                $theme_headers = array(
+                        'Name' =&gt; 'Theme Name',
+                        'ThemeURI' =&gt; 'Theme URI',
+                        'Description' =&gt; 'Description',
+                        'Version' =&gt; 'Version',
+                        'Author' =&gt; 'Author',
+                        'AuthorURI' =&gt; 'Author URI',
+                );
+
+                $actual = get_file_data( DIR_TESTDATA . '/themedir1/default/style.css', $theme_headers );
+
+                $expected = array(
+                        'Name' =&gt; 'WordPress Default',
+                        'ThemeURI' =&gt; 'http://wordpress.org/',
+                        'Description' =&gt; 'The default WordPress theme based on the famous &lt;a href=&quot;http://binarybonsai.com/kubrick/&quot;&gt;Kubrick&lt;/a&gt;.',
+                        'Version' =&gt; '1.6',
+                        'Author' =&gt; 'Michael Heilemann',
+                        'AuthorURI' =&gt; 'http://binarybonsai.com/',
+                );
+
+                foreach ( $actual as $header =&gt; $value )
+                        $this-&gt;assertEquals( $expected[ $header ], $value, $header );
+        }
+
+        /**
+         * @group plugins
+         * @group themes
+         */
+        function test_get_file_data_cr_line_endings() {
+                $headers = array( 'SomeHeader' =&gt; 'Some Header', 'Description' =&gt; 'Description', 'Author' =&gt; 'Author' );
+                $actual = get_file_data( DIR_TESTDATA . '/formatting/cr-line-endings-file-header.php', $headers );
+                $expected = array(
+                        'SomeHeader' =&gt; 'Some header value!',
+                        'Description' =&gt; 'This file is using CR line endings for a testcase.',
+                        'Author' =&gt; 'A Very Old Mac',
+                );
+
+                foreach ( $actual as $header =&gt; $value )
+                        $this-&gt;assertEquals( $expected[ $header ], $value, $header );
+        }
+
</ins><span class="cx">         function is_unique_writable_file($path, $filename) {
</span><span class="cx">                 $fullpath = $path . DIRECTORY_SEPARATOR . $filename;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunktestsfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/filters.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/filters.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/filters.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @group hooks
</span><span class="cx">  */
</span><del>-class WPTestFilters extends WP_UnitTestCase {
</del><ins>+class Tests_Filters extends WP_UnitTestCase {
</ins><span class="cx"> 
</span><span class="cx">         function test_simple_filter() {
</span><span class="cx">                 $a = new MockAction();
</span></span></pre></div>
<a id="trunktestsformattingAutopphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/Autop.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/Autop.php                                (rev 0)
+++ trunk/tests/formatting/Autop.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Autop extends WP_UnitTestCase {
+        //From ticket http://core.trac.wordpress.org/ticket/11008
+        function test_first_post() {
+                $expected = '&lt;p&gt;Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.&lt;/p&gt;
+&lt;p&gt;First things first:&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;&lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Subscribe to the WordPress mailing list for release notifications&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+&lt;p&gt;As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.&lt;br /&gt;
+When a new version is released, &lt;a href=&quot;%2$s&quot; title=&quot;If you are already logged in, this will take you directly to the Dashboard&quot;&gt;log in to the Dashboard&lt;/a&gt; and follow the instructions.&lt;br /&gt;
+Upgrading is a couple of clicks!&lt;/p&gt;
+&lt;p&gt;Then you can start enjoying the WordPress experience:&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;Edit your personal information at &lt;a href=&quot;%3$s&quot; title=&quot;Edit settings like your password, your display name and your contact information&quot;&gt;Users &amp;#8250; Your Profile&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Start publishing at &lt;a href=&quot;%4$s&quot; title=&quot;Create a new post&quot;&gt;Posts &amp;#8250; Add New&lt;/a&gt; and at &lt;a href=&quot;%5$s&quot; title=&quot;Create a new page&quot;&gt;Pages &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Browse and install plugins at &lt;a href=&quot;%6$s&quot; title=&quot;Browse and install plugins at the official WordPress repository directly from your Dashboard&quot;&gt;Plugins &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Browse and install themes at &lt;a href=&quot;%7$s&quot; title=&quot;Browse and install themes at the official WordPress repository directly from your Dashboard&quot;&gt;Appearance &amp;#8250; Add New Themes&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Modify and prettify your website&amp;#8217;s links at &lt;a href=&quot;%8$s&quot; title=&quot;For example, select a link structure like: http://example.com/1999/12/post-name&quot;&gt;Settings &amp;#8250; Permalinks&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Import content from another system or WordPress site at &lt;a href=&quot;%9$s&quot; title=&quot;WordPress comes with importers for the most common publishing systems&quot;&gt;Tools &amp;#8250; Import&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Find answers to your questions at the &lt;a href=&quot;%10$s&quot; title=&quot;The official WordPress documentation, maintained by the WordPress community&quot;&gt;WordPress Codex&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+&lt;p&gt;To keep this post for reference, &lt;a href=&quot;%11$s&quot; title=&quot;Click to edit the content and settings of this post&quot;&gt;click to edit it&lt;/a&gt;, go to the Publish box and change its Visibility from Public to Private.&lt;/p&gt;
+&lt;p&gt;Thank you for selecting WordPress.  We wish you happy publishing!&lt;/p&gt;
+&lt;p&gt;PS.  Not yet subscribed for update notifications?  &lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Do it now!&lt;/a&gt;&lt;/p&gt;
+';
+                $test_data = '
+Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.
+
+First things first:
+&lt;ul&gt;
+&lt;li&gt;&lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Subscribe to the WordPress mailing list for release notifications&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.
+When a new version is released, &lt;a href=&quot;%2$s&quot; title=&quot;If you are already logged in, this will take you directly to the Dashboard&quot;&gt;log in to the Dashboard&lt;/a&gt; and follow the instructions.
+Upgrading is a couple of clicks!
+
+Then you can start enjoying the WordPress experience:
+&lt;ul&gt;
+&lt;li&gt;Edit your personal information at &lt;a href=&quot;%3$s&quot; title=&quot;Edit settings like your password, your display name and your contact information&quot;&gt;Users &amp;#8250; Your Profile&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Start publishing at &lt;a href=&quot;%4$s&quot; title=&quot;Create a new post&quot;&gt;Posts &amp;#8250; Add New&lt;/a&gt; and at &lt;a href=&quot;%5$s&quot; title=&quot;Create a new page&quot;&gt;Pages &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Browse and install plugins at &lt;a href=&quot;%6$s&quot; title=&quot;Browse and install plugins at the official WordPress repository directly from your Dashboard&quot;&gt;Plugins &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Browse and install themes at &lt;a href=&quot;%7$s&quot; title=&quot;Browse and install themes at the official WordPress repository directly from your Dashboard&quot;&gt;Appearance &amp;#8250; Add New Themes&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Modify and prettify your website&amp;#8217;s links at &lt;a href=&quot;%8$s&quot; title=&quot;For example, select a link structure like: http://example.com/1999/12/post-name&quot;&gt;Settings &amp;#8250; Permalinks&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Import content from another system or WordPress site at &lt;a href=&quot;%9$s&quot; title=&quot;WordPress comes with importers for the most common publishing systems&quot;&gt;Tools &amp;#8250; Import&lt;/a&gt;&lt;/li&gt;
+&lt;li&gt;Find answers to your questions at the &lt;a href=&quot;%10$s&quot; title=&quot;The official WordPress documentation, maintained by the WordPress community&quot;&gt;WordPress Codex&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+To keep this post for reference, &lt;a href=&quot;%11$s&quot; title=&quot;Click to edit the content and settings of this post&quot;&gt;click to edit it&lt;/a&gt;, go to the Publish box and change its Visibility from Public to Private.
+
+Thank you for selecting WordPress.  We wish you happy publishing!
+
+PS.  Not yet subscribed for update notifications?  &lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Do it now!&lt;/a&gt;
+';
+
+                // On windows environments, the EOL-style is \r\n
+                $expected = str_replace( &quot;\r\n&quot;, &quot;\n&quot;, $expected);
+
+                $this-&gt;assertEquals($expected, wpautop($test_data));
+        }
+
+        /**
+         * wpautop() Should not alter the contents of &quot;&lt;pre&gt;&quot; elements
+         *
+         * @ticket 19855
+         */
+        public function test_skip_pre_elements() {
+                $code = file_get_contents( DIR_TESTDATA . '/formatting/sizzle.js' );
+                $code = str_replace( &quot;\r&quot;, '', $code );
+                $code = htmlentities( $code );
+
+                // Not wrapped in &lt;p&gt; tags
+                $str = &quot;&lt;pre&gt;$code&lt;/pre&gt;&quot;;
+                $this-&gt;assertEquals( $str, trim( wpautop( $str ) ) );
+
+                // Text before/after is wrapped in &lt;p&gt; tags
+                $str = &quot;Look at this code\n\n&lt;pre&gt;$code&lt;/pre&gt;\n\nIsn't that cool?&quot;;
+
+                // Expected text after wpautop
+                $expected = '&lt;p&gt;Look at this code&lt;/p&gt;' . &quot;\n&lt;pre&gt;&quot; . $code . &quot;&lt;/pre&gt;\n&quot; . '&lt;p&gt;Isn\'t that cool?&lt;/p&gt;';
+                $this-&gt;assertEquals( $expected, trim( wpautop( $str ) ) );
+
+                // Make sure HTML breaks are maintained if manually inserted
+                $str = &quot;Look at this code\n\n&lt;pre&gt;Line1&lt;br /&gt;Line2&lt;br&gt;Line3&lt;br/&gt;Line4\nActual Line 2\nActual Line 3&lt;/pre&gt;\n\nCool, huh?&quot;;
+                $expected = &quot;&lt;p&gt;Look at this code&lt;/p&gt;\n&lt;pre&gt;Line1&lt;br /&gt;Line2&lt;br&gt;Line3&lt;br/&gt;Line4\nActual Line 2\nActual Line 3&lt;/pre&gt;\n&lt;p&gt;Cool, huh?&lt;/p&gt;&quot;;
+                $this-&gt;assertEquals( $expected, trim( wpautop( $str ) ) );
+        }
+
+        /**
+         * wpautop() Should not add &lt;br/&gt; to &quot;&lt;input&gt;&quot; elements
+         *
+         * @ticket 16456
+         */
+        public function test_skip_input_elements() {
+                $str = 'Username: &lt;input type=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; /&gt;&lt;br /&gt;Password: &lt;input type=&quot;password&quot; id=&quot;password1&quot; name=&quot;password1&quot; /&gt;';
+                $this-&gt;assertEquals( &quot;&lt;p&gt;$str&lt;/p&gt;&quot;, trim( wpautop( $str ) ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingCleanPrephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/CleanPre.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/CleanPre.php                                (rev 0)
+++ trunk/tests/formatting/CleanPre.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;?php
+
+/**
+ * The clean_pre() removes pararaph and line break
+ * tags within `&lt;pre&gt;` elements as part of wpautop().
+ *
+ * @group formatting
+ */
+class Tests_Formatting_CleanPre extends WP_UnitTestCase {
+        function test_removes_self_closing_br_with_space() {
+                $source = 'a b c\n&lt;br /&gt;sldfj&lt;br /&gt;';
+                $res = 'a b c\nsldfj';
+
+                $this-&gt;assertEquals($res, clean_pre($source));
+        }
+
+        function test_removes_self_closing_br_without_space() {
+                $source = 'a b c\n&lt;br/&gt;sldfj&lt;br/&gt;';
+                $res = 'a b c\nsldfj';
+                $this-&gt;assertEquals($res, clean_pre($source));
+        }
+
+        // I don't think this can ever happen in production;
+        // &lt;br&gt; is changed to &lt;br /&gt; elsewhere. Left in because
+        // that replacement shouldn't happen (what if you want
+        // HTML 4 output?).
+        function test_removes_html_br() {
+                $source = 'a b c\n&lt;br&gt;sldfj&lt;br&gt;';
+                $res = 'a b c\nsldfj';
+                $this-&gt;assertEquals($res, clean_pre($source));
+        }
+
+        function test_removes_p() {
+                $source = &quot;&lt;p&gt;isn't this exciting!&lt;/p&gt;&lt;p&gt;oh indeed!&lt;/p&gt;&quot;;
+                $res = &quot;\nisn't this exciting!\noh indeed!&quot;;
+                $this-&gt;assertEquals($res, clean_pre($source));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingConvertCharsphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/ConvertChars.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/ConvertChars.php                                (rev 0)
+++ trunk/tests/formatting/ConvertChars.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_ConvertChars extends WP_UnitTestCase {
+        function test_replaces_windows1252_entities_with_unicode_ones() {
+                $input = &quot;&amp;#130;&amp;#131;&amp;#132;&amp;#133;&amp;#134;&amp;#135;&amp;#136;&amp;#137;&amp;#138;&amp;#139;&amp;#140;&amp;#145;&amp;#146;&amp;#147;&amp;#148;&amp;#149;&amp;#150;&amp;#151;&amp;#152;&amp;#153;&amp;#154;&amp;#155;&amp;#156;&amp;#159;&quot;;
+                $output = &quot;&amp;#8218;&amp;#402;&amp;#8222;&amp;#8230;&amp;#8224;&amp;#8225;&amp;#710;&amp;#8240;&amp;#352;&amp;#8249;&amp;#338;&amp;#8216;&amp;#8217;&amp;#8220;&amp;#8221;&amp;#8226;&amp;#8211;&amp;#8212;&amp;#732;&amp;#8482;&amp;#353;&amp;#8250;&amp;#339;&amp;#376;&quot;;
+                $this-&gt;assertEquals($output, convert_chars($input));
+        }
+
+        /**
+         * @ticket 20503
+         */
+        function test_replaces_latin_letter_z_with_caron() {
+                $input = &quot;&amp;#142;&amp;#158;&quot;;
+                $output = &quot;&amp;#381;&amp;#382;&quot;;
+                $this-&gt;assertEquals( $output, convert_chars( $input ) );
+        }
+
+        function test_converts_html_br_and_hr_to_the_xhtml_self_closing_variety() {
+                $inputs = array(
+                        &quot;abc &lt;br&gt; lol &lt;br /&gt;&quot; =&gt; &quot;abc &lt;br /&gt; lol &lt;br /&gt;&quot;,
+                        &quot;&lt;br&gt; ho ho &lt;hr&gt;&quot;     =&gt; &quot;&lt;br /&gt; ho ho &lt;hr /&gt;&quot;,
+                        &quot;&lt;hr&gt;&lt;br&gt;&quot;            =&gt; &quot;&lt;hr /&gt;&lt;br /&gt;&quot;
+                        );
+                foreach ($inputs as $input =&gt; $expected) {
+                        $this-&gt;assertEquals($expected, convert_chars($input));
+                }
+        }
+
+        function test_escapes_lone_ampersands() {
+                $this-&gt;assertEquals(&quot;at&amp;#038;t&quot;, convert_chars(&quot;at&amp;t&quot;));
+        }
+
+        function test_removes_category_and_title_metadata_tags() {
+                $this-&gt;assertEquals(&quot;&quot;, convert_chars(&quot;&lt;title&gt;&lt;div class='lol'&gt;abc&lt;/div&gt;&lt;/title&gt;&lt;category&gt;a&lt;/category&gt;&quot;));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingEscAttrphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/EscAttr.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/EscAttr.php                                (rev 0)
+++ trunk/tests/formatting/EscAttr.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscAttr extends WP_UnitTestCase {
+        function test_esc_attr_quotes() {
+                $attr = '&quot;double quotes&quot;';
+                $this-&gt;assertEquals( '&amp;quot;double quotes&amp;quot;', esc_attr( $attr ) );
+
+                $attr = &quot;'single quotes'&quot;;
+                $this-&gt;assertEquals( '&amp;#039;single quotes&amp;#039;', esc_attr( $attr ) );
+
+                $attr = &quot;'mixed' &quot; . '&quot;quotes&quot;';
+                $this-&gt;assertEquals( '&amp;#039;mixed&amp;#039; &amp;quot;quotes&amp;quot;', esc_attr( $attr ) );
+
+                // Handles double encoding?
+                $attr = '&quot;double quotes&quot;';
+                $this-&gt;assertEquals( '&amp;quot;double quotes&amp;quot;', esc_attr( esc_attr( $attr ) ) );
+
+                $attr = &quot;'single quotes'&quot;;
+                $this-&gt;assertEquals( '&amp;#039;single quotes&amp;#039;', esc_attr( esc_attr( $attr ) ) );
+
+                $attr = &quot;'mixed' &quot; . '&quot;quotes&quot;';
+                $this-&gt;assertEquals( '&amp;#039;mixed&amp;#039; &amp;quot;quotes&amp;quot;', esc_attr( esc_attr( $attr ) ) );
+        }
+
+        function test_esc_attr_amp() {
+                $out = esc_attr( 'foo &amp; bar &amp;baz; &amp;apos;' );
+                $this-&gt;assertEquals( &quot;foo &amp;amp; bar &amp;amp;baz; &amp;apos;&quot;, $out );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingEscHtmlphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/EscHtml.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/EscHtml.php                                (rev 0)
+++ trunk/tests/formatting/EscHtml.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscHtml extends WP_UnitTestCase {
+        function test_esc_html_basics() {
+                // Simple string
+                $html = &quot;The quick brown fox.&quot;;
+                $this-&gt;assertEquals( $html, esc_html( $html ) );
+
+                // URL with &amp;
+                $html = &quot;http://localhost/trunk/wp-login.php?action=logout&amp;_wpnonce=cd57d75985&quot;;
+                $escaped = &quot;http://localhost/trunk/wp-login.php?action=logout&amp;amp;_wpnonce=cd57d75985&quot;;
+                $this-&gt;assertEquals( $escaped, esc_html( $html ) );
+
+                // SQL query
+                $html = &quot;SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1&quot;;
+                $escaped = &quot;SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN (&amp;#039;site_name&amp;#039;, &amp;#039;siteurl&amp;#039;, &amp;#039;active_sitewide_plugins&amp;#039;, &amp;#039;_site_transient_timeout_theme_roots&amp;#039;, &amp;#039;_site_transient_theme_roots&amp;#039;, &amp;#039;site_admins&amp;#039;, &amp;#039;can_compress_scripts&amp;#039;, &amp;#039;global_terms_enabled&amp;#039;) AND site_id = 1&quot;;
+                $this-&gt;assertEquals( $escaped, esc_html( $html ) );
+        }
+
+        function test_escapes_ampersands() {
+                $source = &quot;penn &amp; teller &amp; at&amp;t&quot;;
+                $res = &quot;penn &amp;amp; teller &amp;amp; at&amp;amp;t&quot;;
+                $this-&gt;assertEquals( $res, esc_html($source) );
+        }
+
+        function test_escapes_greater_and_less_than() {
+                $source = &quot;this &gt; that &lt; that &lt;randomhtml /&gt;&quot;;
+                $res = &quot;this &amp;gt; that &amp;lt; that &amp;lt;randomhtml /&amp;gt;&quot;;
+                $this-&gt;assertEquals( $res, esc_html($source) );
+        }
+
+        function test_ignores_existing_entities() {
+                $source = '&amp;#038; &amp;#x00A3; &amp;#x22; &amp;amp;';
+                $res = '&amp;amp; &amp;#xA3; &amp;quot; &amp;amp;';
+                $this-&gt;assertEquals( $res, esc_html($source) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingEscUrlphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/EscUrl.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/EscUrl.php                                (rev 0)
+++ trunk/tests/formatting/EscUrl.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscUrl extends WP_UnitTestCase {
+        function test_spaces() {
+                $this-&gt;assertEquals('http://example.com/MrWordPress', esc_url('http://example.com/Mr WordPress'));
+                $this-&gt;assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr%20WordPress'));
+        }
+
+        function test_bad_characters() {
+                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0Ago'));
+                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0ago'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0Dgo'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0dgo'));
+                //Nesting Checks
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0ddgo'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0DDgo'));
+                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAD'));
+                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADA'));
+                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAd'));
+                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADa'));
+        }
+
+        function test_relative() {
+                $this-&gt;assertEquals('/example.php', esc_url('/example.php'));
+                $this-&gt;assertEquals('example.php', esc_url('example.php'));
+                $this-&gt;assertEquals('#fragment', esc_url('#fragment'));
+                $this-&gt;assertEquals('?foo=bar', esc_url('?foo=bar'));
+        }
+
+        function test_protocol() {
+                $this-&gt;assertEquals('http://example.com', esc_url('http://example.com'));
+                $this-&gt;assertEquals('', esc_url('nasty://example.com/'));
+        }
+
+        function test_display_extras() {
+                $this-&gt;assertEquals('http://example.com/&amp;#039;quoted&amp;#039;', esc_url('http://example.com/\'quoted\''));
+                $this-&gt;assertEquals('http://example.com/\'quoted\'', esc_url('http://example.com/\'quoted\'',null,'notdisplay'));
+        }
+
+        function test_non_ascii() {
+                $this-&gt;assertEquals( 'http://example.org/баба', esc_url( 'http://example.org/баба' ) );
+                $this-&gt;assertEquals( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) );
+                $this-&gt;assertEquals( 'http://müller.com/', esc_url( 'http://müller.com/' ) );
+        }
+
+        function test_feed() {
+                $this-&gt;assertEquals( '', esc_url( 'feed:javascript:alert(1)' ) );
+                $this-&gt;assertEquals( '', esc_url( 'feed:javascript:feed:alert(1)' ) );
+                $this-&gt;assertEquals( '', esc_url( 'feed:feed:javascript:alert(1)' ) );
+                $this-&gt;assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) );
+                $this-&gt;assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) );
+        }
+
+        /**
+         * @ticket 16859
+         */
+        function test_square_brackets() {
+                $this-&gt;assertEquals( 'http://example.com/?foo%5Bbar%5D=baz', esc_url( 'http://example.com/?foo[bar]=baz' ) );
+                $this-&gt;assertEquals( 'http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz', esc_url( 'http://example.com/?baz=bar&amp;foo[bar]=baz' ) );
+                //IPv6 addresses in urls - RFC2732
+                $this-&gt;assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) );
+                $this-&gt;assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) );
+                $this-&gt;assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingHtmlExcerptphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/HtmlExcerpt.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/HtmlExcerpt.php                                (rev 0)
+++ trunk/tests/formatting/HtmlExcerpt.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_HtmlExcerpt extends WP_UnitTestCase {
+        function test_simple() {
+                $this-&gt;assertEquals(&quot;Baba&quot;, wp_html_excerpt(&quot;Baba told me not to come&quot;, 4));
+        }
+        function test_html() {
+                $this-&gt;assertEquals(&quot;Baba&quot;, wp_html_excerpt(&quot;&lt;a href='http://baba.net/'&gt;Baba&lt;/a&gt; told me not to come&quot;, 4));
+        }
+        function test_entities() {
+                $this-&gt;assertEquals(&quot;Baba &quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 8));
+                $this-&gt;assertEquals(&quot;Baba &quot;, wp_html_excerpt(&quot;Baba &amp;#038; Dyado&quot;, 8));
+                $this-&gt;assertEquals(&quot;Baba &amp;amp; D&quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 12));
+                $this-&gt;assertEquals(&quot;Baba &amp;amp; Dyado&quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 100));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingIsEmailphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/IsEmail.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/IsEmail.php                                (rev 0)
+++ trunk/tests/formatting/IsEmail.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_IsEmail extends WP_UnitTestCase {
+        function test_returns_true_if_given_a_valid_email_address() {
+                $data = array(
+                        &quot;bob@example.com&quot;,
+                        &quot;phil@example.info&quot;,
+                        &quot;ace@204.32.222.14&quot;,
+                        &quot;kevin@many.subdomains.make.a.happy.man.edu&quot;
+                        );
+                foreach ( $data as $datum ) {
+                        $this-&gt;assertEquals( $datum, is_email($datum), $datum );
+                }
+        }
+
+        function test_returns_false_if_given_an_invalid_email_address() {
+                $data = array(
+                        &quot;khaaaaaaaaaaaaaaan!&quot;,
+                        'http://bob.example.com/',
+                        &quot;sif i'd give u it, spamer!1&quot;,
+                        &quot;com.exampleNOSPAMbob&quot;,
+                        &quot;bob@your mom&quot;
+                        );
+                foreach ($data as $datum) {
+                        $this-&gt;assertFalse(is_email($datum), $datum);
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingJSEscapephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/JSEscape.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/JSEscape.php                                (rev 0)
+++ trunk/tests/formatting/JSEscape.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_JSEscape extends WP_UnitTestCase {
+        function test_js_escape_simple() {
+                $out = esc_js('foo bar baz();');
+                $this-&gt;assertEquals('foo bar baz();', $out);
+        }
+
+        function test_js_escape_quotes() {
+                $out = esc_js('foo &quot;bar&quot; \'baz\'');
+                // does it make any sense to change &quot; into &amp;quot;?  Why not \&quot;?
+                $this-&gt;assertEquals(&quot;foo &amp;quot;bar&amp;quot; \'baz\'&quot;, $out);
+        }
+
+        function test_js_escape_backslash() {
+                $bs = '\\';
+                $out = esc_js('foo '.$bs.'t bar '.$bs.$bs.' baz');
+                // \t becomes t - bug?
+                $this-&gt;assertEquals('foo t bar '.$bs.$bs.' baz', $out);
+        }
+
+        function test_js_escape_amp() {
+                $out = esc_js('foo &amp; bar &amp;baz; &amp;apos;');
+                $this-&gt;assertEquals(&quot;foo &amp;amp; bar &amp;amp;baz; &amp;apos;&quot;, $out);
+        }
+
+        function test_js_escape_quote_entity() {
+                $out = esc_js('foo &amp;#x27; bar &amp;#39; baz &amp;#x26;');
+                $this-&gt;assertEquals(&quot;foo \\' bar \\' baz &amp;amp;&quot;, $out);
+        }
+
+        function test_js_no_carriage_return() {
+                $out = esc_js(&quot;foo\rbar\nbaz\r&quot;);
+                // \r is stripped
+                $this-&gt;assertequals(&quot;foobar\\nbaz&quot;, $out);
+        }
+
+        function test_js_escape_rn() {
+                $out = esc_js(&quot;foo\r\nbar\nbaz\r\n&quot;);
+                // \r is stripped
+                $this-&gt;assertequals(&quot;foo\\nbar\\nbaz\\n&quot;, $out);
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingLikeEscapephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/LikeEscape.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/LikeEscape.php                                (rev 0)
+++ trunk/tests/formatting/LikeEscape.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_LikeEscape extends WP_UnitTestCase {
+        /**
+         * @ticket 10041
+         */
+        function test_like_escape() {
+
+                $inputs = array(
+                        'howdy%', //Single Percent
+                        'howdy_', //Single Underscore
+                        'howdy\\', //Single slash
+                        'howdy\\howdy%howdy_', //The works
+                );
+                $expected = array(
+                        &quot;howdy\\%&quot;,
+                        'howdy\\_',
+                        'howdy\\\\',
+                        'howdy\\\\howdy\\%howdy\\_'
+                );
+
+                foreach ($inputs as $key =&gt; $input) {
+                        $this-&gt;assertEquals($expected[$key], like_escape($input));
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingMakeClickablephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/MakeClickable.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/MakeClickable.php                                (rev 0)
+++ trunk/tests/formatting/MakeClickable.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,347 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
+        function test_mailto_xss() {
+                $in = 'testzzz@&quot;STYLE=&quot;behavior:url(\'#default#time2\')&quot;onBegin=&quot;alert(\'refresh-XSS\')&quot;';
+                $this-&gt;assertEquals($in, make_clickable($in));
+        }
+
+        function test_valid_mailto() {
+                $valid_emails = array(
+                        'foo@example.com',
+                        'foo.bar@example.com',
+                        'Foo.Bar@a.b.c.d.example.com',
+                        '0@example.com',
+                        'foo@example-example.com',
+                        );
+                foreach ($valid_emails as $email) {
+                        $this-&gt;assertEquals('&lt;a href=&quot;mailto:'.$email.'&quot;&gt;'.$email.'&lt;/a&gt;', make_clickable($email));
+                }
+        }
+
+        function test_invalid_mailto() {
+                $invalid_emails = array(
+                        'foo',
+                        'foo@',
+                        'foo@@example.com',
+                        '@example.com',
+                        'foo @example.com',
+                        'foo@example',
+                        );
+                foreach ($invalid_emails as $email) {
+                        $this-&gt;assertEquals($email, make_clickable($email));
+                }
+        }
+
+        // tests that make_clickable will not link trailing periods, commas and
+        // (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
+        function test_strip_trailing_with_protocol() {
+                $urls_before = array(
+                        'http://wordpress.org/hello.html',
+                        'There was a spoon named http://wordpress.org. Alice!',
+                        'There was a spoon named http://wordpress.org, said Alice.',
+                        'There was a spoon named http://wordpress.org; said Alice.',
+                        'There was a spoon named http://wordpress.org: said Alice.',
+                        'There was a spoon named (http://wordpress.org) said Alice.'
+                        );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://wordpress.org/hello.html&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org/hello.html&lt;/a&gt;',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;. Alice!',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;, said Alice.',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;; said Alice.',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;: said Alice.',
+                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;) said Alice.'
+                        );
+
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // tests that make_clickable will not link trailing periods, commas and
+        // (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
+        function test_strip_trailing_with_protocol_nothing_afterwards() {
+                $urls_before = array(
+                        'http://wordpress.org/hello.html',
+                        'There was a spoon named http://wordpress.org.',
+                        'There was a spoon named http://wordpress.org,',
+                        'There was a spoon named http://wordpress.org;',
+                        'There was a spoon named http://wordpress.org:',
+                        'There was a spoon named (http://wordpress.org)',
+                        'There was a spoon named (http://wordpress.org)x',
+                        );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://wordpress.org/hello.html&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org/hello.html&lt;/a&gt;',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;.',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;,',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;;',
+                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;:',
+                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;)',
+                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;)x',
+                        );
+
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // tests that make_clickable will not link trailing periods, commas and
+        // (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
+        function test_strip_trailing_without_protocol() {
+                $urls_before = array(
+                        'www.wordpress.org',
+                        'There was a spoon named www.wordpress.org. Alice!',
+                        'There was a spoon named www.wordpress.org, said Alice.',
+                        'There was a spoon named www.wordpress.org; said Alice.',
+                        'There was a spoon named www.wordpress.org: said Alice.',
+                        'There was a spoon named www.wordpress.org) said Alice.'
+                        );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;. Alice!',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;, said Alice.',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;; said Alice.',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;: said Alice.',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;) said Alice.'
+                        );
+
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // tests that make_clickable will not link trailing periods, commas and
+        // (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
+        function test_strip_trailing_without_protocol_nothing_afterwards() {
+                $urls_before = array(
+                        'www.wordpress.org',
+                        'There was a spoon named www.wordpress.org.',
+                        'There was a spoon named www.wordpress.org,',
+                        'There was a spoon named www.wordpress.org;',
+                        'There was a spoon named www.wordpress.org:',
+                        'There was a spoon named www.wordpress.org)'
+                        );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;.',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;,',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;;',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;:',
+                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;)'
+                        );
+
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // #4570
+        function test_iri() {
+                $urls_before = array(
+                        'http://www.詹姆斯.com/',
+                        'http://bg.wikipedia.org/Баба',
+                        'http://example.com/?a=баба&amp;b=дядо',
+                );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://www.詹姆斯.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.詹姆斯.com/&lt;/a&gt;',
+                        '&lt;a href=&quot;http://bg.wikipedia.org/Баба&quot; rel=&quot;nofollow&quot;&gt;http://bg.wikipedia.org/Баба&lt;/a&gt;',
+                        '&lt;a href=&quot;http://example.com/?a=баба&amp;#038;b=дядо&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?a=баба&amp;#038;b=дядо&lt;/a&gt;',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // #10990
+        function test_brackets_in_urls() {
+                $urls_before = array(
+                        'http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)',
+                        '(http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software))',
+                        'blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah',
+                        'blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah',
+                        'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah blah',
+                        'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
+                        'blah blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
+                        'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).) blah blah',
+                        'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).)moreurl blah blah',
+                        'In his famous speech “You and Your research” (here:
+                        http://www.cs.virginia.edu/~robins/YouAndYourResearch.html)
+                        Richard Hamming wrote about people getting more done with their doors closed, but',
+                );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;',
+                        '(&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;)',
+                        'blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt; blah',
+                        'blah (&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah',
+                        'blah blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt; blah blah',
+                        'blah blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah blah',
+                        'blah blah (&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah blah',
+                        'blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;.) blah blah',
+                        'blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;.)moreurl blah blah',
+                        'In his famous speech “You and Your research” (here:
+                        &lt;a href=&quot;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&lt;/a&gt;)
+                        Richard Hamming wrote about people getting more done with their doors closed, but',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // Based on a real comments which were incorrectly linked. #11211
+        function test_real_world_examples() {
+                $urls_before = array(
+                        'Example: WordPress, test (some text), I love example.com (http://example.org), it is brilliant',
+                        'Example: WordPress, test (some text), I love example.com (http://example.com), it is brilliant',
+                        'Some text followed by a bracketed link with a trailing elipsis (http://example.com)...',
+                        'In his famous speech “You and Your research” (here: http://www.cs.virginia.edu/~robins/YouAndYourResearch.html) Richard Hamming wrote about people getting more done with their doors closed...',
+                );
+                $urls_expected = array(
+                        'Example: WordPress, test (some text), I love example.com (&lt;a href=&quot;http://example.org&quot; rel=&quot;nofollow&quot;&gt;http://example.org&lt;/a&gt;), it is brilliant',
+                        'Example: WordPress, test (some text), I love example.com (&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;), it is brilliant',
+                        'Some text followed by a bracketed link with a trailing elipsis (&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;)...',
+                        'In his famous speech “You and Your research” (here: &lt;a href=&quot;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&lt;/a&gt;) Richard Hamming wrote about people getting more done with their doors closed...',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        // #14993
+        function test_twitter_hash_bang() {
+                $urls_before = array(
+                        'http://twitter.com/#!/wordpress/status/25907440233',
+                        'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233 !',
+                        'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233!',
+                );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt;',
+                        'This is a really good tweet &lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt; !',
+                        'This is a really good tweet &lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt;!',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        function test_wrapped_in_angles() {
+                $before = array(
+                        'URL wrapped in angle brackets &lt;http://example.com/&gt;',
+                        'URL wrapped in angle brackets with padding &lt; http://example.com/ &gt;',
+                        'mailto wrapped in angle brackets &lt;foo@example.com&gt;',
+                );
+                $expected = array(
+                        'URL wrapped in angle brackets &lt;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;&gt;',
+                        'URL wrapped in angle brackets with padding &lt; &lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt; &gt;',
+                        'mailto wrapped in angle brackets &lt;foo@example.com&gt;',
+                );
+                foreach ($before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($expected[$key], make_clickable($url));
+                }
+        }
+
+        function test_preceded_by_punctuation() {
+                $before = array(
+                        'Comma then URL,http://example.com/',
+                        'Period then URL.http://example.com/',
+                        'Semi-colon then URL;http://example.com/',
+                        'Colon then URL:http://example.com/',
+                        'Exclamation mark then URL!http://example.com/',
+                        'Question mark then URL?http://example.com/',
+                );
+                $expected = array(
+                        'Comma then URL,&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                        'Period then URL.&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                        'Semi-colon then URL;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                        'Colon then URL:&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                        'Exclamation mark then URL!&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                        'Question mark then URL?&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
+                );
+                foreach ($before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($expected[$key], make_clickable($url));
+                }
+        }
+
+        function test_dont_break_attributes() {
+                $urls_before = array(
+                        &quot;&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;&quot;,
+                        &quot;(&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;http://trunk.domain/testing#something (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;http://trunk.domain/testing#something
+                        (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;&lt;span style='text-align:center; display: block;'&gt;&lt;object width='425' height='350'&gt;&lt;param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='wmode' value='opaque' /&gt; &lt;embed src='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'&gt;&lt;/embed&gt; &lt;/object&gt;&lt;/span&gt;&quot;,
+                        '&lt;a href=&quot;http://example.com/example.gif&quot; title=&quot;Image from http://example.com&quot;&gt;Look at this image!&lt;/a&gt;',
+                );
+                $urls_expected = array(
+                        &quot;&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;&quot;,
+                        &quot;(&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;&lt;a href=\&quot;http://trunk.domain/testing#something\&quot; rel=\&quot;nofollow\&quot;&gt;http://trunk.domain/testing#something&lt;/a&gt; (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;&lt;a href=\&quot;http://trunk.domain/testing#something\&quot; rel=\&quot;nofollow\&quot;&gt;http://trunk.domain/testing#something&lt;/a&gt;
+                        (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
+                        &quot;&lt;span style='text-align:center; display: block;'&gt;&lt;object width='425' height='350'&gt;&lt;param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='wmode' value='opaque' /&gt; &lt;embed src='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'&gt;&lt;/embed&gt; &lt;/object&gt;&lt;/span&gt;&quot;,
+                        '&lt;a href=&quot;http://example.com/example.gif&quot; title=&quot;Image from http://example.com&quot;&gt;Look at this image!&lt;/a&gt;',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
+                }
+        }
+
+        /**
+         * @ticket 16892
+         */
+        function test_click_inside_html() {
+                $urls_before = array(
+                        '&lt;span&gt;http://example.com&lt;/span&gt;',
+                        '&lt;p&gt;http://example.com/&lt;/p&gt;',
+                );
+                $urls_expected = array(
+                        '&lt;span&gt;&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;&lt;/span&gt;',
+                        '&lt;p&gt;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;&lt;/p&gt;',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals( $urls_expected[$key], make_clickable( $url ) );
+                }
+        }
+
+        function test_no_links_within_links() {
+                $in = array(
+                        'Some text with a link &lt;a href=&quot;http://example.com&quot;&gt;http://example.com&lt;/a&gt;',
+                        //'&lt;a href=&quot;http://wordpress.org&quot;&gt;This is already a link www.wordpress.org&lt;/a&gt;', // fails in 3.3.1 too
+                );
+                foreach ( $in as $text ) {
+                        $this-&gt;assertEquals( $text, make_clickable( $text ) );
+                }
+        }
+
+        /**
+         * ticket 16892
+         */
+        function test_no_segfault() {
+                if ( version_compare( $GLOBALS['wp_version'], '3.1.1', '&lt;' ) )
+                        $this-&gt;markTestSkipped();
+
+                $in = str_repeat( 'http://example.com/2011/03/18/post-title/', 256 );
+                $out = make_clickable( $in );
+                if ( version_compare( $GLOBALS['wp_version'], '3.4-alpha', '&gt;=' ) )
+                        $this-&gt;assertEquals( $in, $out );
+        }
+
+        /**
+         * @ticket 16859
+         */
+        function test_square_brackets() {
+                $urls_before = array(
+                        'http://example.com/?foo[bar]=baz',
+                        'http://example.com/?baz=bar&amp;foo[bar]=baz',
+                );
+                $urls_expected = array(
+                        '&lt;a href=&quot;http://example.com/?foo%5Bbar%5D=baz&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?foo%5Bbar%5D=baz&lt;/a&gt;',
+                        '&lt;a href=&quot;http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz&lt;/a&gt;',
+                );
+                foreach ($urls_before as $key =&gt; $url) {
+                        $this-&gt;assertEquals( $urls_expected[$key], make_clickable( $url ) );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingRemoveAccentsphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/RemoveAccents.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/RemoveAccents.php                                (rev 0)
+++ trunk/tests/formatting/RemoveAccents.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
+        public function test_remove_accents_simple() {
+                $this-&gt;assertEquals( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
+        }
+
+        /**
+         * @ticket 9591
+         */
+        public function test_remove_accents_latin1_supplement() {
+                $input = 'ªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ';
+                $output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy';
+
+                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
+        }
+
+        public function test_remove_accents_latin_extended_a() {
+                $input = 'ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
+                $output = 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkkLlLlLlLlLlNnNnNnNnNOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
+
+                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
+        }
+
+        public function test_remove_accents_latin_extended_b() {
+                $this-&gt;assertEquals( 'SsTt', remove_accents( 'ȘșȚț' ), 'remove_accents replaces Latin Extended B' );
+        }
+
+        public function test_remove_accents_euro_pound_signs() {
+                $this-&gt;assertEquals( 'E', remove_accents( '€' ), 'remove_accents replaces euro sign' );
+                $this-&gt;assertEquals( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
+        }
+
+        public function test_remove_accents_iso8859() {
+                // File is Latin1 encoded
+                $file = DIR_TESTDATA . DIRECTORY_SEPARATOR . 'formatting' . DIRECTORY_SEPARATOR . 'remove_accents.01.input.txt';
+                $input = file_get_contents( $file );
+                $input = trim( $input );
+                $output = &quot;EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyyOEoeAEDHTHssaedhth&quot;;
+
+                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
+        }
+
+        /**
+         * @ticket 17738
+         */
+        public function test_remove_accents_vowels_diacritic() {
+                // Vowels with diacritic
+                // unmarked
+                $this-&gt;assertEquals( 'OoUu', remove_accents( 'ƠơƯư' ) );
+                // grave accent
+                $this-&gt;assertEquals( 'AaAaEeOoOoUuYy', remove_accents( 'ẦầẰằỀềỒồỜờỪừỲỳ' ) );
+                // hook
+                $this-&gt;assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẢảẨẩẲẳẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ' ) );
+                // tilde
+                $this-&gt;assertEquals( 'AaAaEeEeOoOoUuYy', remove_accents( 'ẪẫẴẵẼẽỄễỖỗỠỡỮữỸỹ' ) );
+                // acute accent
+                $this-&gt;assertEquals( 'AaAaEeOoOoUu', remove_accents( 'ẤấẮắẾếỐốỚớỨứ' ) );
+                // dot below
+                $this-&gt;assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẠạẬậẶặẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ' ) );
+        }
+
+        /**
+         * @ticket 20772
+         */
+        public function test_remove_accents_hanyu_pinyin() {
+                // Vowels with diacritic (Chinese, Hanyu Pinyin)
+                // macron
+                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'āēīōūǖĀĒĪŌŪǕ' ) );
+                // acute accent
+                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'áéíóúǘÁÉÍÓÚǗ' ) );
+                // caron
+                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'ǎěǐǒǔǚǍĚǏǑǓǙ' ) );
+                // grave accent
+                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'àèìòùǜÀÈÌÒÙǛ' ) );
+                // unmarked
+                $this-&gt;assertEquals( 'aaeiouuAEIOUU', remove_accents( 'aɑeiouüAEIOUÜ' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeFileNamephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeFileName.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeFileName.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeFileName.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
+        function test_munges_extensions() {
+                # r17990
+                $file_name = sanitize_file_name( 'test.phtml.txt' );
+                $this-&gt;assertEquals( 'test.phtml_.txt', $file_name );
+        }
+
+        function test_removes_special_chars() {
+                $special_chars = array(&quot;?&quot;, &quot;[&quot;, &quot;]&quot;, &quot;/&quot;, &quot;\\&quot;, &quot;=&quot;, &quot;&lt;&quot;, &quot;&gt;&quot;, &quot;:&quot;, &quot;;&quot;, &quot;,&quot;, &quot;'&quot;, &quot;\&quot;&quot;, &quot;&amp;&quot;, &quot;$&quot;, &quot;#&quot;, &quot;*&quot;, &quot;(&quot;, &quot;)&quot;, &quot;|&quot;, &quot;~&quot;, &quot;`&quot;, &quot;!&quot;, &quot;{&quot;, &quot;}&quot;, chr(0));
+                $string = 'test';
+                foreach ( $special_chars as $char )
+                        $string .= $char;
+                $string .= 'test';
+                $this-&gt;assertEquals( 'testtest', sanitize_file_name( $string ) );
+        }
+
+        function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_file_name(&quot;a----t----t&quot;));
+        }
+
+        function test_trims_trailing_hyphens() {
+                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_file_name(&quot;a----t----t----&quot;));
+        }
+
+        function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_file_name(&quot;a          t&quot;));
+                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_file_name(&quot;a    \n\n\nt&quot;));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeMimeTypephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeMimeType.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeMimeType.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeMimeType.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeMimeType extends WP_UnitTestCase {
+        // 17855
+        function test_sanitize_valid_mime_type() {
+                $inputs = array(
+                        'application/atom+xml',
+                        'application/EDI-X12',
+                        'application/EDIFACT',
+                        'application/json',
+                        'application/javascript',
+                        'application/octet-stream',
+                        'application/ogg',
+                        'application/pdf',
+                        'application/postscript',
+                        'application/soap+xml',
+                        'application/x-woff',
+                        'application/xhtml+xml',
+                        'application/xml-dtd',
+                        'application/xop+xml',
+                        'application/zip',
+                        'application/x-gzip',
+                        'audio/basic',
+                        'image/jpeg',
+                        'text/css',
+                        'text/html',
+                        'text/plain',
+                        'video/mpeg',
+                );
+
+                foreach ( $inputs as $input ) {
+                        $this-&gt;assertEquals($input, sanitize_mime_type($input));
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeOrderbyphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeOrderby.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeOrderby.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeOrderby.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;?php
+
+/* // @todo These tests need to be rewritten for sanitize_sql_orderby
+class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase {
+        function test_empty() {
+                $cols = array('a' =&gt; 'a');
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('  ', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby(&quot;\t&quot;, $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby(null, $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby(0, $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('+', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('-', $cols) );
+        }
+
+        function test_unknown_column() {
+                $cols = array('name' =&gt; 'post_name', 'date' =&gt; 'post_date');
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('unknown_column', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('+unknown_column', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('-unknown_column', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('-unknown1,+unknown2,unknown3', $cols) );
+                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('name,unknown_column', $cols) );
+                $this-&gt;assertEquals( '', sanitize_sql_orderby('!@#$%^&amp;*()_=~`\'&quot;,./', $cols) );
+        }
+
+        function test_valid() {
+                $cols = array('name' =&gt; 'post_name', 'date' =&gt; 'post_date', 'random' =&gt; 'rand()');
+                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('name', $cols) );
+                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('+name', $cols) );
+                $this-&gt;assertEquals( 'post_name DESC', sanitize_sql_orderby('-name', $cols) );
+                $this-&gt;assertEquals( 'post_date ASC, post_name ASC', sanitize_sql_orderby('date,name', $cols) );
+                $this-&gt;assertEquals( 'post_date ASC, post_name ASC', sanitize_sql_orderby(' date , name ', $cols) );
+                $this-&gt;assertEquals( 'post_name DESC, post_date ASC', sanitize_sql_orderby('-name,date', $cols) );
+                $this-&gt;assertEquals( 'post_name ASC, post_date ASC', sanitize_sql_orderby('name ,+ date', $cols) );
+                $this-&gt;assertEquals( 'rand() ASC', sanitize_sql_orderby('random', $cols) );
+        }
+}
+*/
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeTextFieldphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeTextField.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeTextField.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeTextField.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
+        // #11528
+        function test_sanitize_text_field() {
+                $inputs = array(
+                        'оРангутанг', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
+                        'САПР', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
+                        'one is &lt; two',
+                        'tags &lt;span&gt;are&lt;/span&gt; &lt;em&gt;not allowed&lt;/em&gt; here',
+                        ' we should trim leading and trailing whitespace ',
+                        'we  also  trim  extra  internal  whitespace',
+                        'tabs         get removed too',
+                        'newlines are not welcome
+                        here',
+                        'We also %AB remove %ab octets',
+                        'We don\'t need to wory about %A
+                        B removing %a
+                        b octets even when %a        B they are obscured by whitespace',
+                        '%AB%BC%DE', //Just octets
+                        'Invalid octects remain %II',
+                        'Nested octects %%%ABABAB %A%A%ABBB',
+                );
+                $expected = array(
+                        'оРангутанг',
+                        'САПР',
+                        'one is &amp;lt; two',
+                        'tags are not allowed here',
+                        'we should trim leading and trailing whitespace',
+                        'we also trim extra internal whitespace',
+                        'tabs get removed too',
+                        'newlines are not welcome here',
+                        'We also remove octets',
+                        'We don\'t need to wory about %A B removing %a b octets even when %a B they are obscured by whitespace',
+                        '', //Emtpy as we strip all the octets out
+                        'Invalid octects remain %II',
+                        'Nested octects',
+                );
+
+                foreach ($inputs as $key =&gt; $input) {
+                        $this-&gt;assertEquals($expected[$key], sanitize_text_field($input));
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeTitlephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeTitle.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeTitle.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeTitle.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase {
+        function test_strips_html() {
+                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
+                $expected = &quot;captain-awesome&quot;;
+                $this-&gt;assertEquals($expected, sanitize_title($input));
+        }
+
+        function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
+                $input = &quot;&lt;strong&gt;&lt;/strong&gt;&quot;;
+                $fallback = &quot;Captain Awesome&quot;;
+                $this-&gt;assertEquals($fallback, sanitize_title($input, $fallback));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeTitleWithDashesphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeTitleWithDashes.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeTitleWithDashes.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeTitleWithDashes.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
+        function test_strips_html() {
+                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
+                $expected = &quot;captain-awesome&quot;;
+                $this-&gt;assertEquals($expected, sanitize_title($input));
+        }
+
+        function test_strips_unencoded_percent_signs() {
+                $this-&gt;assertEquals(&quot;fran%c3%a7ois&quot;, sanitize_title_with_dashes(&quot;fran%c3%a7%ois&quot;));
+        }
+
+        function test_makes_title_lowercase() {
+                $this-&gt;assertEquals(&quot;abc&quot;, sanitize_title_with_dashes(&quot;ABC&quot;));
+        }
+
+        function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_title_with_dashes(&quot;a          t&quot;));
+                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_title_with_dashes(&quot;a    \n\n\nt&quot;));
+        }
+
+        function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_title_with_dashes(&quot;a----t----t&quot;));
+        }
+
+        function test_trims_trailing_hyphens() {
+                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_title_with_dashes(&quot;a----t----t----&quot;));
+        }
+
+        function test_handles_non_entity_ampersands() {
+                $this-&gt;assertEquals(&quot;penn-teller-bull&quot;, sanitize_title_with_dashes(&quot;penn &amp; teller bull&quot;));
+        }
+
+        /**
+         * @ticket 10823
+         */
+        function test_strips_entities() {
+                $this-&gt;assertEquals(&quot;no-entities-here&quot;, sanitize_title_with_dashes(&quot;No &amp;nbsp; Entities &amp;ndash; Here &amp;amp;&quot;));
+                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;amp; Two&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;#123; Two;&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp; Two;&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One Two™;&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;&amp;amp; Two;&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;onetwo&quot;, sanitize_title_with_dashes(&quot;One&amp;Two&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;onetwo-test&quot;, sanitize_title_with_dashes(&quot;One&amp;Two Test;&quot;, '', 'save'));
+        }
+
+        function test_replaces_nbsp() {
+                $this-&gt;assertEquals(&quot;dont-break-the-space&quot;, sanitize_title_with_dashes(&quot;don't break the space&quot;, '', 'save'));
+        }
+
+        function test_replaces_ndash_mdash() {
+                $this-&gt;assertEquals(&quot;do-the-dash&quot;, sanitize_title_with_dashes(&quot;Do – the Dash&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;do-the-dash&quot;, sanitize_title_with_dashes(&quot;Do the — Dash&quot;, '', 'save'));
+        }
+
+        function test_replaces_iexcel_iquest() {
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just ¡a Slug&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just a Slug¿&quot;, '', 'save'));
+        }
+
+        function test_replaces_angle_quotes() {
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;‹Just a Slug›&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;«Just a Slug»&quot;, '', 'save'));
+        }
+
+        function test_replaces_curly_quotes() {
+                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its “Curly Joe”&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its ‘Curly Joe’&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its „Curly Joe“&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its ‚Curly Joe‛&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its „Curly Joe‟&quot;, '', 'save'));
+        }
+
+        function test_replaces_copy_reg_deg_trade() {
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just © a Slug&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;® Just a Slug&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just a ° Slug&quot;, '', 'save'));
+                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just ™ a Slug&quot;, '', 'save'));
+        }
+
+        /**
+         * @ticket 19820
+         */
+        function test_replaces_multiply_sign() {
+                $this-&gt;assertEquals(&quot;6x7-is-42&quot;, sanitize_title_with_dashes(&quot;6×7 is 42&quot;, '', 'save'));
+        }
+
+        /**
+         * @ticket 20772
+         */
+        function test_replaces_standalone_diacritic() {
+                $this-&gt;assertEquals(&quot;aaaa&quot;, sanitize_title_with_dashes(&quot;āáǎà&quot;, '', 'save'));
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsformattingSanitizeUserphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/SanitizeUser.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/SanitizeUser.php                                (rev 0)
+++ trunk/tests/formatting/SanitizeUser.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
+        function test_strips_html() {
+                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
+                $expected = is_multisite() ? 'captain awesome' : 'Captain Awesome';
+                $this-&gt;assertEquals($expected, sanitize_user($input));
+        }
+        /**
+         * @ticket 10823
+         */
+        function test_strips_entities() {
+                $this-&gt;assertEquals(&quot;ATT&quot;, sanitize_user(&quot;AT&amp;amp;T&quot;));
+                $this-&gt;assertEquals(&quot;ATT Test;&quot;, sanitize_user(&quot;AT&amp;amp;T Test;&quot;));
+                $this-&gt;assertEquals(&quot;AT&amp;T Test;&quot;, sanitize_user(&quot;AT&amp;T Test;&quot;));
+        }
+        function test_strips_percent_encoded_octets() {
+                $expected = is_multisite() ? 'franois' : 'Franois';
+                $this-&gt;assertEquals( $expected, sanitize_user( &quot;Fran%c3%a7ois&quot; ) );
+        }
+        function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
+                $this-&gt;assertEquals(&quot;abc&quot;, sanitize_user(&quot;()~ab~ˆcˆ!&quot;, true));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSlashitphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/Slashit.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/Slashit.php                                (rev 0)
+++ trunk/tests/formatting/Slashit.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Slashit extends WP_UnitTestCase {
+        function test_backslashes_alphas() {
+                $this-&gt;assertEquals(&quot;\\a943\\b\\c&quot;, backslashit(&quot;a943bc&quot;));
+        }
+
+        function test_double_backslashes_leading_numbers() {
+                $this-&gt;assertEquals(&quot;\\\\95&quot;, backslashit(&quot;95&quot;));
+        }
+
+        function test_removes_trailing_slashes() {
+                $this-&gt;assertEquals(&quot;a&quot;, untrailingslashit(&quot;a/&quot;));
+                $this-&gt;assertEquals(&quot;a&quot;, untrailingslashit(&quot;a////&quot;));
+        }
+
+        function test_adds_trailing_slash() {
+                $this-&gt;assertEquals(&quot;a/&quot;, trailingslashit(&quot;a&quot;));
+        }
+
+        function test_does_not_add_trailing_slash_if_one_exists() {
+                $this-&gt;assertEquals(&quot;a/&quot;, trailingslashit(&quot;a/&quot;));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingSmiliesphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/Smilies.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/Smilies.php                                (rev 0)
+++ trunk/tests/formatting/Smilies.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Smilies extends WP_UnitTestCase {
+
+        function test_convert_smilies() {
+                global $wpsmiliestrans;
+                $includes_path = includes_url(&quot;images/smilies/&quot;);
+
+                // standard smilies, use_smilies: ON
+                update_option( 'use_smilies', 1 );
+
+                smilies_init();
+
+                $inputs = array(
+                                                'Lorem ipsum dolor sit amet mauris ;-) Praesent gravida sodales. :lol: Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, :eek: mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, :mrgreen: tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus :?:',
+                                                '&lt;strong&gt;Welcome to the jungle!&lt;/strong&gt; We got fun n games! :) We got everything you want 8-) &lt;em&gt;Honey we know the names :)&lt;/em&gt;',
+                                                &quot;&lt;strong;)&gt;a little bit of this\na little bit:other: of that :D\n:D a little bit of good\nyeah with a little bit of bad8O&quot;,
+                                                '&lt;strong style=&quot;here comes the sun :-D&quot;&gt;and I say it\'s allright:D:D',
+                                                '&lt;!-- Woo-hoo, I\'m a comment, baby! :x &gt; --&gt;',
+                                                ':?:P:?::-x:mrgreen:::', /*
+                                                'the question is, &lt;textarea&gt;Should smilies be converted in textareas :?:&lt;/textarea&gt;',
+                                                'the question is, &lt;code&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
+                                                'the question is, &lt;code style=&quot;color:#fff&quot;&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
+                                                'the question is, &lt;code&gt;Should smilies be converted in invalid code or pre tags :?:&lt;/pre&gt;',
+                                                '&lt;Am I greedy?&gt;Yes I am :)&gt; :) The world makes me :mad:' */
+                                                );
+
+                $outputs = array(
+                                                'Lorem ipsum dolor sit amet mauris &lt;img src=\''.$includes_path.'icon_wink.gif\' alt=\';-)\' class=\'wp-smiley\' /&gt;  Praesent gravida sodales. &lt;img src=\''.$includes_path.'icon_lol.gif\' alt=\':lol:\' class=\'wp-smiley\' /&gt;  Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, &lt;img src=\''.$includes_path.'icon_surprised.gif\' alt=\':eek:\' class=\'wp-smiley\' /&gt;  mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, &lt;img src=\''.$includes_path.'icon_mrgreen.gif\' alt=\':mrgreen:\' class=\'wp-smiley\' /&gt;  tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus &lt;img src=\''.$i
 ncludes_path.'icon_question.gif\' alt=\':?:\' class=\'wp-smiley\' /&gt; ',
+                                                '&lt;strong&gt;Welcome to the jungle!&lt;/strong&gt; We got fun n games! &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt;  We got everything you want &lt;img src=\''.$includes_path.'icon_cool.gif\' alt=\'8-)\' class=\'wp-smiley\' /&gt; &lt;em&gt;Honey we know the names &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt; &lt;/em&gt;',
+                                                &quot;&lt;strong;)&gt;a little bit of this\na little bit:other: of that &lt;img src='{$includes_path}icon_biggrin.gif' alt=':D' class='wp-smiley' /&gt;  &lt;img src='{$includes_path}icon_biggrin.gif' alt=':D' class='wp-smiley' /&gt;  a little bit of good\nyeah with a little bit of bad8O&quot;,
+                                                '&lt;strong style=&quot;here comes the sun :-D&quot;&gt;and I say it\'s allright:D:D',
+                                                '&lt;!-- Woo-hoo, I\'m a comment, baby! :x &gt; --&gt;',
+                                                ' &lt;img src=\''.$includes_path.'icon_question.gif\' alt=\':?:\' class=\'wp-smiley\' /&gt; P:?::-x:mrgreen:::', /*
+                                                'the question is, &lt;textarea&gt;Should smilies be converted in textareas :?:&lt;/textarea&gt;',
+                                                'the question is, &lt;code&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
+                                                'the question is, &lt;code style=&quot;color:#fff&quot;&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
+                                                'the question is, &lt;code&gt;Should smilies be converted in invalid code or pre tags :?:&lt;/pre&gt;',
+                                                '&lt;Am I greedy?&gt;Yes I am &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt; &gt; &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt;  The world makes me &lt;img src=\'http://wp-test.php/wp-includes/images/smilies/icon_mad.gif\' alt=\':mad:\' class=\'wp-smiley\' /&gt;' */
+                                                );
+
+                foreach ( $inputs as $k =&gt; $input ) {
+                        $this-&gt;assertEquals( $outputs[$k], convert_smilies($input) );
+                }
+
+                update_option( 'use_smilies', 0 );
+
+                // standard smilies, use_smilies: OFF
+
+                foreach ( $inputs as $input ) {
+                        $this-&gt;assertEquals( $input, convert_smilies($input) );
+                }
+
+                return;
+
+                // custom smilies, use_smilies: ON
+                update_option( 'use_smilies', 1 );
+                $wpsmiliestrans = array(
+                  ':PP' =&gt; 'icon_tongue.gif',
+                  ':arrow:' =&gt; 'icon_arrow.gif',
+                  ':monkey:' =&gt; 'icon_shock_the_monkey.gif',
+                  ':nervou:' =&gt; 'icon_nervou.gif'
+                );
+
+                smilies_init();
+
+                $inputs = array('Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. :monkey:',
+                                                'Star Wars Jedi Knight:arrow: Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. :nervou:',
+                                                ':arrow:monkey:Lorem ipsum dolor sit amet enim. Etiam ullam:PP&lt;br /&gt;corper. Suspendisse a pellentesque dui, non felis.&lt;a&gt;:arrow::arrow&lt;/a&gt;'
+                                                );
+
+                $outputs = array('Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. &lt;img src=\''.$includes_path.'icon_shock_the_monkey.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;',
+                                                'Star Wars Jedi Knight&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt; Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. &lt;img src=\''.$includes_path.'icon_nervou.gif\' alt=\'icon_nervou\' class=\'wp-smiley\' /&gt;',
+                                                '&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;monkey:Lorem ipsum dolor sit amet enim. Etiam ullam&lt;img src=\''.$includes_path.'icon_tongue.gif\' alt=\'icon_tongue\' class=\'wp-smiley\' /&gt;&lt;br /&gt;corper. Suspendisse a pellentesque dui, non felis.&lt;a&gt;&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;:arrow&lt;/a&gt;'
+                                                );
+
+                foreach ( $inputs as $k =&gt; $input ) {
+                        $this-&gt;assertEquals( $outputs[$k], convert_smilies($input) );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingStripSlashesDeepphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/StripSlashesDeep.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/StripSlashesDeep.php                                (rev 0)
+++ trunk/tests/formatting/StripSlashesDeep.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
+        /**
+         * @ticket 18026
+         */
+        function test_preserves_original_datatype() {
+
+                $this-&gt;assertEquals( true, stripslashes_deep( true ) );
+                $this-&gt;assertEquals( false, stripslashes_deep( false ) );
+                $this-&gt;assertEquals( 4, stripslashes_deep( 4 ) );
+                $this-&gt;assertEquals( 'foo', stripslashes_deep( 'foo' ) );
+                $arr = array( 'a' =&gt; true, 'b' =&gt; false, 'c' =&gt; 4, 'd' =&gt; 'foo' );
+                $arr['e'] = $arr; // Add a sub-array
+                $this-&gt;assertEquals( $arr, stripslashes_deep( $arr ) ); // Keyed array
+                $this-&gt;assertEquals( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed
+
+                $obj = new stdClass;
+                foreach ( $arr as $k =&gt; $v )
+                        $obj-&gt;$k = $v;
+                $this-&gt;assertEquals( $obj, stripslashes_deep( $obj ) );
+        }
+
+        function test_strips_slashes() {
+                $old = &quot;I can\'t see, isn\'t that it?&quot;;
+                $new = &quot;I can't see, isn't that it?&quot;;
+                $this-&gt;assertEquals( $new, stripslashes_deep( $old ) );
+                $this-&gt;assertEquals( $new, stripslashes_deep( &quot;I can\\'t see, isn\\'t that it?&quot; ) );
+                $this-&gt;assertEquals( array( 'a' =&gt; $new ), stripslashes_deep( array( 'a' =&gt; $old ) ) ); // Keyed array
+                $this-&gt;assertEquals( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed
+
+                $obj_old = new stdClass;
+                $obj_old-&gt;a = $old;
+                $obj_new = new stdClass;
+                $obj_new-&gt;a = $new;
+                $this-&gt;assertEquals( $obj_new, stripslashes_deep( $obj_old ) );
+        }
+
+        function test_permits_escaped_slash() {
+                $txt = &quot;I can't see, isn\'t that it?&quot;;
+                $this-&gt;assertEquals( $txt, stripslashes_deep( &quot;I can\'t see, isn\\\'t that it?&quot; ) );
+                $this-&gt;assertEquals( $txt, stripslashes_deep( &quot;I can\'t see, isn\\\\\'t that it?&quot; ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingWPSpecialcharsphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/WPSpecialchars.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/WPSpecialchars.php                                (rev 0)
+++ trunk/tests/formatting/WPSpecialchars.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
+        function test_wp_specialchars_basics() {
+                $html =  &quot;&amp;amp;&amp;lt;hello world&amp;gt;&quot;;
+                $this-&gt;assertEquals( $html, _wp_specialchars( $html ) );
+
+                $double = &quot;&amp;amp;amp;&amp;amp;lt;hello world&amp;amp;gt;&quot;;
+                $this-&gt;assertEquals( $double, _wp_specialchars( $html, ENT_NOQUOTES, false, true ) );
+        }
+
+        function test_allowed_entity_names() {
+                global $allowedentitynames;
+
+                // Allowed entities should be unchanged
+                foreach ( $allowedentitynames as $ent ) {
+                        $ent = '&amp;' . $ent . ';';
+                        $this-&gt;assertEquals( $ent, _wp_specialchars( $ent ) );
+                }
+        }
+
+        function test_not_allowed_entity_names() {
+                $ents = array( 'iacut', 'aposs', 'pos', 'apo', 'apo?', 'apo.*', '.*apo.*', 'apos ', ' apos', ' apos ' );
+
+                foreach ( $ents as $ent ) {
+                        $escaped = '&amp;amp;' . $ent . ';';
+                        $ent = '&amp;' . $ent . ';';
+                        $this-&gt;assertEquals( $escaped, _wp_specialchars( $ent ) );
+                }
+        }
+
+        function test_optionally_escapes_quotes() {
+                $source = &quot;\&quot;'hello!'\&quot;&quot;;
+                $this-&gt;assertEquals( '&quot;&amp;#039;hello!&amp;#039;&quot;', _wp_specialchars($source, 'single') );
+                $this-&gt;assertEquals( &quot;&amp;quot;'hello!'&amp;quot;&quot;, _wp_specialchars($source, 'double') );
+                $this-&gt;assertEquals( '&amp;quot;&amp;#039;hello!&amp;#039;&amp;quot;', _wp_specialchars($source, true) );
+                $this-&gt;assertEquals( $source, _wp_specialchars($source) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingWPTexturizephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/WPTexturize.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/WPTexturize.php                                (rev 0)
+++ trunk/tests/formatting/WPTexturize.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,175 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
+        function test_dashes() {
+                $this-&gt;assertEquals('Hey &amp;#8212; boo?', wptexturize('Hey -- boo?'));
+                $this-&gt;assertEquals('&lt;a href=&quot;http://xx--xx&quot;&gt;Hey &amp;#8212; boo?&lt;/a&gt;', wptexturize('&lt;a href=&quot;http://xx--xx&quot;&gt;Hey -- boo?&lt;/a&gt;'));
+        }
+
+        function test_disable() {
+                $this-&gt;assertEquals('&lt;pre&gt;---&lt;/pre&gt;', wptexturize('&lt;pre&gt;---&lt;/pre&gt;'));
+                $this-&gt;assertEquals('[a]a&amp;#8211;b[code]---[/code]a&amp;#8211;b[/a]', wptexturize('[a]a--b[code]---[/code]a--b[/a]'));
+                $this-&gt;assertEquals('&lt;pre&gt;&lt;code&gt;&lt;/code&gt;--&lt;/pre&gt;', wptexturize('&lt;pre&gt;&lt;code&gt;&lt;/code&gt;--&lt;/pre&gt;'));
+
+                $this-&gt;assertEquals('&lt;code&gt;---&lt;/code&gt;', wptexturize('&lt;code&gt;---&lt;/code&gt;'));
+
+                $this-&gt;assertEquals('&lt;code&gt;href=&quot;baba&quot;&lt;/code&gt; &amp;#8220;baba&amp;#8221;', wptexturize('&lt;code&gt;href=&quot;baba&quot;&lt;/code&gt; &quot;baba&quot;'));
+
+                $enabled_tags_inside_code = '&lt;code&gt;curl -s &lt;a href=&quot;http://x/&quot;&gt;baba&lt;/a&gt; | grep sfive | cut -d &quot;\&quot;&quot; -f 10 &amp;gt; topmp3.txt&lt;/code&gt;';
+                $this-&gt;assertEquals($enabled_tags_inside_code, wptexturize($enabled_tags_inside_code));
+
+                $double_nest = '&lt;pre&gt;&quot;baba&quot;&lt;code&gt;&quot;baba&quot;&lt;pre&gt;&lt;/pre&gt;&lt;/code&gt;&quot;baba&quot;&lt;/pre&gt;';
+                $this-&gt;assertEquals($double_nest, wptexturize($double_nest));
+
+                $invalid_nest = '&lt;pre&gt;&lt;/code&gt;&quot;baba&quot;&lt;/pre&gt;';
+                $this-&gt;assertEquals($invalid_nest, wptexturize($invalid_nest));
+
+        }
+
+        //WP Ticket #1418
+        function test_bracketed_quotes_1418() {
+                $this-&gt;assertEquals('(&amp;#8220;test&amp;#8221;)', wptexturize('(&quot;test&quot;)'));
+                $this-&gt;assertEquals('(&amp;#8216;test&amp;#8217;)', wptexturize(&quot;('test')&quot;));
+                $this-&gt;assertEquals('(&amp;#8217;twas)', wptexturize(&quot;('twas)&quot;));
+        }
+
+        //WP Ticket #3810
+        function test_bracketed_quotes_3810() {
+                $this-&gt;assertEquals('A dog (&amp;#8220;Hubertus&amp;#8221;) was sent out.', wptexturize('A dog (&quot;Hubertus&quot;) was sent out.'));
+        }
+
+        //WP Ticket #4539
+        function test_basic_quotes() {
+                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize('test\'s'));
+                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize('test\'s'));
+
+                $this-&gt;assertEquals('&amp;#8216;quoted&amp;#8217;', wptexturize('\'quoted\''));
+                $this-&gt;assertEquals('&amp;#8220;quoted&amp;#8221;', wptexturize('&quot;quoted&quot;'));
+
+                $this-&gt;assertEquals('space before &amp;#8216;quoted&amp;#8217; space after', wptexturize('space before \'quoted\' space after'));
+                $this-&gt;assertEquals('space before &amp;#8220;quoted&amp;#8221; space after', wptexturize('space before &quot;quoted&quot; space after'));
+
+                $this-&gt;assertEquals('(&amp;#8216;quoted&amp;#8217;)', wptexturize('(\'quoted\')'));
+                $this-&gt;assertEquals('{&amp;#8220;quoted&amp;#8221;}', wptexturize('{&quot;quoted&quot;}'));
+
+                $this-&gt;assertEquals('&amp;#8216;qu(ot)ed&amp;#8217;', wptexturize('\'qu(ot)ed\''));
+                $this-&gt;assertEquals('&amp;#8220;qu{ot}ed&amp;#8221;', wptexturize('&quot;qu{ot}ed&quot;'));
+
+                $this-&gt;assertEquals(' &amp;#8216;test&amp;#8217;s quoted&amp;#8217; ', wptexturize(' \'test\'s quoted\' '));
+                $this-&gt;assertEquals(' &amp;#8220;test&amp;#8217;s quoted&amp;#8221; ', wptexturize(' &quot;test\'s quoted&quot; '));
+        }
+
+        /**
+         * @ticket 4539
+         * @ticket 15241
+         */
+        function test_full_sentences_with_unmatched_single_quotes() {
+                $this-&gt;assertEquals(
+                        'That means every moment you&amp;#8217;re working on something without it being in the public it&amp;#8217;s actually dying.',
+                        wptexturize(&quot;That means every moment you're working on something without it being in the public it's actually dying.&quot;)
+                );
+        }
+
+        /**
+         * @ticket 4539
+         */
+        function test_quotes() {
+                $this-&gt;assertEquals('&amp;#8220;Quoted String&amp;#8221;', wptexturize('&quot;Quoted String&quot;'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link and a period&lt;/a&gt;&amp;#8221;.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link and a period&lt;/a&gt;&quot;.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221; and a space.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot; and a space.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt; and some text quoted&amp;#8221;', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt; and some text quoted&quot;'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;, and a comma.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;, and a comma.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;; and a semi-colon.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;; and a semi-colon.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;- and a dash.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;- and a dash.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;&amp;#8230; and ellipses.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;... and ellipses.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;a test &lt;a href=&quot;http://example.com&quot;&gt;with a link&lt;/a&gt;&amp;#8221;.', wptexturize('Here is &quot;a test &lt;a href=&quot;http://example.com&quot;&gt;with a link&lt;/a&gt;&quot;.'));
+                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;and a work stuck to the end.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;and a work stuck to the end.'));
+                $this-&gt;assertEquals('A test with a finishing number, &amp;#8220;like 23&amp;#8221;.', wptexturize('A test with a finishing number, &quot;like 23&quot;.'));
+                $this-&gt;assertEquals('A test with a number, &amp;#8220;like 62&amp;#8221;, is nice to have.', wptexturize('A test with a number, &quot;like 62&quot;, is nice to have.'));
+        }
+
+        /**
+         * @ticket 4539
+         */
+        function test_quotes_before_s() {
+                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize(&quot;test's&quot;));
+                $this-&gt;assertEquals('&amp;#8216;test&amp;#8217;s', wptexturize(&quot;'test's&quot;));
+                $this-&gt;assertEquals('&amp;#8216;test&amp;#8217;s&amp;#8217;', wptexturize(&quot;'test's'&quot;));
+                $this-&gt;assertEquals('&amp;#8216;string&amp;#8217;', wptexturize(&quot;'string'&quot;));
+                $this-&gt;assertEquals('&amp;#8216;string&amp;#8217;s&amp;#8217;', wptexturize(&quot;'string's'&quot;));
+        }
+
+        /**
+         * @ticket 4539
+         */
+        function test_quotes_before_numbers() {
+                $this-&gt;assertEquals('Class of &amp;#8217;99', wptexturize(&quot;Class of '99&quot;));
+                $this-&gt;assertEquals('Class of &amp;#8217;99&amp;#8217;s', wptexturize(&quot;Class of '99's&quot;));
+                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;', wptexturize(&quot;'Class of '99'&quot;));
+                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;s&amp;#8217;', wptexturize(&quot;'Class of '99's'&quot;));
+                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;s&amp;#8217;', wptexturize(&quot;'Class of '99&amp;#8217;s'&quot;));
+                $this-&gt;assertEquals('&amp;#8220;Class of 99&amp;#8221;', wptexturize(&quot;\&quot;Class of 99\&quot;&quot;));
+                $this-&gt;assertEquals('&amp;#8220;Class of &amp;#8217;99&amp;#8221;', wptexturize(&quot;\&quot;Class of '99\&quot;&quot;));
+        }
+
+        function test_quotes_after_numbers() {
+                $this-&gt;assertEquals('Class of &amp;#8217;99', wptexturize(&quot;Class of '99&quot;));
+        }
+
+        /**
+         * @ticket 4539
+         * @ticket 15241
+         */
+        function test_other_html() {
+                $this-&gt;assertEquals('&amp;#8216;&lt;strong&gt;', wptexturize(&quot;'&lt;strong&gt;&quot;));
+                $this-&gt;assertEquals('&amp;#8216;&lt;strong&gt;Quoted Text&lt;/strong&gt;&amp;#8217;,', wptexturize(&quot;'&lt;strong&gt;Quoted Text&lt;/strong&gt;',&quot;));
+                $this-&gt;assertEquals('&amp;#8220;&lt;strong&gt;Quoted Text&lt;/strong&gt;&amp;#8221;,', wptexturize('&quot;&lt;strong&gt;Quoted Text&lt;/strong&gt;&quot;,'));
+        }
+
+        function test_x() {
+                $this-&gt;assertEquals('14&amp;#215;24', wptexturize(&quot;14x24&quot;));
+        }
+
+        function test_minutes_seconds() {
+                $this-&gt;assertEquals('9&amp;#8242;', wptexturize('9\''));
+                $this-&gt;assertEquals('9&amp;#8243;', wptexturize(&quot;9\&quot;&quot;));
+
+                $this-&gt;assertEquals('a 9&amp;#8242; b', wptexturize('a 9\' b'));
+                $this-&gt;assertEquals('a 9&amp;#8243; b', wptexturize(&quot;a 9\&quot; b&quot;));
+
+                $this-&gt;assertEquals('&amp;#8220;a 9&amp;#8242; b&amp;#8221;', wptexturize('&quot;a 9\' b&quot;'));
+                $this-&gt;assertEquals('&amp;#8216;a 9&amp;#8243; b&amp;#8217;', wptexturize(&quot;'a 9\&quot; b'&quot;));
+        }
+
+        /**
+         * @ticket 8775
+         */
+        function test_wptexturize_quotes_around_numbers() {
+                $this-&gt;assertEquals('&amp;#8220;12345&amp;#8221;', wptexturize('&quot;12345&quot;'));
+                $this-&gt;assertEquals('&amp;#8216;12345&amp;#8217;', wptexturize('\'12345\''));
+                $this-&gt;assertEquals('&amp;#8220;a 9&amp;#8242; plus a &amp;#8216;9&amp;#8217;, maybe a 9&amp;#8242; &amp;#8216;9&amp;#8217; &amp;#8221;', wptexturize('&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;'));
+                $this-&gt;assertEquals('&lt;p&gt;&amp;#8216;99&lt;br /&gt;&amp;#8216;123&amp;#8217;&lt;br /&gt;&amp;#8217;tis&lt;br /&gt;&amp;#8216;s&amp;#8217;&lt;/p&gt;', wptexturize('&lt;p&gt;\'99&lt;br /&gt;\'123\'&lt;br /&gt;\'tis&lt;br /&gt;\'s\'&lt;/p&gt;'));
+        }
+
+        /**
+         * @ticket 8912
+         */
+        function test_wptexturize_html_comments() {
+                $this-&gt;assertEquals('&lt;!--[if !IE]&gt;--&gt;&lt;!--&lt;![endif]--&gt;', wptexturize('&lt;!--[if !IE]&gt;--&gt;&lt;!--&lt;![endif]--&gt;'));
+                $this-&gt;assertEquals('&lt;!--[if !IE]&gt;&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;&lt;![endif]--&gt;', wptexturize('&lt;!--[if !IE]&gt;&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;&lt;![endif]--&gt;'));
+                $this-&gt;assertEquals('&lt;ul&gt;&lt;li&gt;Hello.&lt;/li&gt;&lt;!--&lt;li&gt;Goodbye.&lt;/li&gt;--&gt;&lt;/ul&gt;', wptexturize('&lt;ul&gt;&lt;li&gt;Hello.&lt;/li&gt;&lt;!--&lt;li&gt;Goodbye.&lt;/li&gt;--&gt;&lt;/ul&gt;'));
+        }
+
+        /**
+         * @ticket 4539
+         * @ticket 15241
+         */
+        function test_entity_quote_cuddling() {
+                $this-&gt;assertEquals('&amp;nbsp;&amp;#8220;Testing&amp;#8221;', wptexturize('&amp;nbsp;&quot;Testing&quot;'));
+                $this-&gt;assertEquals('&amp;#38;&amp;#8220;Testing&amp;#8221;', wptexturize('&amp;#38;&quot;Testing&quot;'));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingWPTrimWordsphpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/WPTrimWords.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/WPTrimWords.php                                (rev 0)
+++ trunk/tests/formatting/WPTrimWords.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
+        private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit mollis viverra. Pellentesque id urna euismod dolor cursus sagittis.';
+
+        function test_trims_to_55_by_default() {
+                $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit&amp;hellip;';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text ) );
+        }
+
+        function test_trims_to_10() {
+                $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius&amp;hellip;';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text, 10 ) );
+        }
+
+        function test_trims_to_5_and_uses_custom_more() {
+                $trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text, 5, '[...] Read on!' ) );
+        }
+
+        function test_strips_tags_before_trimming() {
+                $text = 'This text contains a &lt;a href=&quot;http://wordpress.org&quot;&gt; link &lt;/a&gt; to WordPress.org!';
+                $trimmed = 'This text contains a link&amp;hellip;';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text, 5 ) );
+        }
+
+        // #18726
+        function test_strips_script_and_style_content() {
+                $trimmed = 'This text contains. It should go.';
+
+                $text = 'This text contains&lt;script&gt;alert(&quot; Javascript&quot;);&lt;/script&gt;. It should go.';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text ) );
+
+                $text = 'This text contains&lt;style&gt;#css { width:expression(alert(&quot;css&quot;)) }&lt;/style&gt;. It should go.';
+                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text ) );
+        }
+
+        function test_doesnt_trim_short_text() {
+                $text = 'This is some short text.';
+                $this-&gt;assertEquals( $text, wp_trim_words( $text ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingZeroisephpfromrev903trunkteststest_includes_formattingphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/Zeroise.php (from rev 903, trunk/tests/test_includes_formatting.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/Zeroise.php                                (rev 0)
+++ trunk/tests/formatting/Zeroise.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Zeroise extends WP_UnitTestCase {
+        function test_pads_with_leading_zeroes() {
+                $this-&gt;assertEquals(&quot;00005&quot;, zeroise(5, 5));
+        }
+
+        function test_does_nothing_if_input_is_already_longer() {
+                $this-&gt;assertEquals(&quot;5000000&quot;, zeroise(5000000, 2));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsformattingredirectphpfromrev904trunkteststest_includes_pluggablephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/formatting/redirect.php (from rev 904, trunk/tests/test_includes_pluggable.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/formatting/redirect.php                                (rev 0)
+++ trunk/tests/formatting/redirect.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+&lt;?php
+
+/**
+ * @group pluggable
+ * @group formatting
+ */
+class Tests_Formatting_Redirect extends WP_UnitTestCase {
+        function test_wp_sanitize_redirect() {
+                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0Ago'));
+                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo'));
+                //Nesting checks
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo'));
+                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
+        }
+}
</ins></span></pre></div>
<a id="trunktestsfunctionslistFilterphpfromrev903trunkteststest_includes_functionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/functions/listFilter.php (from rev 903, trunk/tests/test_includes_functions.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/functions/listFilter.php                                (rev 0)
+++ trunk/tests/functions/listFilter.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,112 @@
</span><ins>+&lt;?php
+
+/**
+ * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck().
+ *
+ * @group functions.php
+ */
+class Tests_Functions_ListFilter extends WP_UnitTestCase {
+        var $object_list = array();
+        var $array_list = array();
+
+        function setUp() {
+                $this-&gt;array_list['foo'] = array( 'name' =&gt; 'foo', 'field1' =&gt; true, 'field2' =&gt; true, 'field3' =&gt; true, 'field4' =&gt; array( 'red' ) );
+                $this-&gt;array_list['bar'] = array( 'name' =&gt; 'bar', 'field1' =&gt; true, 'field2' =&gt; true, 'field3' =&gt; false, 'field4' =&gt; array( 'green' ) );
+                $this-&gt;array_list['baz'] = array( 'name' =&gt; 'baz', 'field1' =&gt; true, 'field2' =&gt; false, 'field3' =&gt; false, 'field4' =&gt; array( 'blue' ) );
+                foreach ( $this-&gt;array_list as $key =&gt; $value ) {
+                        $this-&gt;object_list[ $key ] = (object) $value;
+                }
+        }
+
+        function test_filter_object_list_and() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'AND' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'foo', $list );
+                $this-&gt;assertArrayHasKey( 'bar', $list );
+        }
+
+        function test_filter_object_list_or() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'OR' );
+                $this-&gt;assertEquals( 3, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'foo', $list );
+                $this-&gt;assertArrayHasKey( 'bar', $list );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+        function test_filter_object_list_not() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'NOT' );
+                $this-&gt;assertEquals( 1, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+        function test_filter_object_list_and_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'AND', 'name' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar' ) , $list );
+        }
+
+        function test_filter_object_list_or_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'OR', 'name' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar' ) , $list );
+        }
+
+        function test_filter_object_list_not_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'NOT', 'name' );
+                $this-&gt;assertEquals( 1, count( $list ) );
+                $this-&gt;assertEquals( array( 'baz' =&gt; 'baz' ) , $list );
+        }
+
+        function test_wp_list_pluck() {
+                $list = wp_list_pluck( $this-&gt;object_list, 'name' );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar', 'baz' =&gt; 'baz' ) , $list );
+
+                $list = wp_list_pluck( $this-&gt;array_list, 'name' );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar', 'baz' =&gt; 'baz' ) , $list );
+        }
+
+        function test_filter_object_list_nested_array_and() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'AND' );
+                $this-&gt;assertEquals( 1, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+        function test_filter_object_list_nested_array_not() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'red' ) ), 'NOT' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'bar', $list );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+        function test_filter_object_list_nested_array_or() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field3' =&gt; true, 'field4' =&gt; array( 'blue' ) ), 'OR' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'foo', $list );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+        function test_filter_object_list_nested_array_or_singular() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'OR' );
+                $this-&gt;assertEquals( 1, count( $list ) );
+                $this-&gt;assertArrayHasKey( 'baz', $list );
+        }
+
+
+        function test_filter_object_list_nested_array_and_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'AND', 'name' );
+                $this-&gt;assertEquals( 1, count( $list ) );
+                $this-&gt;assertEquals( array( 'baz' =&gt; 'baz' ) , $list );
+        }
+
+        function test_filter_object_list_nested_array_not_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'green' ) ), 'NOT', 'name' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'baz' =&gt; 'baz' ), $list );
+        }
+
+        function test_filter_object_list_nested_array_or_field() {
+                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field3' =&gt; true, 'field4' =&gt; array( 'blue' ) ), 'OR', 'name' );
+                $this-&gt;assertEquals( 2, count( $list ) );
+                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'baz' =&gt; 'baz' ), $list );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsfunctionsphpfromrev903trunkteststest_includes_functionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/functions.php (from rev 903, trunk/tests/test_includes_functions.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/functions.php                                (rev 0)
+++ trunk/tests/functions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,245 @@
</span><ins>+&lt;?php
+
+/**
+ * @group functions.php
+ */
+class Tests_Functions extends WP_UnitTestCase {
+        function test_wp_parse_args_object() {
+                $x = new MockClass;
+                $x-&gt;_baba = 5;
+                $x-&gt;yZ = &quot;baba&quot;;
+                $x-&gt;a = array(5, 111, 'x');
+                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x));
+                $y = new MockClass;
+                $this-&gt;assertEquals(array(), wp_parse_args($y));
+        }
+        function test_wp_parse_args_array()  {
+                // arrays
+                $a = array();
+                $this-&gt;assertEquals(array(), wp_parse_args($a));
+                $b = array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x'));
+                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($b));
+        }
+        function test_wp_parse_args_defaults() {
+                $x = new MockClass;
+                $x-&gt;_baba = 5;
+                $x-&gt;yZ = &quot;baba&quot;;
+                $x-&gt;a = array(5, 111, 'x');
+                $d = array('pu' =&gt; 'bu');
+                $this-&gt;assertEquals(array('pu' =&gt; 'bu', '_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x, $d));
+                $e = array('_baba' =&gt; 6);
+                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x, $e));
+        }
+        function test_wp_parse_args_other() {
+                $b = true;
+                wp_parse_str($b, $s);
+                $this-&gt;assertEquals($s, wp_parse_args($b));
+                $q = 'x=5&amp;_baba=dudu&amp;';
+                wp_parse_str($q, $ss);
+                $this-&gt;assertEquals($ss, wp_parse_args($q));
+        }
+        function test_size_format() {
+                $kb = 1024;
+                $mb = $kb*1024;
+                $gb = $mb*1024;
+                $tb = $gb*1024;
+                // test if boundaries are correct
+                $this-&gt;assertEquals('1 GB', size_format($gb, 0));
+                $this-&gt;assertEquals('1 MB', size_format($mb, 0));
+                $this-&gt;assertEquals('1 kB', size_format($kb, 0));
+                // now some values around
+                // add some bytes to make sure the result isn't 1.4999999
+                $this-&gt;assertEquals('1.5 TB', size_format($tb + $tb/2 + $mb, 1));
+                $this-&gt;assertEquals('1,023.999 GB', size_format($tb-$mb-$kb, 3));
+                // edge
+                $this-&gt;assertFalse(size_format(-1));
+                $this-&gt;assertFalse(size_format(0));
+                $this-&gt;assertFalse(size_format('baba'));
+                $this-&gt;assertFalse(size_format(array()));
+        }
+
+        function test_path_is_absolute() {
+                if ( !is_callable('path_is_absolute') )
+                        $this-&gt;markTestSkipped();
+
+                $absolute_paths = array(
+                        '/',
+                        '/foo/',
+                        '/foo',
+                        '/FOO/bar',
+                        '/foo/bar/',
+                        '/foo/../bar/',
+                        '\\WINDOWS',
+                        'C:\\',
+                        'C:\\WINDOWS',
+                        '\\\\sambashare\\foo',
+                        );
+                foreach ($absolute_paths as $path)
+                        $this-&gt;assertTrue( path_is_absolute($path), &quot;path_is_absolute('$path') should return true&quot; );
+        }
+
+        function test_path_is_not_absolute() {
+                if ( !is_callable('path_is_absolute') )
+                        $this-&gt;markTestSkipped();
+
+                $relative_paths = array(
+                        '',
+                        '.',
+                        '..',
+                        '../foo',
+                        '../',
+                        '../foo.bar',
+                        'foo/bar',
+                        'foo',
+                        'FOO',
+                        '..\\WINDOWS',
+                        );
+                foreach ($relative_paths as $path)
+                        $this-&gt;assertFalse( path_is_absolute($path), &quot;path_is_absolute('$path') should return false&quot; );
+        }
+
+
+        function test_wp_unique_filename() {
+                /* this test requires:
+                   - that you have dir + file 'data/images/test-image.png',
+                   - and that this dir is writeable
+                   - there is an image 'test-image.png' that will be used to test unique filenames
+
+                   NB: there is a hardcoded dependency that the testing file is '.png'; however,
+                       this limitation is arbitary, so change it if you like.
+                */
+                $testdir = DIR_TESTDATA . '/images/';
+                $testimg = 'test-image.png';
+                $this-&gt;assertTrue( file_exists($testdir) );
+                $this-&gt;assertTrue( is_writable($testdir) );
+                $this-&gt;assertTrue( file_exists($testdir . $testimg) );
+
+                $cases = array(
+                        // null case
+                        'null' . $testimg,
+
+                        // edge cases: '.png', 'abc.', 'abc', 'abc0', 'abc1', 'abc0.png', 'abc1.png' (num @ end)
+                        '.png',
+                        'abc',
+                        'abc.',
+                        'abc0',
+                        'abc1',
+                        'abc0.png',
+                        'abc1.png',
+
+                        // replacing # with _
+                        str_replace('-', '#', $testimg), // test#image.png
+                        str_replace('-', '##', $testimg), // test##image.png
+                        str_replace(array('-', 'e'), '#', $testimg), // t#st#imag#.png
+                        str_replace(array('-', 'e'), '##', $testimg), // t##st##imag##.png
+
+                        // replacing \ or ' with nothing
+                        str_replace('-', '\\', $testimg), // test\image.png
+                        str_replace('-', '\\\\', $testimg), // test\\image.png
+                        str_replace(array('-', 'e'), '\\', $testimg), // t\st\imag\.png
+                        str_replace(array('-', 'e'), '\\\\', $testimg), // t\\st\\imag\\.png
+                        str_replace('-', &quot;'&quot;, $testimg), // test'image.png
+                        str_replace('-', &quot;'&quot;, $testimg), // test''image.png
+                        str_replace(array('-', 'e'), &quot;'&quot;, $testimg), // t'st'imag'.png
+                        str_replace(array('-', 'e'), &quot;''&quot;, $testimg), // t''st''imag''.png
+                        str_replace('-', &quot;\'&quot;, $testimg), // test\'image.png
+                        str_replace('-', &quot;\'\'&quot;, $testimg), // test\'\'image.png
+                        str_replace(array('-', 'e'), &quot;\'&quot;, $testimg), // t\'st\'imag\'.png
+                        str_replace(array('-', 'e'), &quot;\'\'&quot;, $testimg), // t\'\'st\'\'imag\'\'.png
+
+                        'test' . str_replace('e', 'é', $testimg), // testtést-imagé.png
+
+                        '12%af34567890~!@#$..%^&amp;*()|_+qwerty  fgh`jkl zx&lt;&gt;?:&quot;{}[]=&quot;\'/?.png', // kitchen sink
+                        $testdir.'test-image-with-path.png',
+                );
+
+                // what we expect the replacements will do
+                $expected = array(
+                                'null' . $testimg,
+
+                                'png',
+                                'abc',
+                                'abc',
+                                'abc0',
+                                'abc1',
+                                'abc0.png',
+                                'abc1.png',
+
+                                'testimage.png',
+                                'testimage.png',
+                                'tstimag.png',
+                                'tstimag.png',
+
+                                'testimage.png',
+                                'testimage.png',
+                                'tstimag.png',
+                                'tstimag.png',
+                                'testimage.png',
+                                'testimage.png',
+                                'tstimag.png',
+                                'tstimag.png',
+                                'testimage.png',
+                                'testimage.png',
+                                'tstimag.png',
+                                'tstimag.png',
+
+                                'testtést-imagé.png',
+
+                                '12%af34567890@..%^_+qwerty-fghjkl-zx.png',
+                                str_replace( array( '\\', '/', ':' ), '', $testdir ).'test-image-with-path.png',
+                        );
+
+                foreach ($cases as $key =&gt; $case) {
+                        // make sure expected file doesn't exist already
+                        // happens when tests fail and the unlinking doesn't happen
+                        if( $expected[$key] !== $testimg &amp;&amp; file_exists($testdir . $expected[$key]) )
+                                unlink($testdir . $expected[$key]);
+
+                        // -- TEST 1: the replacement is as expected
+                        $this-&gt;assertEquals( $expected[$key], wp_unique_filename($testdir, $case, NULL), $case );
+                        // -- end TEST 1
+
+                        // -- TEST 2: the renaming will produce a unique name
+                        // create the expected file
+                        copy($testdir . $testimg, $testdir . $expected[$key]);
+                        // test that wp_unique_filename actually returns a unique filename
+                        $this-&gt;assertFileNotExists( $testdir . wp_unique_filename($testdir, $case, NULL) );
+                        // -- end TEST 2
+
+                        // cleanup
+                        if( $expected[$key] !== $testimg &amp;&amp;  file_exists($testdir . $expected[$key]) )
+                                unlink($testdir . $expected[$key]);
+                }
+        }
+
+        /**
+         * @ticket 9930
+         */
+        function test_is_serialized() {
+                $cases = array(
+                        serialize(null),
+                        serialize(true),
+                        serialize(false),
+                        serialize(-25),
+                        serialize(25),
+                        serialize(1.1),
+                        serialize(2.1E+200),
+                        serialize('this string will be serialized'),
+                        serialize(&quot;a\nb&quot;),
+                        serialize(array()),
+                        serialize(array(1,1,2,3,5,8,13)),
+                        serialize( (object)array('test' =&gt; true, '3', 4) )
+                );
+                foreach ( $cases as $case )
+                        $this-&gt;assertTrue( is_serialized($case), &quot;Serialized data: $case&quot; );
+
+                $not_serialized = array(
+                        'a string',
+                        'garbage:a:0:garbage;',
+                        'b:4;',
+                        's:4:test;'
+                );
+                foreach ( $not_serialized as $case )
+                        $this-&gt;assertFalse( is_serialized($case), &quot;Test data: $case&quot; );
+        }
+}
</ins></span></pre></div>
<a id="trunktestshttpfunctionsphpfromrev903trunkteststest_includes_functionsphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/http/functions.php (from rev 903, trunk/tests/test_includes_functions.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/http/functions.php                                (rev 0)
+++ trunk/tests/http/functions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;?php
+
+/**
+ * @group http
+ */
+class Tests_HTTP_Functions extends WP_UnitTestCase {
+        function test_head_request() {
+                // this url give a direct 200 response
+                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+                $response = wp_remote_head( $url );
+                $headers = wp_remote_retrieve_headers( $response );
+
+                $this-&gt;assertTrue( is_array( $headers ) );
+                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
+                $this-&gt;assertEquals( '40148', $headers['content-length'] );
+                $this-&gt;assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
+        }
+
+        function test_head_redirect() {
+                // this url will 301 redirect
+                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+                $response = wp_remote_head( $url );
+                $this-&gt;assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
+        }
+
+        function test_head_404() {
+                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
+                $response = wp_remote_head( $url );
+
+                $this-&gt;assertTrue( is_array($response) );
+                $this-&gt;assertEquals( '404', wp_remote_retrieve_response_code( $response ) );
+        }
+
+        function test_get_request() {
+                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+                $file = tempnam('/tmp', 'testfile');
+
+                $headers = wp_get_http($url, $file);
+
+                // should return the same headers as a head request
+                $this-&gt;assertTrue( is_array($headers) );
+                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
+                $this-&gt;assertEquals( '40148', $headers['content-length'] );
+                $this-&gt;assertEquals( '200', $headers['response'] );
+
+                // make sure the file is ok
+                $this-&gt;assertEquals( 40148, filesize($file) );
+                $this-&gt;assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
+        }
+
+        function test_get_redirect() {
+                // this will redirect to asdftestblog1.files.wordpress.com
+                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+                $file = tempnam('/tmp', 'testfile');
+
+                $headers = wp_get_http($url, $file);
+
+                // should return the same headers as a head request
+                $this-&gt;assertTrue( is_array($headers) );
+                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
+                $this-&gt;assertEquals( '40148', $headers['content-length'] );
+                $this-&gt;assertEquals( '200', $headers['response'] );
+
+                // make sure the file is ok
+                $this-&gt;assertEquals( 40148, filesize($file) );
+                $this-&gt;assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
+        }
+
+        function test_get_redirect_limit_exceeded() {
+                // this will redirect to asdftestblog1.files.wordpress.com
+                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+                $file = tempnam('/tmp', 'testfile');
+                // pretend we've already redirected 5 times
+                $headers = wp_get_http( $url, $file, 6 );
+                $this-&gt;assertFalse( $headers );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsimagedimensionsphpfromrev903trunkteststest_imagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/image/dimensions.php (from rev 903, trunk/tests/test_image.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/image/dimensions.php                                (rev 0)
+++ trunk/tests/image/dimensions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+&lt;?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Dimensions extends WP_UnitTestCase {
+        function test_400x400_no_crop() {
+                // landscape: resize 640x480 to fit 400x400: 400x300
+                $out = image_resize_dimensions(640, 480, 400, 400, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+                // portrait: resize 480x640 to fit 400x400: 300x400
+                $out = image_resize_dimensions(480, 640, 400, 400, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+        }
+
+        function test_400x0_no_crop() {
+                // landscape: resize 640x480 to fit 400w: 400x300
+                $out = image_resize_dimensions(640, 480, 400, 0, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+                // portrait: resize 480x640 to fit 400w: 400x533
+                $out = image_resize_dimensions(480, 640, 400, 0, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
+        }
+
+        function test_0x400_no_crop() {
+                // landscape: resize 640x480 to fit 400h: 533x400
+                $out = image_resize_dimensions(640, 480, 0, 400, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
+
+                // portrait: resize 480x640 to fit 400h: 300x400
+                $out = image_resize_dimensions(480, 640, 0, 400, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+        }
+
+        function test_800x800_no_crop() {
+                // landscape: resize 640x480 to fit 800x800
+                $out = image_resize_dimensions(640, 480, 800, 800, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+
+                // portrait: resize 480x640 to fit 800x800
+                $out = image_resize_dimensions(480, 640, 800, 800, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+        }
+
+        function test_800x0_no_crop() {
+                // landscape: resize 640x480 to fit 800w
+                $out = image_resize_dimensions(640, 480, 800, 0, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+
+                // portrait: resize 480x640 to fit 800w
+                $out = image_resize_dimensions(480, 640, 800, 0, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+        }
+
+        function test_0x800_no_crop() {
+                // landscape: resize 640x480 to fit 800h
+                $out = image_resize_dimensions(640, 480, 0, 800, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+
+                // portrait: resize 480x640 to fit 800h
+                $out = image_resize_dimensions(480, 640, 0, 800, false);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( false, $out );
+        }
+
+        // cropped versions
+
+        function test_400x400_crop() {
+                // landscape: crop 640x480 to fit 400x400: 400x400 taken from a 480x480 crop at (80. 0)
+                $out = image_resize_dimensions(640, 480, 400, 400, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 80, 0, 400, 400, 480, 480), $out );
+
+                // portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
+                $out = image_resize_dimensions(480, 640, 400, 400, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 80, 400, 400, 480, 480), $out );
+        }
+
+        function test_400x0_crop() {
+                // landscape: resize 640x480 to fit 400w: 400x300
+                $out = image_resize_dimensions(640, 480, 400, 0, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+                // portrait: resize 480x640 to fit 400w: 400x533
+                $out = image_resize_dimensions(480, 640, 400, 0, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
+        }
+
+        function test_0x400_crop() {
+                // landscape: resize 640x480 to fit 400h: 533x400
+                $out = image_resize_dimensions(640, 480, 0, 400, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
+
+                // portrait: resize 480x640 to fit 400h: 300x400
+                $out = image_resize_dimensions(480, 640, 0, 400, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+        }
+
+        function test_400x500_crop() {
+                // landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop at (80. 0)
+                $out = image_resize_dimensions(640, 480, 400, 500, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 120, 0, 400, 480, 400, 480), $out );
+
+                // portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
+                $out = image_resize_dimensions(480, 640, 400, 500, true);
+                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+                $this-&gt;assertEquals( array(0, 0, 0, 20, 400, 500, 480, 600), $out );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsimagefunctionsphpfromrev903trunkteststest_imagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/image/functions.php (from rev 903, trunk/tests/test_image.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/image/functions.php                                (rev 0)
+++ trunk/tests/image/functions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Functions extends WP_UnitTestCase {
+        function test_is_image_positive() {
+                // these are all image files recognized by php
+                $files = array(
+                        'test-image-cmyk.jpg',
+                        'test-image.bmp',
+                        'test-image-grayscale.jpg',
+                        'test-image.gif',
+                        'test-image.png',
+                        'test-image.tiff',
+                        'test-image-lzw.tiff',
+                        'test-image.jp2',
+                        'test-image.psd',
+                        'test-image-zip.tiff',
+                        'test-image.jpg',
+                        );
+
+                foreach ($files as $file) {
+                        $this-&gt;assertTrue( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return true&quot; );
+                }
+        }
+
+        function test_is_image_negative() {
+                // these are actually image files but aren't recognized or usable by php
+                $files = array(
+                        'test-image.pct',
+                        'test-image.tga',
+                        'test-image.sgi',
+                        );
+
+                foreach ($files as $file) {
+                        $this-&gt;assertFalse( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return false&quot; );
+                }
+        }
+
+        function test_is_displayable_image_positive() {
+                // these are all usable in typical web browsers
+                $files = array(
+                        'test-image.gif',
+                        'test-image.png',
+                        'test-image.jpg',
+                        );
+
+                foreach ($files as $file) {
+                        $this-&gt;assertTrue( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return true&quot; );
+                }
+        }
+
+        function test_is_displayable_image_negative() {
+                // these are image files but aren't suitable for web pages because of compatibility or size issues
+                $files = array(
+                        // 'test-image-cmyk.jpg', Allowed in r9727
+                        'test-image.bmp',
+                        // 'test-image-grayscale.jpg', Allowed in r9727
+                        'test-image.pct',
+                        'test-image.tga',
+                        'test-image.sgi',
+                        'test-image.tiff',
+                        'test-image-lzw.tiff',
+                        'test-image.jp2',
+                        'test-image.psd',
+                        'test-image-zip.tiff',
+                        );
+
+                foreach ($files as $file) {
+                        $this-&gt;assertFalse( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return false&quot; );
+                }
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsimagemetaphpfromrev903trunkteststest_imagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/image/meta.php (from rev 903, trunk/tests/test_image.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/image/meta.php                                (rev 0)
+++ trunk/tests/image/meta.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+&lt;?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Meta extends WP_UnitTestCase {
+        function setUp() {
+                if ( ! extension_loaded( 'gd' ) )
+                        $this-&gt;markTestSkipped( 'The gd PHP extension is not loaded.' );
+                if ( ! extension_loaded( 'exif' ) )
+                        $this-&gt;markTestSkipped( 'The exif PHP extension is not loaded.' );
+                if ( ! is_callable( 'wp_read_image_metadata' ) )
+                        $this-&gt;markTestSkipped( 'wp_read_image_metadata() is not callable.' );
+                parent::setUp();
+        }
+
+        function test_exif_d70() {
+                // exif from a Nikon D70
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0008.jpg');
+
+                $this-&gt;assertEquals(6.3, $out['aperture']);
+                $this-&gt;assertEquals('', $out['credit']);
+                $this-&gt;assertEquals('NIKON D70', $out['camera']);
+                $this-&gt;assertEquals('', $out['caption']);
+                $this-&gt;assertEquals(strtotime('2004-07-22 17:14:59'), $out['created_timestamp']);
+                $this-&gt;assertEquals('', $out['copyright']);
+                $this-&gt;assertEquals(27, $out['focal_length']);
+                $this-&gt;assertEquals(400, $out['iso']);
+                $this-&gt;assertEquals(1/40, $out['shutter_speed']);
+                $this-&gt;assertEquals('', $out['title']);
+        }
+
+        function test_exif_d70_mf() {
+                // exif from a Nikon D70 - manual focus lens, so some data is unavailable
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG');
+
+                $this-&gt;assertEquals(0, $out['aperture']);
+                $this-&gt;assertEquals('', $out['credit']);
+                $this-&gt;assertEquals('NIKON D70', $out['camera']);
+                $this-&gt;assertEquals('', $out['caption']);
+                $this-&gt;assertEquals(strtotime('2007-06-17 21:18:00'), $out['created_timestamp']);
+                $this-&gt;assertEquals('', $out['copyright']);
+                $this-&gt;assertEquals(0, $out['focal_length']);
+                $this-&gt;assertEquals(0, $out['iso']); // interesting - a Nikon bug?
+                $this-&gt;assertEquals(1/500, $out['shutter_speed']);
+                $this-&gt;assertEquals('', $out['title']);
+                #$this-&gt;assertEquals(array('Flowers'), $out['keywords']);
+        }
+
+        function test_exif_d70_iptc() {
+                // exif from a Nikon D70 with IPTC data added later
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0007.jpg');
+
+                $this-&gt;assertEquals(6.3, $out['aperture']);
+                $this-&gt;assertEquals('IPTC Creator', $out['credit']);
+                $this-&gt;assertEquals('NIKON D70', $out['camera']);
+                $this-&gt;assertEquals('IPTC Caption', $out['caption']);
+                $this-&gt;assertEquals(strtotime('2004-07-22 17:14:35'), $out['created_timestamp']);
+                $this-&gt;assertEquals('IPTC Copyright', $out['copyright']);
+                $this-&gt;assertEquals(18, $out['focal_length']);
+                $this-&gt;assertEquals(200, $out['iso']);
+                $this-&gt;assertEquals(1/25, $out['shutter_speed']);
+                $this-&gt;assertEquals('IPTC Headline', $out['title']);
+        }
+
+        function test_exif_fuji() {
+                // exif from a Fuji FinePix S5600 (thanks Mark)
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/a2-small.jpg');
+
+                $this-&gt;assertEquals(4.5, $out['aperture']);
+                $this-&gt;assertEquals('', $out['credit']);
+                $this-&gt;assertEquals('FinePix S5600', $out['camera']);
+                $this-&gt;assertEquals('', $out['caption']);
+                $this-&gt;assertEquals(strtotime('2007-09-03 10:17:03'), $out['created_timestamp']);
+                $this-&gt;assertEquals('', $out['copyright']);
+                $this-&gt;assertEquals(6.3, $out['focal_length']);
+                $this-&gt;assertEquals(64, $out['iso']);
+                $this-&gt;assertEquals(1/320, $out['shutter_speed']);
+                $this-&gt;assertEquals('', $out['title']);
+
+        }
+
+        /**
+         * @ticket 6571
+         */
+        function test_exif_error() {
+
+                // http://trac.wordpress.org/ticket/6571
+                // this triggers a warning mesage when reading the exif block
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/waffles.jpg');
+
+                $this-&gt;assertEquals(0, $out['aperture']);
+                $this-&gt;assertEquals('', $out['credit']);
+                $this-&gt;assertEquals('', $out['camera']);
+                $this-&gt;assertEquals('', $out['caption']);
+                $this-&gt;assertEquals(0, $out['created_timestamp']);
+                $this-&gt;assertEquals('', $out['copyright']);
+                $this-&gt;assertEquals(0, $out['focal_length']);
+                $this-&gt;assertEquals(0, $out['iso']);
+                $this-&gt;assertEquals(0, $out['shutter_speed']);
+                $this-&gt;assertEquals('', $out['title']);
+        }
+
+        function test_exif_no_data() {
+                // no exif data in this image (from burningwell.org)
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/canola.jpg');
+
+                $this-&gt;assertEquals(0, $out['aperture']);
+                $this-&gt;assertEquals('', $out['credit']);
+                $this-&gt;assertEquals('', $out['camera']);
+                $this-&gt;assertEquals('', $out['caption']);
+                $this-&gt;assertEquals(0, $out['created_timestamp']);
+                $this-&gt;assertEquals('', $out['copyright']);
+                $this-&gt;assertEquals(0, $out['focal_length']);
+                $this-&gt;assertEquals(0, $out['iso']);
+                $this-&gt;assertEquals(0, $out['shutter_speed']);
+                $this-&gt;assertEquals('', $out['title']);
+        }
+
+        /**
+         * @ticket 9417
+         */
+        function test_utf8_iptc_tags() {
+
+                // trilingual UTF-8 text in the ITPC caption-abstract field
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/test-image-iptc.jpg');
+
+                $this-&gt;assertEquals('This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $out['caption']);
+        }
+
+        /**
+         * wp_read_image_metadata() should false if the image file doesn't exist
+         * @return void
+         */
+        public function test_missing_image_file() {
+                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/404_image.png');
+                $this-&gt;assertFalse($out);
+        }
+}
</ins></span></pre></div>
<a id="trunktestsimageresizephpfromrev903trunkteststest_imagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/image/resize.php (from rev 903, trunk/tests/test_image.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/image/resize.php                                (rev 0)
+++ trunk/tests/image/resize.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+&lt;?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Resize extends WP_UnitTestCase {
+        // image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=75)
+
+        function setUp() {
+                if ( ! extension_loaded( 'gd' ) )
+                        $this-&gt;markTestSkipped( 'The gd PHP extension is not loaded.' );
+                parent::setUp();
+        }
+
+        function test_resize_jpg() {
+                $image = image_resize( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 );
+                $this-&gt;assertEquals( 'test-image-25x25.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 25, $w );
+                $this-&gt;assertEquals( 25, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                unlink($image);
+        }
+
+        function test_resize_png() {
+                $image = image_resize( DIR_TESTDATA.'/images/test-image.png', 25, 25 );
+                $this-&gt;assertEquals( 'test-image-25x25.png', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 25, $w );
+                $this-&gt;assertEquals( 25, $h );
+                $this-&gt;assertEquals( IMAGETYPE_PNG, $type );
+                unlink($image);
+        }
+
+        function test_resize_gif() {
+                $image = image_resize( DIR_TESTDATA.'/images/test-image.gif', 25, 25 );
+                $this-&gt;assertEquals( 'test-image-25x25.gif', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 25, $w );
+                $this-&gt;assertEquals( 25, $h );
+                $this-&gt;assertEquals( IMAGETYPE_GIF, $type );
+                unlink($image);
+        }
+
+        function test_resize_larger() {
+                // image_resize() should refuse to make an image larger
+                $image = image_resize( DIR_TESTDATA.'/images/test-image.jpg', 100, 100 );
+                $this-&gt;assertInstanceOf( 'WP_Error', $image );
+                $this-&gt;assertEquals( 'error_getting_dimensions', $image-&gt;get_error_code() );
+        }
+
+        function test_resize_thumb_128x96() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 96 );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-63x96.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 63, $w );
+                $this-&gt;assertEquals( 96, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( 'be8f7aaa7b939970a3ded069a6e3619b', md5_file($image) );
+                unlink($image);
+        }
+
+        function test_resize_thumb_128x0() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 0 );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-128x192.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 128, $w );
+                $this-&gt;assertEquals( 192, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( '7b1c0d5e7d4f6a18ae7541c8abf1fd09', md5_file($image) );
+                unlink($image);
+        }
+
+        function test_resize_thumb_0x96() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 0, 96 );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-63x96.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 63, $w );
+                $this-&gt;assertEquals( 96, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( 'be8f7aaa7b939970a3ded069a6e3619b', md5_file($image) );
+                unlink($image);
+        }
+
+        function test_resize_thumb_150x150_crop() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 150, true );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 150, $w );
+                $this-&gt;assertEquals( 150, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( '9fdcf728e1d43da89edf866d009ca7e8', md5_file($image) );
+                unlink($image);
+        }
+
+        function test_resize_thumb_150x100_crop() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 100, true );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 150, $w );
+                $this-&gt;assertEquals( 100, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( '2eeb18856505ab946074d90babc46452', md5_file($image) );
+                unlink($image);
+        }
+
+        function test_resize_thumb_50x150_crop() {
+                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 50, 150, true );
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename($image) );
+                list($w, $h, $type) = getimagesize($image);
+                $this-&gt;assertEquals( 50, $w );
+                $this-&gt;assertEquals( 150, $h );
+                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
+                // is this a valid test? do different systems always generate the same file?
+                #$this-&gt;assertEquals( '94ed8e8463475774a5c5ff66118d3127', md5_file($image) );
+                unlink($image);
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsimagesizephpfromrev903trunkteststest_imagephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/image/size.php (from rev 903, trunk/tests/test_image.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/image/size.php                                (rev 0)
+++ trunk/tests/image/size.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,198 @@
</span><ins>+&lt;?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Size extends WP_UnitTestCase {
+        function test_constrain_dims_zero() {
+                if (!is_callable('wp_constrain_dimensions'))
+                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+                // no constraint - should have no effect
+                $out = wp_constrain_dimensions(640, 480, 0, 0);
+                $this-&gt;assertEquals(array(640, 480), $out);
+
+                $out = wp_constrain_dimensions(640, 480);
+                $this-&gt;assertEquals(array(640, 480), $out);
+
+                $out = wp_constrain_dimensions(0, 0, 0, 0);
+                $this-&gt;assertEquals(array(0, 0), $out);
+        }
+
+        function test_constrain_dims_smaller() {
+                if (!is_callable('wp_constrain_dimensions'))
+                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+                // image size is smaller than the constraint - no effect
+                $out = wp_constrain_dimensions(500, 600, 1024, 768);
+                $this-&gt;assertEquals(array(500, 600), $out);
+
+                $out = wp_constrain_dimensions(500, 600, 0, 768);
+                $this-&gt;assertEquals(array(500, 600), $out);
+
+                $out = wp_constrain_dimensions(500, 600, 1024, 0);
+                $this-&gt;assertEquals(array(500, 600), $out);
+        }
+
+        function test_constrain_dims_equal() {
+                if (!is_callable('wp_constrain_dimensions'))
+                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+                // image size is equal to the constraint - no effect
+                $out = wp_constrain_dimensions(1024, 768, 1024, 768);
+                $this-&gt;assertequals(array(1024, 768), $out);
+
+                $out = wp_constrain_dimensions(1024, 768, 0, 768);
+                $this-&gt;assertequals(array(1024, 768), $out);
+
+                $out = wp_constrain_dimensions(1024, 768, 1024, 0);
+                $this-&gt;assertequals(array(1024, 768), $out);
+        }
+
+        function test_constrain_dims_larger() {
+                if (!is_callable('wp_constrain_dimensions'))
+                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+                // image size is larger than the constraint - result should be constrained
+                $out = wp_constrain_dimensions(1024, 768, 500, 600);
+                $this-&gt;assertequals(array(500, 375), $out);
+
+                $out = wp_constrain_dimensions(1024, 768, 0, 600);
+                $this-&gt;assertequals(array(800, 600), $out);
+
+                $out = wp_constrain_dimensions(1024, 768, 500, 0);
+                $this-&gt;assertequals(array(500, 375), $out);
+
+                // also try a portrait oriented image
+                $out = wp_constrain_dimensions(300, 800, 500, 600);
+                $this-&gt;assertequals(array(225, 600), $out);
+
+                $out = wp_constrain_dimensions(300, 800, 0, 600);
+                $this-&gt;assertequals(array(225, 600), $out);
+
+                $out = wp_constrain_dimensions(300, 800, 200, 0);
+                $this-&gt;assertequals(array(200, 533), $out);
+        }
+
+        function test_constrain_dims_boundary() {
+                if (!is_callable('wp_constrain_dimensions'))
+                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+                // one dimension is larger than the constraint, one smaller - result should be constrained
+                $out = wp_constrain_dimensions(1024, 768, 500, 800);
+                $this-&gt;assertequals(array(500, 375), $out);
+
+                $out = wp_constrain_dimensions(1024, 768, 2000, 700);
+                $this-&gt;assertequals(array(933, 700), $out);
+
+                // portrait
+                $out = wp_constrain_dimensions(768, 1024, 800, 500);
+                $this-&gt;assertequals(array(375, 500), $out);
+
+                $out = wp_constrain_dimensions(768, 1024, 2000, 700);
+                $this-&gt;assertequals(array(525, 700), $out);
+        }
+
+        function test_shrink_dimensions_default() {
+                $out = wp_shrink_dimensions(640, 480);
+                $this-&gt;assertEquals(array(128, 96), $out);
+
+                $out = wp_shrink_dimensions(480, 640);
+                $this-&gt;assertEquals(array(72, 96), $out);
+        }
+
+        function test_shrink_dimensions_smaller() {
+                // image size is smaller than the constraint - no effect
+                $out = wp_shrink_dimensions(500, 600, 1024, 768);
+                $this-&gt;assertEquals(array(500, 600), $out);
+
+                $out = wp_shrink_dimensions(600, 500, 1024, 768);
+                $this-&gt;assertEquals(array(600, 500), $out);
+        }
+
+        function test_shrink_dimensions_equal() {
+                // image size is equal to the constraint - no effect
+                $out = wp_shrink_dimensions(500, 600, 500, 600);
+                $this-&gt;assertEquals(array(500, 600), $out);
+
+                $out = wp_shrink_dimensions(600, 500, 600, 500);
+                $this-&gt;assertEquals(array(600, 500), $out);
+        }
+
+        function test_shrink_dimensions_larger() {
+                // image size is larger than the constraint - result should be constrained
+                $out = wp_shrink_dimensions(1024, 768, 500, 600);
+                $this-&gt;assertequals(array(500, 375), $out);
+
+                $out = wp_shrink_dimensions(300, 800, 500, 600);
+                $this-&gt;assertequals(array(225, 600), $out);
+        }
+
+        function test_shrink_dimensions_boundary() {
+                // one dimension is larger than the constraint, one smaller - result should be constrained
+                $out = wp_shrink_dimensions(1024, 768, 500, 800);
+                $this-&gt;assertequals(array(500, 375), $out);
+
+                $out = wp_shrink_dimensions(1024, 768, 2000, 700);
+                $this-&gt;assertequals(array(933, 700), $out);
+
+                // portrait
+                $out = wp_shrink_dimensions(768, 1024, 800, 500);
+                $this-&gt;assertequals(array(375, 500), $out);
+
+                $out = wp_shrink_dimensions(768, 1024, 2000, 700);
+                $this-&gt;assertequals(array(525, 700), $out);
+        }
+
+        function test_constrain_size_for_editor_thumb() {
+                $out = image_constrain_size_for_editor(600, 400, 'thumb');
+                $this-&gt;assertEquals(array(150, 100), $out);
+
+                $out = image_constrain_size_for_editor(64, 64, 'thumb');
+                $this-&gt;assertEquals(array(64, 64), $out);
+        }
+
+        function test_constrain_size_for_editor_medium() {
+                // default max width is 500, no constraint on height
+                global $content_width;
+                $content_width = 0;
+                update_option('medium_size_w', 500);
+                update_option('medium_size_h', 0);
+
+                $out = image_constrain_size_for_editor(600, 400, 'medium');
+                $this-&gt;assertEquals(array(500, 333), $out);
+
+                $out = image_constrain_size_for_editor(400, 600, 'medium');
+                $this-&gt;assertEquals(array(400, 600), $out);
+
+                $out = image_constrain_size_for_editor(64, 64, 'medium');
+                $this-&gt;assertEquals(array(64, 64), $out);
+
+                // content_width should be ignored
+                $content_width = 350;
+                $out = image_constrain_size_for_editor(600, 400, 'medium');
+                $this-&gt;assertEquals(array(500, 333), $out);
+        }
+
+        function test_constrain_size_for_editor_full() {
+                global $content_width;
+                $content_width = 400;
+                $out = image_constrain_size_for_editor(600, 400, 'full');
+                $this-&gt;assertEquals(array(600, 400), $out);
+
+                $out = image_constrain_size_for_editor(64, 64, 'full');
+                $this-&gt;assertEquals(array(64, 64), $out);
+
+                // content_width default is 500
+                $content_width = 0;
+
+                $out = image_constrain_size_for_editor(600, 400, 'full');
+                $this-&gt;assertEquals(array(600, 400), $out);
+
+                $out = image_constrain_size_for_editor(64, 64, 'full');
+                $this-&gt;assertEquals(array(64, 64), $out);
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestsimportbasephpfromrev903trunkteststest_import_wpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/import/base.php (from rev 903, trunk/tests/test_import_wp.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/import/base.php                                (rev 0)
+++ trunk/tests/import/base.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;?php
+
+abstract class WP_Import_UnitTestCase extends WP_UnitTestCase {
+        /**
+         * Import a WXR file.
+         *
+         * The $users parameter provides information on how users specified in the import
+         * file should be imported. Each key is a user login name and indicates if the user
+         * should be mapped to an existing user, created as a new user with a particular login
+         * or imported with the information held in the WXR file. An example of this:
+         *
+         * &lt;code&gt;
+         * $users = array(
+         *   'alice' =&gt; 1, // alice will be mapped to user ID 1
+         *   'bob' =&gt; 'john', // bob will be transformed into john
+         *   'eve' =&gt; false // eve will be imported as is
+         * );&lt;/code&gt;
+         *
+         * @param string $filename Full path of the file to import
+         * @param array $users User import settings
+         * @param bool $fetch_files Whether or not do download remote attachments
+         */
+        protected function _import_wp( $filename, $users = array(), $fetch_files = true ) {
+                $importer = new WP_Import();
+                $file = realpath( $filename );
+                assert('!empty($file)');
+                assert('is_file($file)');
+
+                $authors = $mapping = $new = array();
+                $i = 0;
+
+                // each user is either mapped to a given ID, mapped to a new user
+                // with given login or imported using details in WXR file
+                foreach ( $users as $user =&gt; $map ) {
+                        $authors[$i] = $user;
+                        if ( is_int( $map ) )
+                                $mapping[$i] = $map;
+                        else if ( is_string( $map ) )
+                                $new[$i] = $map;
+
+                        $i++;
+                }
+
+                $_POST = array( 'imported_authors' =&gt; $authors, 'user_map' =&gt; $mapping, 'user_new' =&gt; $new );
+
+                ob_start();
+                $importer-&gt;fetch_attachments = $fetch_files;
+                $importer-&gt;import( $file );
+                ob_end_clean();
+
+                $_POST = array();
+        }
+}
</ins></span></pre></div>
<a id="trunktestsimportimportphpfromrev903trunkteststest_import_wpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/import/import.php (from rev 903, trunk/tests/test_import_wp.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/import/import.php                                (rev 0)
+++ trunk/tests/import/import.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,226 @@
</span><ins>+&lt;?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Import extends WP_Import_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+
+                add_filter( 'import_allow_create_users', '__return_true' );
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+
+                global $wpdb;
+                // crude but effective: make sure there's no residual data in the main tables
+                foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
+                        $wpdb-&gt;query(&quot;DELETE FROM {$wpdb-&gt;$table}&quot;);
+        }
+
+        function tearDown() {
+                remove_filter( 'import_allow_create_users', '__return_true' );
+
+                parent::tearDown();
+        }
+
+        function test_small_import() {
+                global $wpdb;
+
+                $authors = array( 'admin' =&gt; false, 'editor' =&gt; false, 'author' =&gt; false );
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+                // ensure that authors were imported correctly
+                $user_count = count_users();
+                $this-&gt;assertEquals( 3, $user_count['total_users'] );
+                $admin = get_user_by( 'login', 'admin' );
+                $this-&gt;assertEquals( 'admin', $admin-&gt;user_login );
+                $this-&gt;assertEquals( 'local@host.null', $admin-&gt;user_email );
+                $editor = get_user_by( 'login', 'editor' );
+                $this-&gt;assertEquals( 'editor', $editor-&gt;user_login );
+                $this-&gt;assertEquals( 'editor@example.org', $editor-&gt;user_email );
+                $this-&gt;assertEquals( 'FirstName', $editor-&gt;user_firstname );
+                $this-&gt;assertEquals( 'LastName', $editor-&gt;user_lastname );
+                $author = get_user_by( 'login', 'author' );
+                $this-&gt;assertEquals( 'author', $author-&gt;user_login );
+                $this-&gt;assertEquals( 'author@example.org', $author-&gt;user_email );
+
+                // check that terms were imported correctly
+                $this-&gt;assertEquals( 30, wp_count_terms( 'category' ) );
+                $this-&gt;assertEquals( 3, wp_count_terms( 'post_tag' ) );
+                $foo = get_term_by( 'slug', 'foo', 'category' );
+                $this-&gt;assertEquals( 0, $foo-&gt;parent );
+                $bar = get_term_by( 'slug', 'bar', 'category' );
+                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+                $this-&gt;assertEquals( $bar-&gt;term_id, $foo_bar-&gt;parent );
+
+                // check that posts/pages were imported correctly
+                $post_count = wp_count_posts( 'post' );
+                $this-&gt;assertEquals( 5, $post_count-&gt;publish );
+                $this-&gt;assertEquals( 1, $post_count-&gt;private );
+                $page_count = wp_count_posts( 'page' );
+                $this-&gt;assertEquals( 4, $page_count-&gt;publish );
+                $this-&gt;assertEquals( 1, $page_count-&gt;draft );
+                $comment_count = wp_count_comments();
+                $this-&gt;assertEquals( 1, $comment_count-&gt;total_comments );
+
+                $posts = get_posts( array( 'numberposts' =&gt; 20, 'post_type' =&gt; 'any', 'post_status' =&gt; 'any', 'orderby' =&gt; 'ID' ) );
+                $this-&gt;assertEquals( 11, count($posts) );
+
+                $post = $posts[0];
+                $this-&gt;assertEquals( 'Many Categories', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'many-categories', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID );
+                $this-&gt;assertEquals( 27, count($cats) );
+
+                $post = $posts[1];
+                $this-&gt;assertEquals( 'Non-standard post format', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'non-standard-post-format', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID );
+                $this-&gt;assertEquals( 1, count($cats) );
+                $this-&gt;assertTrue( has_post_format( 'aside', $post-&gt;ID ) );
+
+                $post = $posts[2];
+                $this-&gt;assertEquals( 'Top-level Foo', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'top-level-foo', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID, array( 'fields' =&gt; 'all' ) );
+                $this-&gt;assertEquals( 1, count($cats) );
+                $this-&gt;assertEquals( 'foo', $cats[0]-&gt;slug );
+
+                $post = $posts[3];
+                $this-&gt;assertEquals( 'Foo-child', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'foo-child', $post-&gt;post_name );
+                $this-&gt;assertEquals( $editor-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID, array( 'fields' =&gt; 'all' ) );
+                $this-&gt;assertEquals( 1, count($cats) );
+                $this-&gt;assertEquals( 'foo-bar', $cats[0]-&gt;slug );
+
+                $post = $posts[4];
+                $this-&gt;assertEquals( 'Private Post', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'private-post', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'private', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID );
+                $this-&gt;assertEquals( 1, count($cats) );
+                $tags = wp_get_post_tags( $post-&gt;ID );
+                $this-&gt;assertEquals( 3, count($tags) );
+                $this-&gt;assertEquals( 'tag1', $tags[0]-&gt;slug );
+                $this-&gt;assertEquals( 'tag2', $tags[1]-&gt;slug );
+                $this-&gt;assertEquals( 'tag3', $tags[2]-&gt;slug );
+
+                $post = $posts[5];
+                $this-&gt;assertEquals( '1-col page', $post-&gt;post_title );
+                $this-&gt;assertEquals( '1-col-page', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $this-&gt;assertEquals( 'onecolumn-page.php', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
+
+                $post = $posts[6];
+                $this-&gt;assertEquals( 'Draft Page', $post-&gt;post_title );
+                $this-&gt;assertEquals( '', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'draft', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
+
+                $post = $posts[7];
+                $this-&gt;assertEquals( 'Parent Page', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'parent-page', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
+
+                $post = $posts[8];
+                $this-&gt;assertEquals( 'Child Page', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'child-page', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( $posts[7]-&gt;ID, $post-&gt;post_parent );
+                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
+
+                $post = $posts[9];
+                $this-&gt;assertEquals( 'Sample Page', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'sample-page', $post-&gt;post_name );
+                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
+
+                $post = $posts[10];
+                $this-&gt;assertEquals( 'Hello world!', $post-&gt;post_title );
+                $this-&gt;assertEquals( 'hello-world', $post-&gt;post_name );
+                $this-&gt;assertEquals( $author-&gt;ID, $post-&gt;post_author );
+                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
+                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
+                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
+                $cats = wp_get_post_categories( $post-&gt;ID );
+                $this-&gt;assertEquals( 1, count($cats) );
+        }
+
+        function test_double_import() {
+                $authors = array( 'admin' =&gt; false, 'editor' =&gt; false, 'author' =&gt; false );
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+                $user_count = count_users();
+                $this-&gt;assertEquals( 3, $user_count['total_users'] );
+                $admin = get_user_by( 'login', 'admin' );
+                $this-&gt;assertEquals( 'admin', $admin-&gt;user_login );
+                $this-&gt;assertEquals( 'local@host.null', $admin-&gt;user_email );
+                $editor = get_user_by( 'login', 'editor' );
+                $this-&gt;assertEquals( 'editor', $editor-&gt;user_login );
+                $this-&gt;assertEquals( 'editor@example.org', $editor-&gt;user_email );
+                $this-&gt;assertEquals( 'FirstName', $editor-&gt;user_firstname );
+                $this-&gt;assertEquals( 'LastName', $editor-&gt;user_lastname );
+                $author = get_user_by( 'login', 'author' );
+                $this-&gt;assertEquals( 'author', $author-&gt;user_login );
+                $this-&gt;assertEquals( 'author@example.org', $author-&gt;user_email );
+
+                $this-&gt;assertEquals( 30, wp_count_terms( 'category' ) );
+                $this-&gt;assertEquals( 3, wp_count_terms( 'post_tag' ) );
+                $foo = get_term_by( 'slug', 'foo', 'category' );
+                $this-&gt;assertEquals( 0, $foo-&gt;parent );
+                $bar = get_term_by( 'slug', 'bar', 'category' );
+                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+                $this-&gt;assertEquals( $bar-&gt;term_id, $foo_bar-&gt;parent );
+
+                $post_count = wp_count_posts( 'post' );
+                $this-&gt;assertEquals( 5, $post_count-&gt;publish );
+                $this-&gt;assertEquals( 1, $post_count-&gt;private );
+                $page_count = wp_count_posts( 'page' );
+                $this-&gt;assertEquals( 4, $page_count-&gt;publish );
+                $this-&gt;assertEquals( 1, $page_count-&gt;draft );
+                $comment_count = wp_count_comments();
+                $this-&gt;assertEquals( 1, $comment_count-&gt;total_comments );
+        }
+
+        // function test_menu_import
+}
</ins></span></pre></div>
<a id="trunktestsimportparserphpfromrev903trunkteststest_import_wpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/import/parser.php (from rev 903, trunk/tests/test_import_wp.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/import/parser.php                                (rev 0)
+++ trunk/tests/import/parser.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,192 @@
</span><ins>+&lt;?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Parser extends WP_Import_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+        }
+
+        function test_malformed_wxr() {
+                $file = DIR_TESTDATA . '/export/malformed.xml';
+
+                // regex based parser cannot detect malformed XML
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
+                        $parser = new $p;
+                        $result = $parser-&gt;parse($file);
+                        $this-&gt;assertTrue( is_wp_error( $result ) );
+                        $this-&gt;assertEquals( 'There was an error when reading this WXR file', $result-&gt;get_error_message() );
+                }
+        }
+
+        function test_invalid_wxr() {
+                $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml';
+                $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml';
+
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        foreach ( array( $f1, $f2 ) as $file ) {
+                                $parser = new $p;
+                                $result = $parser-&gt;parse( $file );
+                                $this-&gt;assertTrue( is_wp_error( $result ) );
+                                $this-&gt;assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result-&gt;get_error_message() );
+                        }
+                }
+        }
+
+        function test_wxr_version_1_1() {
+                $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml';
+
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        $message = $p . ' failed';
+                        $parser = new $p;
+                        $result = $parser-&gt;parse( $file );
+
+                        $this-&gt;assertTrue( is_array( $result ), $message );
+                        $this-&gt;assertEquals( 'http://localhost/', $result['base_url'], $message );
+                        $this-&gt;assertEquals( array(
+                                'author_id' =&gt; 2,
+                                'author_login' =&gt; 'john',
+                                'author_email' =&gt; 'johndoe@example.org',
+                                'author_display_name' =&gt; 'John Doe',
+                                'author_first_name' =&gt; 'John',
+                                'author_last_name' =&gt; 'Doe'
+                        ), $result['authors']['john'], $message );
+                        $this-&gt;assertEquals( array(
+                                'term_id' =&gt; 3,
+                                'category_nicename' =&gt; 'alpha',
+                                'category_parent' =&gt; '',
+                                'cat_name' =&gt; 'alpha',
+                                'category_description' =&gt; 'The alpha category'
+                        ), $result['categories'][0], $message );
+                        $this-&gt;assertEquals( array(
+                                'term_id' =&gt; 22,
+                                'tag_slug' =&gt; 'clippable',
+                                'tag_name' =&gt; 'Clippable',
+                                'tag_description' =&gt; 'The Clippable post_tag'
+                        ), $result['tags'][0], $message );
+                        $this-&gt;assertEquals( array(
+                                'term_id' =&gt; 40,
+                                'term_taxonomy' =&gt; 'post_tax',
+                                'slug' =&gt; 'bieup',
+                                'term_parent' =&gt; '',
+                                'term_name' =&gt; 'bieup',
+                                'term_description' =&gt; 'The bieup post_tax'
+                        ), $result['terms'][0], $message );
+
+                        $this-&gt;assertEquals( 2, count($result['posts']), $message );
+                        $this-&gt;assertEquals( 19, count($result['posts'][0]), $message );
+                        $this-&gt;assertEquals( 18, count($result['posts'][1]), $message );
+                        $this-&gt;assertEquals( array(
+                                array( 'name' =&gt; 'alpha', 'slug' =&gt; 'alpha', 'domain' =&gt; 'category' ),
+                                array( 'name' =&gt; 'Clippable', 'slug' =&gt; 'clippable', 'domain' =&gt; 'post_tag' ),
+                                array( 'name' =&gt; 'bieup', 'slug' =&gt; 'bieup', 'domain' =&gt; 'post_tax' )
+                        ), $result['posts'][0]['terms'], $message );
+                        $this-&gt;assertEquals( array(
+                                array( 'key' =&gt; '_wp_page_template', 'value' =&gt; 'default' )
+                        ), $result['posts'][1]['postmeta'], $message );
+                }
+        }
+
+        function test_wxr_version_1_0() {
+                $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml';
+
+                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        $message = $p . ' failed';
+                        $parser = new $p;
+                        $result = $parser-&gt;parse( $file );
+
+                        $this-&gt;assertTrue( is_array( $result ), $message );
+                        $this-&gt;assertEquals( 'http://localhost/', $result['base_url'], $message );
+                        $this-&gt;assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
+                        $this-&gt;assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
+                        $this-&gt;assertEquals( $result['categories'][0]['category_parent'], '', $message );
+                        $this-&gt;assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
+                        $this-&gt;assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
+                        $this-&gt;assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );
+
+                        $this-&gt;assertEquals( 6, count($result['posts']), $message );
+                        $this-&gt;assertEquals( 19, count($result['posts'][0]), $message );
+                        $this-&gt;assertEquals( 18, count($result['posts'][1]), $message );
+
+                        $this-&gt;assertEquals( array(
+                                array( 'name' =&gt; 'Uncategorized', 'slug' =&gt; 'uncategorized', 'domain' =&gt; 'category' )
+                        ), $result['posts'][0]['terms'], $message );
+                        $this-&gt;assertEquals( array(
+                                array( 'name' =&gt; 'alpha', 'slug' =&gt; 'alpha', 'domain' =&gt; 'category' ),
+                                array( 'name' =&gt; 'news', 'slug' =&gt; 'news', 'domain' =&gt; 'tag' ),
+                                array( 'name' =&gt; 'roar', 'slug' =&gt; 'roar', 'domain' =&gt; 'tag' )
+                        ), $result['posts'][2]['terms'], $message );
+                        $this-&gt;assertEquals( array(
+                                array( 'name' =&gt; 'chicken', 'slug' =&gt; 'chicken', 'domain' =&gt; 'tag' ),
+                                array( 'name' =&gt; 'child', 'slug' =&gt; 'child', 'domain' =&gt; 'category' ),
+                                array( 'name' =&gt; 'face', 'slug' =&gt; 'face', 'domain' =&gt; 'tag' )
+                        ), $result['posts'][3]['terms'], $message );
+
+                        $this-&gt;assertEquals( array(
+                                array( 'key' =&gt; '_wp_page_template', 'value' =&gt; 'default' )
+                        ), $result['posts'][1]['postmeta'], $message );
+                }
+        }
+
+        /**
+         * Test the WXR parser's ability to correctly retrieve content from CDATA
+         * sections that contain escaped closing tags (&quot;]]&gt;&quot; -&gt; &quot;]]]]&gt;&lt;![CDATA[&gt;&quot;).
+         *
+         * @link http://core.trac.wordpress.org/ticket/15203
+         */
+        function test_escaped_cdata_closing_sequence() {
+                $file = DIR_TESTDATA . '/export/crazy-cdata-escaped.xml';
+
+                foreach( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+                        $message = 'Parser ' . $p;
+                        $parser = new $p;
+                        $result = $parser-&gt;parse( $file );
+
+                        $post = $result['posts'][0];
+                        $this-&gt;assertEquals( 'Content with nested &lt;![CDATA[ tags ]]&gt; :)', $post['post_content'], $message );
+                        foreach ( $post['postmeta'] as $meta ) {
+                                switch ( $meta['key'] ) {
+                                        case 'Plain string': $value = 'Foo'; break;
+                                        case 'Closing CDATA': $value = ']]&gt;'; break;
+                                        case 'Alot of CDATA': $value = 'This has &lt;![CDATA[ opening and ]]&gt; closing &lt;![CDATA[ tags like this: ]]&gt;'; break;
+                                        default: $this-&gt;fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
+                                }
+                                $this-&gt;assertEquals( $value, $meta['value'], $message );
+                        }
+                }
+        }
+
+        /**
+         * Ensure that the regex parser can still parse invalid CDATA blocks (i.e. those
+         * with &quot;]]&gt;&quot; unescaped within a CDATA section).
+         */
+        function test_unescaped_cdata_closing_sequence() {
+                $file = DIR_TESTDATA . '/export/crazy-cdata.xml';
+
+                $parser = new WXR_Parser_Regex;
+                $result = $parser-&gt;parse( $file );
+
+                $post = $result['posts'][0];
+                $this-&gt;assertEquals( 'Content with nested &lt;![CDATA[ tags ]]&gt; :)', $post['post_content'] );
+                foreach ( $post['postmeta'] as $meta ) {
+                        switch ( $meta['key'] ) {
+                                case 'Plain string': $value = 'Foo'; break;
+                                case 'Closing CDATA': $value = ']]&gt;'; break;
+                                case 'Alot of CDATA': $value = 'This has &lt;![CDATA[ opening and ]]&gt; closing &lt;![CDATA[ tags like this: ]]&gt;'; break;
+                                default: $this-&gt;fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
+                        }
+                        $this-&gt;assertEquals( $value, $meta['value'] );
+                }
+        }
+
+        // tags in CDATA #11574
+}
</ins></span></pre></div>
<a id="trunktestsimportpostmetaphpfromrev903trunkteststest_import_wpphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/import/postmeta.php (from rev 903, trunk/tests/test_import_wp.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/import/postmeta.php                                (rev 0)
+++ trunk/tests/import/postmeta.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+&lt;?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+
+                if ( ! defined( 'WP_IMPORTING' ) )
+                        define( 'WP_IMPORTING', true );
+
+                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+                        define( 'WP_LOAD_IMPORTERS', true );
+
+                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+        }
+
+        function test_serialized_postmeta_no_cdata() {
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' =&gt; 'john' ) );
+                $expected['special_post_title'] = 'A special title';
+                $expected['is_calendar'] = '';
+                $this-&gt;assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
+        }
+
+        function test_utw_postmeta() {
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-utw-post-meta-import.xml', array( 'johncoswell' =&gt; 'john' ) );
+
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;album&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;apple&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;art&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;artwork&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;dead-tracks&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;ipod&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;itunes&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;javascript&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;lyrics&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;script&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;tracks&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;windows-scripting-host&quot;;
+                $expected[] = $classy;
+                $classy = new StdClass();
+                $classy-&gt;tag =  &quot;wscript&quot;;
+                $expected[] = $classy;
+
+                $this-&gt;assertEquals( $expected, get_post_meta( 150, 'test', true ) );
+        }
+
+        /**
+         * @ticket 9633
+         */
+        function test_serialized_postmeta_with_cdata() {
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' =&gt; 'johncoswell' ) );
+
+                //HTML in the CDATA should work with old WordPress version
+                $this-&gt;assertEquals( '&lt;pre&gt;some html&lt;/pre&gt;', get_post_meta( 10, 'contains-html', true ) );
+                //Serialised will only work with 3.0 onwards.
+                $expected[&quot;special_post_title&quot;] = &quot;A special title&quot;;
+                $expected[&quot;is_calendar&quot;] = &quot;&quot;;
+                $this-&gt;assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );
+        }
+
+        /**
+         * @ticket 11574
+         */
+        function test_serialized_postmeta_with_evil_stuff_in_cdata() {
+                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' =&gt; 'johncoswell' ) );
+                // evil content in the CDATA
+                $this-&gt;assertEquals( '&lt;wp:meta_value&gt;evil&lt;/wp:meta_value&gt;', get_post_meta( 10, 'evil', true ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestsmailphpfromrev904trunkteststest_includes_pluggablephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/mail.php (from rev 904, trunk/tests/test_includes_pluggable.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/mail.php                                (rev 0)
+++ trunk/tests/mail.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,213 @@
</span><ins>+&lt;?php
+
+/**
+ * @group pluggable
+ * @group mail
+ * @ticket UT47
+ */
+class Tests_Mail extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+        }
+
+        function test_wp_mail_custom_boundaries() {
+                $to = 'user@example.com';
+                $subject = 'Test email with custom boundaries';
+                $headers  = '' . &quot;\n&quot;;
+                $headers .= 'MIME-Version: 1.0' . &quot;\n&quot;;
+                $headers .= 'Content-Type: multipart/mixed; boundary=&quot;----=_Part_4892_25692638.1192452070893&quot;' . &quot;\n&quot;;
+                $headers .= &quot;\n&quot;;
+                $body  = &quot;\n&quot;;
+                $body .= '------=_Part_4892_25692638.1192452070893' . &quot;\n&quot;;
+                $body .= 'Content-Type: text/plain; charset=ISO-8859-1' . &quot;\n&quot;;
+                $body .= 'Content-Transfer-Encoding: 7bit' . &quot;\n&quot;;
+                $body .= 'Content-Disposition: inline' . &quot;\n&quot;;
+                $body .= &quot;\n&quot;;
+                $body .= 'Here is a message with an attachment of a binary file.' . &quot;\n&quot;;
+                $body .= &quot;\n&quot;;
+                $body .= '------=_Part_4892_25692638.1192452070893' . &quot;\n&quot;;
+                $body .= 'Content-Type: image/x-icon; name=favicon.ico' . &quot;\n&quot;;
+                $body .= 'Content-Transfer-Encoding: base64' . &quot;\n&quot;;
+                $body .= 'Content-Disposition: attachment; filename=favicon.ico' . &quot;\n&quot;;
+                $body .= &quot;\n&quot;;
+                $body .= 'AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
+                $body .= 'AAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA' . &quot;\n&quot;;
+                $body .= '/wD/AP//AAD///8A//3/AP39/wD6/f8A+P3/AP/8/wD9/P8A+vz/AP/7/wD/+v8A/vr/APz6/wD4' . &quot;\n&quot;;
+                $body .= '+v8A+/n/APP5/wD/+P8A+vj/AO/4/wDm+P8A2fj/AP/3/wD/9v8A9vb/AP/1/wD69f8A9PT/AO30' . &quot;\n&quot;;
+                $body .= '/wD/8/8A//L/APnx/wD28P8A///+APj//gD2//4A9P/+AOP//gD//f4A6f/9AP///AD2//wA8//8' . &quot;\n&quot;;
+                $body .= 'APf9/AD///sA/v/7AOD/+wD/+vsA9/X7APr/+gDv/voA///5AP/9+QD/+/kA+e35AP//+ADm//gA' . &quot;\n&quot;;
+                $body .= '4f/4AP/9+AD0+/gA///3APv/9wDz//cA8f/3AO3/9wD/8fcA//32AP369gDr+vYA8f/1AOv/9QD/' . &quot;\n&quot;;
+                $body .= '+/UA///0APP/9ADq//QA///zAP/18wD///IA/fzyAP//8QD///AA9//wAPjw8AD//+8A8//vAP//' . &quot;\n&quot;;
+                $body .= '7gD9/+4A9v/uAP/u7gD//+0A9v/tAP7/6wD/+eoA///pAP//6AD2/+gA//nnAP/45wD38eYA/fbl' . &quot;\n&quot;;
+                $body .= 'AP/25AD29uQA7N/hAPzm4AD/690AEhjdAAAa3AAaJdsA//LXAC8g1gANH9YA+dnTAP/n0gDh5dIA' . &quot;\n&quot;;
+                $body .= 'DyjSABkk0gAdH9EABxDRAP/l0AAAJs4AGRTOAPPczQAAKs0AIi7MAA4UywD56soA8tPKANTSygD/' . &quot;\n&quot;;
+                $body .= '18kA6NLHAAAjxwDj28QA/s7CAP/1wQDw3r8A/9e8APrSrwDCtqoAzamjANmPiQDQj4YA35mBAOme' . &quot;\n&quot;;
+                $body .= 'fgDHj3wA1qR6AO+sbwDpmm8A2IVlAKmEYgCvaFoAvHNXAEq2VgA5s1UAPbhQAFWtTwBStU0ARbNN' . &quot;\n&quot;;
+                $body .= 'AEGxTQA7tEwAObZIAEq5RwDKdEYAULhDANtuQgBEtTwA1ls3ALhgMQCxNzEA2FsvAEC3LQB0MCkA' . &quot;\n&quot;;
+                $body .= 'iyYoANZTJwDLWyYAtjMlALE6JACZNSMAuW4iANlgIgDoWCEAylwgAMUuIAD3Vh8A52gdALRCHQCx' . &quot;\n&quot;;
+                $body .= 'WhwAsEkcALU4HACMOBwA0V4bAMYyGgCPJRoA218ZAJM7FwC/PxYA0msVAM9jFQD2XBUAqioVAIAf' . &quot;\n&quot;;
+                $body .= 'FQDhYRQAujMTAMUxEwCgLBMAnxIPAMsqDgCkFgsA6GMHALE2BAC9JQAAliIAAFYTAAAAAAAAAAAA' . &quot;\n&quot;;
+                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
+                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/' . &quot;\n&quot;;
+                $body .= '//8AsbGxsbGxsbGxsbGxsbGxd7IrMg8PDw8PDw8PUBQeJXjQYE9PcKPM2NfP2sWhcg+BzTE7dLjb' . &quot;\n&quot;;
+                $body .= 'mG03YWaV4JYye8MPbsLZlEouKRRCg9SXMoW/U53enGRAFzCRtNO7mTiAyliw30gRTg9VbJCKfYs0' . &quot;\n&quot;;
+                $body .= 'j9VmuscfLTFbIy8SOhA0Inq5Y77GNBMYIxQUJzM2Vxx2wEmfyCYWMRldXCg5MU0aicRUms58SUVe' . &quot;\n&quot;;
+                $body .= 'RkwjPBRSNIfBMkSgvWkyPxVHFIaMSx1/0S9nkq7WdWo1a43Jt2UqgtJERGJ5m6K8y92znpNWIYS1' . &quot;\n&quot;;
+                $body .= 'UQ89Mmg5cXNaX0EkGyyI3KSsp6mvpaqosaatq7axsQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
+                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' . &quot;\n&quot;;
+                $body .= '------=_Part_4892_25692638.1192452070893--' . &quot;\n&quot;;
+                $body .= &quot;\n&quot;;
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail($to, $subject, $body, $headers);
+
+                // We need some better assertions here but these catch the failure for now.
+                $this-&gt;assertEquals($body, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                $this-&gt;assertTrue(strpos($GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], 'boundary=&quot;----=_Part_4892_25692638.1192452070893&quot;') &gt; 0);
+                $this-&gt;assertTrue(strpos($GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], 'charset=&quot;&quot;') &gt; 0);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+
+        /**
+         * @ticket 15448
+         */
+        function test_wp_mail_plain_and_html() {
+
+                $to = 'user@example.com';
+                $subject = 'Test email with plain text and html versions';
+                $messages = array( 'text/plain' =&gt; 'Here is some plain text.',
+                                           'text/html' =&gt;'&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Here is the HTML ;-)&lt;body&gt;&lt;/html&gt;' );
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail( $to, $subject, $messages );
+
+                preg_match( '/boundary=&quot;(.*)&quot;/', $GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], $matches);
+                $boundry = $matches[1];
+                $body = '--' . $boundry . '
+Content-Type: text/plain; charset = &quot;UTF-8&quot;
+Content-Transfer-Encoding: 8bit
+
+Here is some plain text.
+
+
+--' . $boundry . '
+Content-Type: text/html; charset = &quot;UTF-8&quot;
+Content-Transfer-Encoding: 8bit
+
+&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Here is the HTML ;-)&lt;body&gt;&lt;/html&gt;
+
+
+
+--' . $boundry . '--
+';
+                // We need some better assertions here but these test the behaviour for now.
+                $this-&gt;assertEquals($body, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+
+        /**
+         * @ticket 17305
+         */
+        function test_wp_mail_rfc2822_addresses() {
+
+                $to = &quot;Name &lt;address@tld.com&gt;&quot;;
+                $from = &quot;Another Name &lt;another_address@different-tld.com&gt;&quot;;
+                $cc = &quot;The Carbon Guy &lt;cc@cc.com&gt;&quot;;
+                $bcc = &quot;The Blind Carbon Guy &lt;bcc@bcc.com&gt;&quot;;
+                $subject = &quot;RFC2822 Testing&quot;;
+                $message = &quot;My RFC822 Test Message&quot;;
+                $headers[] = &quot;From: {$from}&quot;;
+                $headers[] = &quot;CC: {$cc}&quot;;
+                $headers[] = &quot;BCC: {$bcc}&quot;;
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail( $to, $subject, $message, $headers );
+
+                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
+                // Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
+                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) ) {
+                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                        $this-&gt;assertEquals('Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][1]);
+                        $this-&gt;assertEquals('cc@cc.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][0]);
+                        $this-&gt;assertEquals('The Carbon Guy', $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][1]);
+                        $this-&gt;assertEquals('bcc@bcc.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][0]);
+                        $this-&gt;assertEquals('The Blind Carbon Guy', $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][1]);
+                } else {
+                        $this-&gt;assertEquals($to, $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                        $this-&gt;assertEquals($cc, $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][0]);
+                        $this-&gt;assertEquals($bcc, $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][0]);
+                }
+
+                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+
+        /**
+         * @ticket 17305
+         */
+        function test_wp_mail_multiple_rfc2822_to_addresses() {
+
+                $to = &quot;Name &lt;address@tld.com&gt;, Another Name &lt;another_address@different-tld.com&gt;&quot;;
+                $subject = &quot;RFC2822 Testing&quot;;
+                $message = &quot;My RFC822 Test Message&quot;;
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail( $to, $subject, $message );
+
+                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
+                // Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
+                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) ) {
+                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                        $this-&gt;assertEquals('Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][1]);
+                        $this-&gt;assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
+                        $this-&gt;assertEquals('Another Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][1]);
+                } else {
+                        $this-&gt;assertEquals('Name &lt;address@tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                        $this-&gt;assertEquals('Another Name &lt;another_address@different-tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
+                }
+
+                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+
+        function test_wp_mail_multiple_to_addresses() {
+                $to = &quot;address@tld.com, another_address@different-tld.com&quot;;
+                $subject = &quot;RFC2822 Testing&quot;;
+                $message = &quot;My RFC822 Test Message&quot;;
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail( $to, $subject, $message );
+
+                $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                $this-&gt;assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
+                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+
+        /**
+         * @ticket 18463
+         */
+        function test_wp_mail_to_address_no_name() {
+
+                $to = &quot;&lt;address@tld.com&gt;&quot;;
+                $subject = &quot;RFC2822 Testing&quot;;
+                $message = &quot;My RFC822 Test Message&quot;;
+
+                unset($GLOBALS['phpmailer']-&gt;mock_sent);
+                $_SERVER['SERVER_NAME'] = 'example.com';
+                wp_mail( $to, $subject, $message );
+
+                // Old PHPMailer blindly accepts the address, the new one santizes it
+                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) )
+                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                else
+                        $this-&gt;assertEquals('&lt;address@tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
+                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
+                unset( $_SERVER['SERVER_NAME'] );
+        }
+}
</ins></span></pre></div>
<a id="trunktestspostattachmentsphpfromrev903trunkteststest_includes_postphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/attachments.php (from rev 903, trunk/tests/test_includes_post.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/attachments.php                                (rev 0)
+++ trunk/tests/post/attachments.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,205 @@
</span><ins>+&lt;?php
+
+/**
+ * @group post
+ * @group media
+ * @group upload
+ */
+class Tests_Post_Attachments extends WP_UnitTestCase {
+
+        function tearDown() {
+                // Remove all uploads.
+                $uploads = wp_upload_dir();
+                foreach ( scandir( $uploads['basedir'] ) as $file )
+                        _rmdir( $uploads['basedir'] . '/' . $file );
+
+                parent::tearDown();
+        }
+
+        function _make_attachment($upload, $parent_post_id=-1) {
+
+                $type = '';
+                if ( !empty($upload['type']) ) {
+                        $type = $upload['type'];
+                } else {
+                        $mime = wp_check_filetype( $upload['file'] );
+                        if ($mime)
+                                $type = $mime['type'];
+                }
+
+                $attachment = array(
+                        'post_title' =&gt; basename( $upload['file'] ),
+                        'post_content' =&gt; '',
+                        'post_type' =&gt; 'attachment',
+                        'post_parent' =&gt; $parent_post_id,
+                        'post_mime_type' =&gt; $type,
+                        'guid' =&gt; $upload[ 'url' ],
+                );
+
+                // Save the data
+                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent_post_id );
+                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+
+                return $this-&gt;ids[] = $id;
+
+        }
+
+        function test_insert_bogus_image() {
+                $filename = rand_str().'.jpg';
+                $contents = rand_str();
+
+                $upload = wp_upload_bits($filename, null, $contents);
+                $this-&gt;assertTrue( empty($upload['error']) );
+
+                $id = $this-&gt;_make_attachment($upload);
+        }
+
+        function test_insert_image_no_thumb() {
+
+                // this image is smaller than the thumbnail size so it won't have one
+                $filename = ( DIR_TESTDATA.'/images/test-image.jpg' );
+                $contents = file_get_contents($filename);
+
+                $upload = wp_upload_bits(basename($filename), null, $contents);
+                $this-&gt;assertTrue( empty($upload['error']) );
+
+                $id = $this-&gt;_make_attachment($upload);
+
+                // intermediate copies should not exist
+                $this-&gt;assertFalse( image_get_intermediate_size($id, 'thumbnail') );
+                $this-&gt;assertFalse( image_get_intermediate_size($id, 'medium') );
+
+                // medium and full size will both point to the original
+                $downsize = image_downsize($id, 'medium');
+                $this-&gt;assertEquals( 'test-image.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 50, $downsize[1] );
+                $this-&gt;assertEquals( 50, $downsize[2] );
+
+                $downsize = image_downsize($id, 'full');
+                $this-&gt;assertEquals( 'test-image.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 50, $downsize[1] );
+                $this-&gt;assertEquals( 50, $downsize[2] );
+
+        }
+
+        function test_insert_image_thumb_only() {
+                update_option( 'medium_size_w', 0 );
+                update_option( 'medium_size_h', 0 );
+
+                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+                $contents = file_get_contents($filename);
+
+                $upload = wp_upload_bits(basename($filename), null, $contents);
+                $this-&gt;assertTrue( empty($upload['error']) );
+
+                $id = $this-&gt;_make_attachment($upload);
+
+                // intermediate copies should exist: thumbnail only
+                $thumb = image_get_intermediate_size($id, 'thumbnail');
+                $this-&gt;assertEquals( 'a2-small-150x150.jpg', $thumb['file'] );
+
+                $uploads = wp_upload_dir();
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+                $this-&gt;assertFalse( image_get_intermediate_size($id, 'medium') );
+
+                // the thumb url should point to the thumbnail intermediate
+                $this-&gt;assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
+
+                // image_downsize() should return the correct images and sizes
+                $downsize = image_downsize($id, 'thumbnail');
+                $this-&gt;assertEquals( 'a2-small-150x150.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 150, $downsize[1] );
+                $this-&gt;assertEquals( 150, $downsize[2] );
+
+                // medium and full will both point to the original
+                $downsize = image_downsize($id, 'medium');
+                $this-&gt;assertEquals( 'a2-small.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 400, $downsize[1] );
+                $this-&gt;assertEquals( 300, $downsize[2] );
+
+                $downsize = image_downsize($id, 'full');
+                $this-&gt;assertEquals( 'a2-small.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 400, $downsize[1] );
+                $this-&gt;assertEquals( 300, $downsize[2] );
+
+        }
+
+        function test_insert_image_medium() {
+                update_option('medium_size_w', 400);
+                update_option('medium_size_h', 0);
+
+                $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
+                $contents = file_get_contents($filename);
+
+                $upload = wp_upload_bits(basename($filename), null, $contents);
+                $this-&gt;assertTrue( empty($upload['error']) );
+
+                $id = $this-&gt;_make_attachment($upload);
+                $uploads = wp_upload_dir();
+
+                // intermediate copies should exist: thumbnail and medium
+                $thumb = image_get_intermediate_size($id, 'thumbnail');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+                $medium = image_get_intermediate_size($id, 'medium');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
+
+                // the thumb url should point to the thumbnail intermediate
+                $this-&gt;assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
+
+                // image_downsize() should return the correct images and sizes
+                $downsize = image_downsize($id, 'thumbnail');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 150, $downsize[1] );
+                $this-&gt;assertEquals( 150, $downsize[2] );
+
+                $downsize = image_downsize($id, 'medium');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 400, $downsize[1] );
+                $this-&gt;assertEquals( 602, $downsize[2] );
+
+                $downsize = image_downsize($id, 'full');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) );
+                $this-&gt;assertEquals( 680, $downsize[1] );
+                $this-&gt;assertEquals( 1024, $downsize[2] );
+        }
+
+
+        function test_insert_image_delete() {
+                update_option('medium_size_w', 400);
+                update_option('medium_size_h', 0);
+
+                $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
+                $contents = file_get_contents($filename);
+
+                $upload = wp_upload_bits(basename($filename), null, $contents);
+                $this-&gt;assertTrue( empty($upload['error']) );
+
+                $id = $this-&gt;_make_attachment($upload);
+                $uploads = wp_upload_dir();
+
+                // check that the file and intermediates exist
+                $thumb = image_get_intermediate_size($id, 'thumbnail');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+                $medium = image_get_intermediate_size($id, 'medium');
+                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
+
+                $meta = wp_get_attachment_metadata($id);
+                $original = $meta['file'];
+                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) );
+
+                // now delete the attachment and make sure all files are gone
+                wp_delete_attachment($id);
+
+                $this-&gt;assertFalse( is_file($thumb['path']) );
+                $this-&gt;assertFalse( is_file($medium['path']) );
+                $this-&gt;assertFalse( is_file($original) );
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestspostgalleryphpfromrev903trunkteststest_post_outputphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/gallery.php (from rev 903, trunk/tests/test_post_output.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/gallery.php                                (rev 0)
+++ trunk/tests/post/gallery.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+&lt;?php
+
+/**
+ * @group media
+ * @group gallery
+ * @ticket UT30
+ */
+class Tests_Post_Gallery extends WP_UnitTestCase { // _WPDataset1
+        function setUp() {
+                parent::setUp();
+                global $wp_rewrite;
+                $wp_rewrite-&gt;set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+                $wp_rewrite-&gt;flush_rules();
+        }
+
+        function test_the_content() {
+                // permalink page
+                $link = '/2008/04/01/simple-gallery-test/';
+                $this-&gt;go_to('/2008/04/01/simple-gallery-test/');
+                the_post();
+                // filtered output
+                $out = get_echo('the_content');
+                $this-&gt;assertNotEmpty($out, &quot;Could not get the_content for $link.&quot;);
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;p&gt;There are ten images attached to this post.  Here&amp;#8217;s a gallery:&lt;/p&gt;
+
+                &lt;style type='text/css'&gt;
+                        .gallery {
+                                margin: auto;
+                        }
+                        .gallery-item {
+                                float: left;
+                                margin-top: 10px;
+                                text-align: center;
+                                width: 33%;                        }
+                        .gallery img {
+                                border: 2px solid #cfcfcf;
+                        }
+                        .gallery-caption {
+                                margin-left: 0;
+                        }
+                &lt;/style&gt;
+                &lt;!-- see gallery_shortcode() in wp-includes/media.php --&gt;
+                &lt;div class='gallery'&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20040724_152504_53/' title='dsc20040724_152504_53'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/canola/' title='canola'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/canola3.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050315_145007_13/' title='dsc20050315_145007_13'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050604_133440_34/' title='dsc20050604_133440_34'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050831_165238_33/' title='dsc20050831_165238_33'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050901_105100_21/' title='dsc20050901_105100_21'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050813_115856_5/' title='dsc20050813_115856_5'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050720_123726_27/' title='dsc20050720_123726_27'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050727_091048_22/' title='Title: Seedlings'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050726_083116_18/' title='dsc20050726_083116_18'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;
+                        &lt;br style='clear: both;' /&gt;
+                &lt;/div&gt;
+
+&lt;p&gt;It&amp;#8217;s the simplest form of the gallery tag.  All images are from the public domain site burningwell.org.&lt;/p&gt;
+&lt;p&gt;The images have various combinations of titles, captions and descriptions.&lt;/p&gt;
+EOF;
+                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
+        }
+
+        function test_gallery_attributes() {
+                // make sure the gallery shortcode attributes are parsed correctly
+
+                $id = 575;
+                $post = get_post($id);
+                $this-&gt;assertNotNull($post, &quot;get_post($id) could not find the post.&quot;);
+                $post-&gt;post_content = '[gallery columns=&quot;1&quot; size=&quot;medium&quot;]';
+                wp_update_post($post);
+
+                // permalink page
+                $this-&gt;go_to('/2008/04/01/simple-gallery-test/');
+                the_post();
+                // filtered output
+                $out = get_echo('the_content');
+
+                $expected = &lt;&lt;&lt;EOF
+                &lt;style type='text/css'&gt;
+                        .gallery {
+                                margin: auto;
+                        }
+                        .gallery-item {
+                                float: left;
+                                margin-top: 10px;
+                                text-align: center;
+                                width: 100%;                        }
+                        .gallery img {
+                                border: 2px solid #cfcfcf;
+                        }
+                        .gallery-caption {
+                                margin-left: 0;
+                        }
+                &lt;/style&gt;
+                &lt;!-- see gallery_shortcode() in wp-includes/media.php --&gt;
+                &lt;div class='gallery'&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=565' title='dsc20040724_152504_53'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=566' title='canola'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/canola3.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=567' title='dsc20050315_145007_13'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=568' title='dsc20050604_133440_34'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=569' title='dsc20050831_165238_33'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=570' title='dsc20050901_105100_21'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=571' title='dsc20050813_115856_5'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=572' title='dsc20050720_123726_27'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=573' title='Title: Seedlings'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
+                        &lt;dt class='gallery-icon'&gt;
+                                &lt;a href='http://example.com/?attachment_id=574' title='dsc20050726_083116_18'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
+                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;
+                        &lt;br style='clear: both;' /&gt;
+                &lt;/div&gt;
+
+EOF;
+                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
+        }
+
+}
</ins></span></pre></div>
<a id="trunktestspostmetaphpfromrev903trunkteststest_includes_postphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/meta.php (from rev 903, trunk/tests/test_includes_post.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/meta.php                                (rev 0)
+++ trunk/tests/post/meta.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,246 @@
</span><ins>+&lt;?php
+
+/**
+ * @group post
+ * @group meta
+ */
+class Tests_Post_Meta extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+
+                $this-&gt;author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author-&gt;ID,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                );
+
+                // insert a post
+                $this-&gt;post_id = wp_insert_post($post);
+
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author-&gt;ID,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                );
+
+                // insert a post
+                $this-&gt;post_id_2 = wp_insert_post($post);
+        }
+
+        function tearDown() {
+                parent::tearDown();
+                wp_delete_post($this-&gt;post_id);
+                wp_delete_post($this-&gt;post_id_2);
+        }
+
+        function test_unique_postmeta() {
+                // Add a unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique', 'value', true) );
+
+                // Check unique is enforced
+                $this-&gt;assertFalse(add_post_meta($this-&gt;post_id, 'unique', 'another value', true));
+
+                //Check it exists
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique', true));
+                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique', false));
+
+                //Fail to delete the wrong value
+                $this-&gt;assertFalse(delete_post_meta($this-&gt;post_id, 'unique', 'wrong value'));
+
+                //Delete it
+                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'unique', 'value'));
+
+                //Check it is deleted
+                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id, 'unique', true));
+                $this-&gt;assertEquals(array(), get_post_meta($this-&gt;post_id, 'unique', false));
+
+        }
+
+        function test_nonunique_postmeta() {
+                // Add two non unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'value') );
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'another value'));
+
+                //Check they exists
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique', true));
+                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique', false));
+
+                //Fail to delete the wrong value
+                $this-&gt;assertFalse(delete_post_meta($this-&gt;post_id, 'nonunique', 'wrong value'));
+
+                //Delete the first one
+                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'nonunique', 'value'));
+
+                //Check the remainder exists
+                $this-&gt;assertEquals('another value', get_post_meta($this-&gt;post_id, 'nonunique', true));
+                $this-&gt;assertEquals(array('another value'), get_post_meta($this-&gt;post_id, 'nonunique', false));
+
+                //Add a third one
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'someother value') );
+
+                //Check they exists
+                $expected = array(
+                        'someother value',
+                        'another value'
+                );
+                sort( $expected );
+                $this-&gt;assertTrue( in_array( get_post_meta( $this-&gt;post_id, 'nonunique', true ), $expected ) );
+                $actual = get_post_meta( $this-&gt;post_id, 'nonunique', false );
+                sort( $actual );
+                $this-&gt;assertEquals( $expected, $actual );
+
+                //Delete the lot
+                $this-&gt;assertTrue(delete_post_meta_by_key('nonunique'));
+        }
+
+        function test_update_post_meta() {
+                // Add a unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_update', 'value', true) );
+
+                // Add two non unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique_update', 'value') );
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique_update', 'another value') );
+
+                //Check they exists
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_update', true));
+                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique_update', false));
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
+                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
+
+                // Update them
+                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'unique_update', 'new', 'value'));
+                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'nonunique_update', 'new', 'value'));
+                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'nonunique_update', 'another new', 'another value'));
+
+                //Check they updated
+                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'unique_update', true));
+                $this-&gt;assertEquals(array('new'), get_post_meta($this-&gt;post_id, 'unique_update', false));
+                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
+                $this-&gt;assertEquals(array('new', 'another new'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
+
+        }
+
+        function test_delete_post_meta() {
+                // Add a unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_delete', 'value', true) );
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id_2, 'unique_delete', 'value', true) );
+
+                //Check they exists
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_delete', true));
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete', true));
+
+                //Delete one of them
+                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'unique_delete', 'value'));
+
+                //Check the other still exitsts
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete', true));
+
+
+        }
+
+        function test_delete_post_meta_by_key() {
+                // Add a unique post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_delete_by_key', 'value', true) );
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', 'value', true) );
+
+                //Check they exist
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_delete_by_key', true));
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
+
+                //Delete one of them
+                $this-&gt;assertTrue(delete_post_meta_by_key('unique_delete_by_key'));
+
+                //Check the other still exists
+                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
+                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
+        }
+
+        function test_get_post_meta_by_id() {
+                $mid = add_post_meta( $this-&gt;post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true );
+                $this-&gt;assertInternalType( 'integer', $mid );
+
+                $mobj = new stdClass;
+                $mobj-&gt;meta_id = $mid;
+                $mobj-&gt;post_id = $this-&gt;post_id;
+                $mobj-&gt;meta_key = 'get_post_meta_by_key';
+                $mobj-&gt;meta_value = 'get_post_meta_by_key_value';
+                $this-&gt;assertEquals( $mobj, get_post_meta_by_id( $mid ) );
+                delete_metadata_by_mid( 'post', $mid );
+
+                $mid = add_post_meta( $this-&gt;post_id, 'get_post_meta_by_key', array( 'foo', 'bar' ), true );
+                $this-&gt;assertInternalType( 'integer', $mid );
+                $mobj-&gt;meta_id = $mid;
+                $mobj-&gt;meta_value = array( 'foo', 'bar' );
+                $this-&gt;assertEquals( $mobj, get_post_meta_by_id( $mid ) );
+                delete_metadata_by_mid( 'post', $mid );
+        }
+
+        function test_delete_meta() {
+                $mid = add_post_meta( $this-&gt;post_id, 'delete_meta', 'delete_meta_value', true );
+                $this-&gt;assertInternalType( 'integer', $mid );
+
+                $this-&gt;assertTrue( delete_meta( $mid ) );
+                $this-&gt;assertFalse( get_metadata_by_mid( 'post', $mid ) );
+
+                $this-&gt;assertFalse( delete_meta( 123456789 ) );
+        }
+
+        function test_update_meta() {
+                // Add a unique post meta item
+                $this-&gt;assertInternalType( 'integer', $mid1 = add_post_meta($this-&gt;post_id, 'unique_update', 'value', true) );
+
+                // Add two non unique post meta item
+                $this-&gt;assertInternalType( 'integer', $mid2 = add_post_meta($this-&gt;post_id, 'nonunique_update', 'value') );
+                $this-&gt;assertInternalType( 'integer', $mid3 = add_post_meta($this-&gt;post_id, 'nonunique_update', 'another value') );
+
+                //Check they exist
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_update', true));
+                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique_update', false));
+                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
+                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
+
+                // Update them
+                $this-&gt;assertTrue( update_meta( $mid1, 'unique_update', 'new' ) );
+                $this-&gt;assertTrue( update_meta( $mid2, 'nonunique_update', 'new' ) );
+                $this-&gt;assertTrue( update_meta( $mid3, 'nonunique_update', 'another new' ) );
+
+                //Check they updated
+                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'unique_update', true));
+                $this-&gt;assertEquals(array('new'), get_post_meta($this-&gt;post_id, 'unique_update', false));
+                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
+                $this-&gt;assertEquals(array('new', 'another new'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
+
+                // Slashed update
+                $data = &quot;'quote and \slash&quot;;
+                $this-&gt;assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) );
+                $meta = get_metadata_by_mid( 'post', $mid1 );
+                $this-&gt;assertEquals( $data, $meta-&gt;meta_value );
+        }
+
+        /**
+         * @ticket 12860
+         */
+        function test_funky_post_meta() {
+                $classy = new StdClass();
+                $classy-&gt;ID = 1;
+                $classy-&gt;stringy = &quot;I love slashes\\\\&quot;;
+                $funky_meta[] = $classy;
+
+                $classy = new StdClass();
+                $classy-&gt;ID = 2;
+                $classy-&gt;stringy = &quot;I love slashes\\\\ more&quot;;
+                $funky_meta[] = $classy;
+
+                // Add a post meta item
+                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'test_funky_post_meta', $funky_meta, true) );
+
+                //Check they exists
+                $this-&gt;assertEquals($funky_meta, get_post_meta($this-&gt;post_id, 'test_funky_post_meta', true));
+
+        }
+}
</ins></span></pre></div>
<a id="trunktestspostoutputphpfromrev903trunkteststest_post_outputphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/output.php (from rev 903, trunk/tests/test_post_output.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/output.php                                (rev 0)
+++ trunk/tests/post/output.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+&lt;?php
+
+// test the output of post template tags etc
+
+/**
+ * @group post
+ * @group formatting
+ */
+class Tests_Post_Output extends WP_UnitTestCase {
+
+        function setUp() {
+                parent::setUp();
+                add_shortcode( 'dumptag', array( $this, '_shortcode_dumptag' ) );
+                add_shortcode( 'paragraph', array( $this, '_shortcode_paragraph' ) );
+        }
+
+        function tearDown() {
+                global $shortcode_tags;
+                unset( $shortcode_tags['dumptag'], $shortcode_tags['paragraph'] );
+                parent::tearDown();
+        }
+
+        function _shortcode_dumptag( $atts ) {
+                $out = '';
+                foreach ($atts as $k=&gt;$v)
+                        $out .= &quot;$k = $v\n&quot;;
+                return $out;
+        }
+
+        function _shortcode_paragraph( $atts, $content ) {
+                extract(shortcode_atts(array(
+                        'class' =&gt; 'graf',
+                ), $atts));
+                return &quot;&lt;p class='$class'&gt;$content&lt;/p&gt;\n&quot;;
+        }
+
+        function test_the_content() {
+                $post_content = &lt;&lt;&lt;EOF
+&lt;i&gt;This is the excerpt.&lt;/i&gt;
+&lt;!--more--&gt;
+This is the &lt;b&gt;body&lt;/b&gt;.
+EOF;
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;p&gt;&lt;i&gt;This is the excerpt.&lt;/i&gt;&lt;br /&gt;
+&lt;span id=&quot;more-{$post_id}&quot;&gt;&lt;/span&gt;&lt;br /&gt;
+This is the &lt;b&gt;body&lt;/b&gt;.&lt;/p&gt;
+EOF;
+
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertTrue( is_single() );
+                $this-&gt;assertTrue( have_posts() );
+                $this-&gt;assertNull( the_post() );
+
+                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+        }
+
+        function test_the_content_shortcode() {
+                $post_content = &lt;&lt;&lt;EOF
+[dumptag foo=&quot;bar&quot; baz=&quot;123&quot;]
+
+[dumptag foo=123 baz=bar]
+
+[dumptag http://example.com]
+
+EOF;
+
+                $expected =&lt;&lt;&lt;EOF
+foo = bar
+baz = 123
+foo = 123
+baz = bar
+0 = http://example.com
+
+EOF;
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertTrue( is_single() );
+                $this-&gt;assertTrue( have_posts() );
+                $this-&gt;assertNull( the_post() );
+
+                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+        }
+
+        function test_the_content_shortcode_paragraph() {
+                $post_content = &lt;&lt;&lt;EOF
+Graf by itself:
+
+[paragraph]my graf[/paragraph]
+
+  [paragraph foo=&quot;bar&quot;]another graf with whitespace[/paragraph]
+
+An [paragraph]inline graf[/paragraph], this doesn't make much sense.
+
+A graf with a single EOL first:
+[paragraph]blah[/paragraph]
+
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;p&gt;Graf by itself:&lt;/p&gt;
+&lt;p class='graf'&gt;my graf&lt;/p&gt;
+
+  &lt;p class='graf'&gt;another graf with whitespace&lt;/p&gt;
+
+&lt;p&gt;An &lt;p class='graf'&gt;inline graf&lt;/p&gt;
+, this doesn&amp;#8217;t make much sense.&lt;/p&gt;
+&lt;p&gt;A graf with a single EOL first:&lt;br /&gt;
+&lt;p class='graf'&gt;blah&lt;/p&gt;
+&lt;/p&gt;
+
+EOF;
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertTrue( is_single() );
+                $this-&gt;assertTrue( have_posts() );
+                $this-&gt;assertNull( the_post() );
+
+                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+        }
+
+        function test_the_content_attribute_filtering() {
+                kses_init_filters();
+
+                // http://bpr3.org/?p=87
+                // the title attribute should make it through unfiltered
+                $post_content = &lt;&lt;&lt;EOF
+&lt;span class=&quot;Z3988&quot; title=&quot;ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.aulast=Mariat&amp;rft.aufirst=Denis&amp;rft. au=Denis+Mariat&amp;rft.au=Sead+Taourit&amp;rft.au=G%C3%A9rard+Gu%C3%A9rin&amp; rft.title=Genetics+Selection+Evolution&amp;rft.atitle=&amp;rft.date=2003&amp;rft. volume=35&amp;rft.issue=1&amp;rft.spage=119&amp;rft.epage=133&amp;rft.genre=article&amp; rft.id=info:DOI/10.1051%2Fgse%3A2002039&quot;&gt;&lt;/span&gt;Mariat, D., Taourit, S., Guérin, G. (2003). . &lt;span style=&quot;font-style: italic;&quot;&gt;Genetics Selection Evolution, 35&lt;/span&gt;(1), 119-133. DOI: &lt;a rev=&quot;review&quot; href= &quot;http://dx.doi.org/10.1051/gse:2002039&quot;&gt;10.1051/gse:2002039&lt;/a&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;p&gt;&lt;span class=&quot;Z3988&quot; title=&quot;ctx_ver=Z39.88-2004&amp;amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;amp;rft.aulast=Mariat&amp;amp;rft.aufirst=Denis&amp;amp;rft. au=Denis+Mariat&amp;amp;rft.au=Sead+Taourit&amp;amp;rft.au=G%C3%A9rard+Gu%C3%A9rin&amp;amp; rft.title=Genetics+Selection+Evolution&amp;amp;rft.atitle=&amp;amp;rft.date=2003&amp;amp;rft. volume=35&amp;amp;rft.issue=1&amp;amp;rft.spage=119&amp;amp;rft.epage=133&amp;amp;rft.genre=article&amp;amp; rft.id=info:DOI/10.1051%2Fgse%3A2002039&quot;&gt;&lt;/span&gt;Mariat, D., Taourit, S., Guérin, G. (2003). . &lt;span style=&quot;font-style: italic&quot;&gt;Genetics Selection Evolution, 35&lt;/span&gt;(1), 119-133. DOI: &lt;a rev=&quot;review&quot; href=&quot;http://dx.doi.org/10.1051/gse:2002039&quot;&gt;10.1051/gse:2002039&lt;/a&gt;&lt;/p&gt;
+EOF;
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertTrue( is_single() );
+                $this-&gt;assertTrue( have_posts() );
+                $this-&gt;assertNull( the_post() );
+
+                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+
+                kses_remove_filters();
+        }
+
+        function test_the_content_attribute_value_with_colon() {
+                kses_init_filters();
+
+                // http://bpr3.org/?p=87
+                // the title attribute should make it through unfiltered
+                $post_content = &lt;&lt;&lt;EOF
+&lt;span title=&quot;My friends: Alice, Bob and Carol&quot;&gt;foo&lt;/span&gt;
+EOF;
+
+                $expected = &lt;&lt;&lt;EOF
+&lt;p&gt;&lt;span title=&quot;My friends: Alice, Bob and Carol&quot;&gt;foo&lt;/span&gt;&lt;/p&gt;
+EOF;
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
+                $this-&gt;go_to( get_permalink( $post_id ) );
+                $this-&gt;assertTrue( is_single() );
+                $this-&gt;assertTrue( have_posts() );
+                $this-&gt;assertNull( the_post() );
+
+                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+
+                kses_remove_filters();
+        }
+}
</ins></span></pre></div>
<a id="trunktestsposttypesphpfromrev903trunkteststest_includes_postphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post/types.php (from rev 903, trunk/tests/test_includes_post.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post/types.php                                (rev 0)
+++ trunk/tests/post/types.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+&lt;?php
+
+/**
+ * @group post
+ */
+class Tests_Post_Types extends WP_UnitTestCase {
+        function test_register_post_type() {
+                $this-&gt;assertNull( get_post_type_object( 'foo' ) );
+                register_post_type( 'foo' );
+
+                $pobj = get_post_type_object( 'foo' );
+                $this-&gt;assertInstanceOf( 'stdClass', $pobj );
+                $this-&gt;assertEquals( 'foo', $pobj-&gt;name );
+
+                // Test some defaults
+                $this-&gt;assertFalse( is_post_type_hierarchical( 'foo' ) );
+                $this-&gt;assertEquals( array(), get_object_taxonomies( 'foo' ) );
+        }
+
+        function test_register_taxonomy_for_object_type() {
+                global $wp_taxonomies;
+
+                register_post_type( 'bar' );
+                register_taxonomy_for_object_type( 'post_tag', 'bar' );
+                $this-&gt;assertEquals( array( 'post_tag' ), get_object_taxonomies( 'bar' ) );
+                register_taxonomy_for_object_type( 'category', 'bar' );
+                $this-&gt;assertEquals( array( 'category', 'post_tag' ), get_object_taxonomies( 'bar' ) );
+
+                $this-&gt;assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+                $this-&gt;assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+
+                // Clean up. Remove the 'bar' post type from these taxonomies.
+                $GLOBALS['wp_taxonomies']['post_tag']-&gt;object_type = array( 'post' );
+                $GLOBALS['wp_taxonomies']['category']-&gt;object_type = array( 'post' );
+
+                $this-&gt;assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+                $this-&gt;assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+        }
+
+        function test_post_type_exists() {
+                $this-&gt;assertFalse( post_type_exists( 'notaposttype' ) );
+                $this-&gt;assertTrue( post_type_exists( 'post' ) );
+        }
+
+        function test_post_type_supports() {
+                $this-&gt;assertTrue( post_type_supports( 'post', 'post-formats' ) );
+                $this-&gt;assertFalse( post_type_supports( 'page', 'post-formats' ) );
+                $this-&gt;assertFalse( post_type_supports( 'notaposttype', 'post-formats' ) );
+                $this-&gt;assertFalse( post_type_supports( 'post', 'notafeature' ) );
+                $this-&gt;assertFalse( post_type_supports( 'notaposttype', 'notafeature' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestspostphpfromrev903trunkteststest_includes_postphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/post.php (from rev 903, trunk/tests/test_includes_post.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/post.php                                (rev 0)
+++ trunk/tests/post.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,467 @@
</span><ins>+&lt;?php
+
+/**
+ * test wp-includes/post.php
+ *
+ * @group post
+ */
+class Tests_Post extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) );
+                $this-&gt;old_current_user = get_current_user_id();
+                wp_set_current_user( $this-&gt;author_id );
+                _set_cron_array(array());
+                $this-&gt;post_ids = array();
+        }
+
+        function tearDown() {
+                wp_set_current_user( $this-&gt;old_current_user );
+                parent::tearDown();
+        }
+
+        // helper function: return the timestamp(s) of cron jobs for the specified hook and post
+        function _next_schedule_for_post($hook, $id) {
+                return wp_next_scheduled('publish_future_post', array(0=&gt;intval($id)));
+        }
+
+        // test simple valid behavior: insert and get a post
+        function test_vb_insert_get_delete() {
+                register_post_type( 'cpt', array( 'taxonomies' =&gt; array( 'post_tag', 'ctax' ) ) );
+                register_taxonomy( 'ctax', 'cpt' );
+                $post_types = array( 'post', 'cpt' );
+
+                foreach ( $post_types as $post_type ) {
+                        $post = array(
+                                'post_author' =&gt; $this-&gt;author_id,
+                                'post_status' =&gt; 'publish',
+                                'post_content' =&gt; rand_str(),
+                                'post_title' =&gt; rand_str(),
+                                'tax_input' =&gt; array( 'post_tag' =&gt; 'tag1,tag2', 'ctax' =&gt; 'cterm1,cterm2' ),
+                                'post_type' =&gt; $post_type
+                        );
+
+                        // insert a post and make sure the ID is ok
+                        $id = wp_insert_post($post);
+                        $this-&gt;assertTrue(is_numeric($id));
+                        $this-&gt;assertTrue($id &gt; 0);
+
+                        // fetch the post and make sure it matches
+                        $out = wp_get_single_post($id);
+
+                        $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
+                        $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
+                        $this-&gt;assertEquals($post['post_status'], $out-&gt;post_status);
+                        $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
+
+                        // test cache state
+                        $pcache = wp_cache_get( $id, 'posts' );
+                        $this-&gt;assertInstanceOf( 'stdClass', $pcache );
+                        $this-&gt;assertEquals( $id, $pcache-&gt;ID );
+
+                        update_object_term_cache( $id, $post_type );
+                        $tcache = wp_cache_get( $id, &quot;post_tag_relationships&quot; );
+                        $this-&gt;assertInternalType( 'array', $tcache );
+                        $this-&gt;assertEquals( 2, count( $tcache ) );
+
+                        $tcache = wp_cache_get( $id, &quot;ctax_relationships&quot; );
+                        if ( 'cpt' == $post_type ) {
+                                $this-&gt;assertInternalType( 'array', $tcache );
+                                $this-&gt;assertEquals( 2, count( $tcache ) );
+                        } else {
+                                $this-&gt;assertFalse( $tcache );
+                        }
+
+                        wp_delete_post( $id, true );
+                        $this-&gt;assertFalse( wp_cache_get( $id, 'posts' ) );
+                        $this-&gt;assertFalse( wp_cache_get( $id, &quot;post_tag_relationships&quot; ) );
+                        $this-&gt;assertFalse( wp_cache_get( $id, &quot;ctax_relationships&quot; ) );
+                }
+
+                $GLOBALS['wp_taxonomies']['post_tag']-&gt;object_type = array( 'post' );
+        }
+
+        function test_vb_insert_future() {
+                // insert a post with a future date, and make sure the status and cron schedule are correct
+
+                $future_date = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+                #dmp(_get_cron_array());
+                $this-&gt;assertTrue(is_numeric($id));
+                $this-&gt;assertTrue($id &gt; 0);
+
+                // fetch the post and make sure it matches
+                $out = wp_get_single_post($id);
+
+                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
+                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // there should be a publish_future_post hook scheduled on the future date
+                $this-&gt;assertEquals($future_date, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_vb_insert_future_over_dst() {
+                // insert a post with a future date, and make sure the status and cron schedule are correct
+
+                // Some magic days - one dst one not
+                $future_date_1 = strtotime('June 21st +1 year');
+                $future_date_2 = strtotime('Jan 11th +1 year');
+
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                // fetch the post and make sure has the correct date and status
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // check that there's a publish_future_post job scheduled at the right time
+                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                // now save it again with a date further in the future
+
+                $post['ID'] = $id;
+                $post['post_date'] = strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_2);
+                $post['post_date_gmt'] = NULL;
+                wp_update_post($post);
+
+                // fetch the post again and make sure it has the new post_date
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // and the correct date on the cron job
+                $this-&gt;assertEquals($future_date_2, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_vb_insert_future_edit_bug() {
+                // future post bug: posts get published at the wrong time if you edit the timestamp
+                // http://trac.wordpress.org/ticket/4710
+
+                $future_date_1 = strtotime('+1 day');
+                $future_date_2 = strtotime('+2 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                // fetch the post and make sure has the correct date and status
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // check that there's a publish_future_post job scheduled at the right time
+                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                // now save it again with a date further in the future
+
+                $post['ID'] = $id;
+                $post['post_date'] = strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_2);
+                $post['post_date_gmt'] = NULL;
+                wp_update_post($post);
+
+                // fetch the post again and make sure it has the new post_date
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // and the correct date on the cron job
+                $this-&gt;assertEquals($future_date_2, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_vb_insert_future_draft() {
+                // insert a draft post with a future date, and make sure no cron schedule is set
+
+                $future_date = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'draft',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+                #dmp(_get_cron_array());
+                $this-&gt;assertTrue(is_numeric($id));
+                $this-&gt;assertTrue($id &gt; 0);
+
+                // fetch the post and make sure it matches
+                $out = wp_get_single_post($id);
+
+                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
+                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
+                $this-&gt;assertEquals('draft', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // there should be a publish_future_post hook scheduled on the future date
+                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+        }
+
+        function test_vb_insert_future_change_to_draft() {
+                // insert a future post, then edit and change it to draft, and make sure cron gets it right
+                $future_date_1 = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                // fetch the post and make sure has the correct date and status
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // check that there's a publish_future_post job scheduled at the right time
+                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                // now save it again with status set to draft
+
+                $post['ID'] = $id;
+                $post['post_status'] = 'draft';
+                wp_update_post($post);
+
+                // fetch the post again and make sure it has the new post_date
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('draft', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // and the correct date on the cron job
+                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_vb_insert_future_change_status() {
+                // insert a future post, then edit and change the status, and make sure cron gets it right
+                $future_date_1 = strtotime('+1 day');
+
+                $statuses = array('draft', 'static', 'object', 'attachment', 'inherit', 'pending');
+
+                foreach ($statuses as $status) {
+                        $post = array(
+                                'post_author' =&gt; $this-&gt;author_id,
+                                'post_status' =&gt; 'publish',
+                                'post_content' =&gt; rand_str(),
+                                'post_title' =&gt; rand_str(),
+                                'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
+                        );
+
+                        // insert a post and make sure the ID is ok
+                        $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                        // fetch the post and make sure has the correct date and status
+                        $out = wp_get_single_post($id);
+                        $this-&gt;assertEquals('future', $out-&gt;post_status);
+                        $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                        // check that there's a publish_future_post job scheduled at the right time
+                        $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                        // now save it again with status changed
+
+                        $post['ID'] = $id;
+                        $post['post_status'] = $status;
+                        wp_update_post($post);
+
+                        // fetch the post again and make sure it has the new post_date
+                        $out = wp_get_single_post($id);
+                        $this-&gt;assertEquals($status, $out-&gt;post_status);
+                        $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                        // and the correct date on the cron job
+                        $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+                }
+        }
+
+        function test_vb_insert_future_private() {
+                // insert a draft post with a future date, and make sure no cron schedule is set
+
+                $future_date = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'private',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+                #dmp(_get_cron_array());
+                $this-&gt;assertTrue(is_numeric($id));
+                $this-&gt;assertTrue($id &gt; 0);
+
+                // fetch the post and make sure it matches
+                $out = wp_get_single_post($id);
+
+                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
+                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
+                $this-&gt;assertEquals('private', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // there should be a publish_future_post hook scheduled on the future date
+                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_vb_insert_future_change_to_private() {
+                // insert a future post, then edit and change it to private, and make sure cron gets it right
+                $future_date_1 = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                // fetch the post and make sure has the correct date and status
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('future', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // check that there's a publish_future_post job scheduled at the right time
+                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                // now save it again with status set to draft
+
+                $post['ID'] = $id;
+                $post['post_status'] = 'private';
+                wp_update_post($post);
+
+                // fetch the post again and make sure it has the new post_date
+                $out = wp_get_single_post($id);
+                $this-&gt;assertEquals('private', $out-&gt;post_status);
+                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
+
+                // and the correct date on the cron job
+                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        /**
+         * @ticket 5364
+         */
+        function test_delete_future_post_cron() {
+                // &quot;When I delete a future post using wp_delete_post($post-&gt;ID) it does not update the cron correctly.&quot;
+                $future_date = strtotime('+1 day');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; rand_str(),
+                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                // check that there's a publish_future_post job scheduled at the right time
+                $this-&gt;assertEquals($future_date, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
+
+                // now delete the post and make sure the cron entry is removed
+                wp_delete_post($id);
+
+                $this-&gt;assertFalse($this-&gt;_next_schedule_for_post('publish_future_post', $id));
+        }
+
+        function test_permalink_without_title() {
+                // bug: permalink doesn't work if post title is empty
+                // wpcom #663, also http://trac.wordpress.org/ticket/5305
+
+                global $wp_rewrite;
+                $wp_rewrite-&gt;set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+
+                $post = array(
+                        'post_author' =&gt; $this-&gt;author_id,
+                        'post_status' =&gt; 'publish',
+                        'post_content' =&gt; rand_str(),
+                        'post_title' =&gt; '',
+                        'post_date' =&gt; '2007-10-31 06:15:00',
+                );
+
+                // insert a post and make sure the ID is ok
+                $id = $this-&gt;post_ids[] = wp_insert_post($post);
+
+                $plink = get_permalink($id);
+
+                // permalink should include the post ID at the end
+                $this-&gt;assertEquals(get_option('siteurl').'/2007/10/31/'.$id.'/', $plink);
+
+                $wp_rewrite-&gt;set_permalink_structure('');
+        }
+
+        /**
+         * @ticket 21013
+         */
+        function test_wp_unique_post_slug_with_non_latin_slugs() {
+                $inputs = array(
+                        'Αρνάκι άσπρο και παχύ της μάνας του καμάρι, και άλλα τραγούδια',
+                        'Предлагаем супер металлообрабатывающее оборудование',
+                );
+
+                $outputs = array(
+                        'αρνάκι-άσπρο-και-παχύ-της-μάνας-του-κα-2',
+                        'предлагаем-супер-металлообрабатыва-2',
+                );
+
+                foreach ( $inputs as $k =&gt; $post_title ) {
+                        for ( $i = 0; $i &lt; 2; $i++ ) {
+                                $post = array(
+                                        'post_author' =&gt; $this-&gt;author_id,
+                                        'post_status' =&gt; 'publish',
+                                        'post_content' =&gt; rand_str(),
+                                        'post_title' =&gt; $post_title,
+                                );
+
+                                $id = $this-&gt;post_ids[] = wp_insert_post( $post );
+                        }
+
+                        $post = get_post( $id );
+                        $this-&gt;assertEquals( $outputs[$k], urldecode( $post-&gt;post_name ) );
+                }
+        }
+}
</ins></span></pre></div>
<a id="trunkteststaxonomyphpfromrev903trunkteststest_includes_taxonomyphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/taxonomy.php (from rev 903, trunk/tests/test_includes_taxonomy.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/taxonomy.php                                (rev 0)
+++ trunk/tests/taxonomy.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+&lt;?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Taxonomy extends WP_UnitTestCase {
+        function test_get_post_taxonomies() {
+                $this-&gt;assertEquals(array('category', 'post_tag', 'post_format'), get_object_taxonomies('post'));
+        }
+
+        function test_get_link_taxonomies() {
+                $this-&gt;assertEquals(array('link_category'), get_object_taxonomies('link'));
+        }
+
+        /**
+         * @ticket 5417
+         */
+        function test_get_unknown_taxonomies() {
+                // taxonomies for an unknown object type
+                $this-&gt;assertEquals( array(), get_object_taxonomies(rand_str()) );
+                $this-&gt;assertEquals( array(), get_object_taxonomies('') );
+                $this-&gt;assertEquals( array(), get_object_taxonomies(0) );
+                $this-&gt;assertEquals( array(), get_object_taxonomies(NULL) );
+        }
+
+        function test_get_post_taxonomy() {
+                foreach ( get_object_taxonomies('post') as $taxonomy ) {
+                        $tax = get_taxonomy($taxonomy);
+                        // should return an object with the correct taxonomy object type
+                        $this-&gt;assertTrue( is_object( $tax ) );
+                        $this-&gt;assertTrue( is_array( $tax-&gt;object_type ) );
+                        $this-&gt;assertEquals( array( 'post' ), $tax-&gt;object_type );
+                }
+        }
+
+        function test_get_link_taxonomy() {
+                foreach ( get_object_taxonomies('link') as $taxonomy ) {
+                        $tax = get_taxonomy($taxonomy);
+                        // should return an object with the correct taxonomy object type
+                        $this-&gt;assertTrue( is_object($tax) );
+                        $this-&gt;assertTrue( is_array( $tax-&gt;object_type ) );
+                        $this-&gt;assertEquals( array( 'link' ), $tax-&gt;object_type );
+                }
+        }
+
+        function test_taxonomy_exists_known() {
+                $this-&gt;assertTrue( taxonomy_exists('category') );
+                $this-&gt;assertTrue( taxonomy_exists('post_tag') );
+                $this-&gt;assertTrue( taxonomy_exists('link_category') );
+        }
+
+        function test_taxonomy_exists_unknown() {
+                $this-&gt;assertFalse( taxonomy_exists(rand_str()) );
+                $this-&gt;assertFalse( taxonomy_exists('') );
+                $this-&gt;assertFalse( taxonomy_exists(0) );
+                $this-&gt;assertFalse( taxonomy_exists(NULL) );
+        }
+
+        function test_is_taxonomy_hierarchical() {
+                $this-&gt;assertTrue( is_taxonomy_hierarchical('category') );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical('post_tag') );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical('link_category') );
+        }
+
+        function test_is_taxonomy_hierarchical_unknown() {
+                $this-&gt;assertFalse( is_taxonomy_hierarchical(rand_str()) );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical('') );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical(0) );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical(NULL) );
+        }
+
+        function test_register_taxonomy() {
+
+                // make up a new taxonomy name, and ensure it's unused
+                $tax = rand_str();
+                $this-&gt;assertFalse( taxonomy_exists($tax) );
+
+                register_taxonomy( $tax, 'post' );
+                $this-&gt;assertTrue( taxonomy_exists($tax) );
+                $this-&gt;assertFalse( is_taxonomy_hierarchical($tax) );
+
+                // clean up
+                unset($GLOBALS['wp_taxonomies'][$tax]);
+        }
+
+        function test_register_hierarchical_taxonomy() {
+
+                // make up a new taxonomy name, and ensure it's unused
+                $tax = rand_str();
+                $this-&gt;assertFalse( taxonomy_exists($tax) );
+
+                register_taxonomy( $tax, 'post', array('hierarchical'=&gt;true) );
+                $this-&gt;assertTrue( taxonomy_exists($tax) );
+                $this-&gt;assertTrue( is_taxonomy_hierarchical($tax) );
+
+                // clean up
+                unset($GLOBALS['wp_taxonomies'][$tax]);
+        }
+}
</ins></span></pre></div>
<a id="trunkteststermphpfromrev903trunkteststest_includes_taxonomyphp"></a>
<div class="copfile"><h4>Copied: trunk/tests/term.php (from rev 903, trunk/tests/test_includes_taxonomy.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/term.php                                (rev 0)
+++ trunk/tests/term.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,303 @@
</span><ins>+&lt;?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Term extends WP_UnitTestCase {
+        var $taxonomy = 'category';
+
+        function setUp() {
+                parent::setUp();
+                // insert one term into every post taxonomy
+                // otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs
+                $term = rand_str();
+                foreach(get_object_taxonomies('post') as $tax)
+                        wp_insert_term( $term, $tax );
+        }
+
+        function test_wp_insert_delete_term() {
+                // a new unused term
+                $term = rand_str();
+                $this-&gt;assertNull( term_exists($term) );
+
+                $initial_count = wp_count_terms( $this-&gt;taxonomy );
+
+                $t = wp_insert_term( $term, $this-&gt;taxonomy );
+                $this-&gt;assertTrue( is_array($t) );
+                $this-&gt;assertFalse( is_wp_error($t) );
+                $this-&gt;assertTrue( $t['term_id'] &gt; 0 );
+                $this-&gt;assertTrue( $t['term_taxonomy_id'] &gt; 0 );
+                $this-&gt;assertEquals( $initial_count + 1, wp_count_terms($this-&gt;taxonomy) );
+
+                // make sure the term exists
+                $this-&gt;assertTrue( term_exists($term) &gt; 0 );
+                $this-&gt;assertTrue( term_exists($t['term_id']) &gt; 0 );
+
+                // now delete it
+                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
+                $this-&gt;assertNull( term_exists($term) );
+                $this-&gt;assertNull( term_exists($t['term_id']) );
+                $this-&gt;assertEquals( $initial_count, wp_count_terms($this-&gt;taxonomy) );
+        }
+
+        function test_term_exists_known() {
+                // insert a term
+                $term = rand_str();
+                $t = wp_insert_term( $term, $this-&gt;taxonomy );
+
+                $this-&gt;assertEquals( $t['term_id'], term_exists($t['term_id']) );
+                $this-&gt;assertEquals( $t['term_id'], term_exists($term) );
+
+                // clean up
+                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
+        }
+
+        function test_term_exists_unknown() {
+                $this-&gt;assertNull( term_exists(rand_str()) );
+                $this-&gt;assertEquals( 0, term_exists(0) );
+                $this-&gt;assertEquals( 0, term_exists('') );
+                $this-&gt;assertEquals( 0, term_exists(NULL) );
+        }
+
+        /**
+         * @ticket 5381
+         */
+        function test_is_term_type() {
+                // insert a term
+                $term = rand_str();
+                $t = wp_insert_term( $term, $this-&gt;taxonomy );
+
+                $term_obj = get_term_by('name', $term, $this-&gt;taxonomy);
+                $this-&gt;assertEquals( $t['term_id'], term_exists($term_obj-&gt;slug) );
+
+                // clean up
+                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
+        }
+
+        function test_set_object_terms_by_id() {
+                $ids = $this-&gt;factory-&gt;post-&gt;create_many(5);
+
+                $terms = array();
+                for ($i=0; $i&lt;3; $i++ ) {
+                        $term = rand_str();
+                        $result = wp_insert_term( $term, $this-&gt;taxonomy );
+                        $term_id[$term] = $result['term_id'];
+                }
+
+                foreach ($ids as $id) {
+                                $tt = wp_set_object_terms( $id, array_values($term_id), $this-&gt;taxonomy );
+                                // should return three term taxonomy ids
+                                $this-&gt;assertEquals( 3, count($tt) );
+                }
+
+                // each term should be associated with every post
+                foreach ($term_id as $term=&gt;$id) {
+                        $actual = get_objects_in_term($id, $this-&gt;taxonomy);
+                        $this-&gt;assertEquals( $ids, array_map('intval', $actual) );
+                }
+
+                // each term should have a count of 5
+                foreach (array_keys($term_id) as $term) {
+                        $t = get_term_by('name', $term, $this-&gt;taxonomy);
+                        $this-&gt;assertEquals( 5, $t-&gt;count );
+                }
+        }
+
+        function test_set_object_terms_by_name() {
+                $ids = $this-&gt;factory-&gt;post-&gt;create_many(5);
+
+                $terms = array(
+                                rand_str(),
+                                rand_str(),
+                                rand_str());
+
+                foreach ($ids as $id) {
+                                $tt = wp_set_object_terms( $id, $terms, $this-&gt;taxonomy );
+                                // should return three term taxonomy ids
+                                $this-&gt;assertEquals( 3, count($tt) );
+                                // remember which term has which term_id
+                                for ($i=0; $i&lt;3; $i++) {
+                                        $term = get_term_by('name', $terms[$i], $this-&gt;taxonomy);
+                                        $term_id[$terms[$i]] = intval($term-&gt;term_id);
+                                }
+                }
+
+                // each term should be associated with every post
+                foreach ($term_id as $term=&gt;$id) {
+                        $actual = get_objects_in_term($id, $this-&gt;taxonomy);
+                        $this-&gt;assertEquals( $ids, array_map('intval', $actual) );
+                }
+
+                // each term should have a count of 5
+                foreach ($terms as $term) {
+                        $t = get_term_by('name', $term, $this-&gt;taxonomy);
+                        $this-&gt;assertEquals( 5, $t-&gt;count );
+                }
+        }
+
+        function test_change_object_terms_by_name() {
+                // set some terms on an object; then change them while leaving one intact
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                $terms_1 = array('foo', 'bar', 'baz');
+                $terms_2 = array('bar', 'bing');
+
+                // set the initial terms
+                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
+                $this-&gt;assertEquals( 3, count($tt_1) );
+
+                // make sure they're correct
+                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'names', 'orderby' =&gt; 't.term_id'));
+                $this-&gt;assertEquals( $terms_1, $terms );
+
+                // change the terms
+                $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this-&gt;taxonomy );
+                $this-&gt;assertEquals( 2, count($tt_2) );
+
+                // make sure they're correct
+                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'names', 'orderby' =&gt; 't.term_id'));
+                $this-&gt;assertEquals( $terms_2, $terms );
+
+                // make sure the tt id for 'bar' matches
+                $this-&gt;assertEquals( $tt_1[1], $tt_2[0] );
+
+        }
+
+        function test_change_object_terms_by_id() {
+                // set some terms on an object; then change them while leaving one intact
+
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                // first set: 3 terms
+                $terms_1 = array();
+                for ($i=0; $i&lt;3; $i++ ) {
+                        $term = rand_str();
+                        $result = wp_insert_term( $term, $this-&gt;taxonomy );
+                        $terms_1[$i] = $result['term_id'];
+                }
+
+                // second set: one of the original terms, plus one new term
+                $terms_2 = array();
+                $terms_2[0] = $terms_1[1];
+
+                $term = rand_str();
+                $result = wp_insert_term( $term, $this-&gt;taxonomy );
+                $terms_2[1] = $result['term_id'];
+
+
+                // set the initial terms
+                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
+                $this-&gt;assertEquals( 3, count($tt_1) );
+
+                // make sure they're correct
+                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'ids', 'orderby' =&gt; 't.term_id'));
+                $this-&gt;assertEquals( $terms_1, $terms );
+
+                // change the terms
+                $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this-&gt;taxonomy );
+                $this-&gt;assertEquals( 2, count($tt_2) );
+
+                // make sure they're correct
+                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'ids', 'orderby' =&gt; 't.term_id'));
+                $this-&gt;assertEquals( $terms_2, $terms );
+
+                // make sure the tt id for 'bar' matches
+                $this-&gt;assertEquals( $tt_1[1], $tt_2[0] );
+
+        }
+
+        function test_get_object_terms_by_slug() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                $terms_1 = array('Foo', 'Bar', 'Baz');
+                $terms_1_slugs = array('foo', 'bar', 'baz');
+
+                // set the initial terms
+                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
+                $this-&gt;assertEquals( 3, count($tt_1) );
+
+                // make sure they're correct
+                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'slugs', 'orderby' =&gt; 't.term_id'));
+                $this-&gt;assertEquals( $terms_1_slugs, $terms );
+        }
+
+        function test_set_object_terms_invalid() {
+                $post_id = $this-&gt;factory-&gt;post-&gt;create();
+
+                // bogus taxonomy
+                $result = wp_set_object_terms( $post_id, array(rand_str()), rand_str() );
+                $this-&gt;assertTrue( is_wp_error($result) );
+        }
+
+        function test_term_is_ancestor_of( ) {
+                $term = rand_str();
+                $term2 = rand_str();
+
+                $t = wp_insert_term( $term, 'category' );
+                $t2 = wp_insert_term( $term, 'category', array( 'parent' =&gt; $t['term_id'] ) );
+                if ( function_exists( 'term_is_ancestor_of' ) ) {
+                        $this-&gt;assertTrue( term_is_ancestor_of( $t['term_id'], $t2['term_id'], 'category' ) );
+                        $this-&gt;assertFalse( term_is_ancestor_of( $t2['term_id'], $t['term_id'], 'category' ) );
+                }
+                $this-&gt;assertTrue( cat_is_ancestor_of( $t['term_id'], $t2['term_id']) );
+                $this-&gt;assertFalse( cat_is_ancestor_of( $t2['term_id'], $t['term_id']) );
+
+                wp_delete_term($t['term_id'], 'category');
+                wp_delete_term($t2['term_id'], 'category');
+        }
+
+        function test_wp_insert_delete_category() {
+                $term = rand_str();
+                $this-&gt;assertNull( category_exists( $term ) );
+
+                $initial_count = wp_count_terms( 'category' );
+
+                $t = wp_insert_category( array( 'cat_name' =&gt; $term ) );
+                $this-&gt;assertTrue( is_numeric($t) );
+                $this-&gt;assertFalse( is_wp_error($t) );
+                $this-&gt;assertTrue( $t &gt; 0 );
+                $this-&gt;assertEquals( $initial_count + 1, wp_count_terms( 'category' ) );
+
+                // make sure the term exists
+                $this-&gt;assertTrue( term_exists($term) &gt; 0 );
+                $this-&gt;assertTrue( term_exists($t) &gt; 0 );
+
+                // now delete it
+                $this-&gt;assertTrue( wp_delete_category($t) );
+                $this-&gt;assertNull( term_exists($term) );
+                $this-&gt;assertNull( term_exists($t) );
+                $this-&gt;assertEquals( $initial_count, wp_count_terms('category') );
+        }
+
+        function test_wp_unique_term_slug() {
+                // set up test data
+                $a = wp_insert_term( 'parent', $this-&gt;taxonomy );
+                $b = wp_insert_term( 'child',  $this-&gt;taxonomy, array( 'parent' =&gt; $a['term_id'] ) );
+                $c = wp_insert_term( 'neighbor', $this-&gt;taxonomy );
+                $d = wp_insert_term( 'pet',  $this-&gt;taxonomy, array( 'parent' =&gt; $c['term_id'] )  );
+
+                $a_term = get_term( $a['term_id'], $this-&gt;taxonomy );
+                $b_term = get_term( $b['term_id'], $this-&gt;taxonomy );
+                $c_term = get_term( $c['term_id'], $this-&gt;taxonomy );
+                $d_term = get_term( $d['term_id'], $this-&gt;taxonomy );
+
+                // a unique slug gets unchanged
+                $this-&gt;assertEquals( 'unique-term', wp_unique_term_slug( 'unique-term', $c_term ) );
+
+                // a non-hierarchicial dupe gets suffixed with &quot;-#&quot;
+                $this-&gt;assertEquals( 'parent-2', wp_unique_term_slug( 'parent', $c_term ) );
+
+                // a hierarchical dupe initially gets suffixed with its parent term
+                $this-&gt;assertEquals( 'child-neighbor', wp_unique_term_slug( 'child', $d_term ) );
+
+                // a hierarchical dupe whose parent already contains the {term}-{parent term}
+                // term gets suffixed with parent term name and then '-#'
+                $e = wp_insert_term( 'child-neighbor', $this-&gt;taxonomy, array( 'parent' =&gt; $c['term_id'] ) );
+                $this-&gt;assertEquals( 'child-neighbor-2', wp_unique_term_slug( 'child', $d_term ) );
+
+                // clean up
+                foreach ( array( $a, $b, $c, $d, $e ) as $t )
+                        $this-&gt;assertTrue( wp_delete_term( $t['term_id'], $this-&gt;taxonomy ) );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststest_imagephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_image.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_image.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_image.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,669 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group image
- * @group media
- * @group upload
- */
-class TestImageMetaFunctions extends WP_UnitTestCase {
-        function setUp() {
-                if ( ! extension_loaded( 'gd' ) )
-                        $this-&gt;markTestSkipped( 'The gd PHP extension is not loaded.' );
-                if ( ! extension_loaded( 'exif' ) )
-                        $this-&gt;markTestSkipped( 'The exif PHP extension is not loaded.' );
-                if ( ! is_callable( 'wp_read_image_metadata' ) )
-                        $this-&gt;markTestSkipped( 'wp_read_image_metadata() is not callable.' );
-                parent::setUp();
-        }
-
-        function test_exif_d70() {
-                // exif from a Nikon D70
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0008.jpg');
-
-                $this-&gt;assertEquals(6.3, $out['aperture']);
-                $this-&gt;assertEquals('', $out['credit']);
-                $this-&gt;assertEquals('NIKON D70', $out['camera']);
-                $this-&gt;assertEquals('', $out['caption']);
-                $this-&gt;assertEquals(strtotime('2004-07-22 17:14:59'), $out['created_timestamp']);
-                $this-&gt;assertEquals('', $out['copyright']);
-                $this-&gt;assertEquals(27, $out['focal_length']);
-                $this-&gt;assertEquals(400, $out['iso']);
-                $this-&gt;assertEquals(1/40, $out['shutter_speed']);
-                $this-&gt;assertEquals('', $out['title']);
-        }
-
-        function test_exif_d70_mf() {
-                // exif from a Nikon D70 - manual focus lens, so some data is unavailable
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG');
-
-                $this-&gt;assertEquals(0, $out['aperture']);
-                $this-&gt;assertEquals('', $out['credit']);
-                $this-&gt;assertEquals('NIKON D70', $out['camera']);
-                $this-&gt;assertEquals('', $out['caption']);
-                $this-&gt;assertEquals(strtotime('2007-06-17 21:18:00'), $out['created_timestamp']);
-                $this-&gt;assertEquals('', $out['copyright']);
-                $this-&gt;assertEquals(0, $out['focal_length']);
-                $this-&gt;assertEquals(0, $out['iso']); // interesting - a Nikon bug?
-                $this-&gt;assertEquals(1/500, $out['shutter_speed']);
-                $this-&gt;assertEquals('', $out['title']);
-                #$this-&gt;assertEquals(array('Flowers'), $out['keywords']);
-        }
-
-        function test_exif_d70_iptc() {
-                // exif from a Nikon D70 with IPTC data added later
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0007.jpg');
-
-                $this-&gt;assertEquals(6.3, $out['aperture']);
-                $this-&gt;assertEquals('IPTC Creator', $out['credit']);
-                $this-&gt;assertEquals('NIKON D70', $out['camera']);
-                $this-&gt;assertEquals('IPTC Caption', $out['caption']);
-                $this-&gt;assertEquals(strtotime('2004-07-22 17:14:35'), $out['created_timestamp']);
-                $this-&gt;assertEquals('IPTC Copyright', $out['copyright']);
-                $this-&gt;assertEquals(18, $out['focal_length']);
-                $this-&gt;assertEquals(200, $out['iso']);
-                $this-&gt;assertEquals(1/25, $out['shutter_speed']);
-                $this-&gt;assertEquals('IPTC Headline', $out['title']);
-        }
-
-        function test_exif_fuji() {
-                // exif from a Fuji FinePix S5600 (thanks Mark)
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/a2-small.jpg');
-
-                $this-&gt;assertEquals(4.5, $out['aperture']);
-                $this-&gt;assertEquals('', $out['credit']);
-                $this-&gt;assertEquals('FinePix S5600', $out['camera']);
-                $this-&gt;assertEquals('', $out['caption']);
-                $this-&gt;assertEquals(strtotime('2007-09-03 10:17:03'), $out['created_timestamp']);
-                $this-&gt;assertEquals('', $out['copyright']);
-                $this-&gt;assertEquals(6.3, $out['focal_length']);
-                $this-&gt;assertEquals(64, $out['iso']);
-                $this-&gt;assertEquals(1/320, $out['shutter_speed']);
-                $this-&gt;assertEquals('', $out['title']);
-
-        }
-
-        /**
-         * @ticket 6571
-         */
-        function test_exif_error() {
-
-                // http://trac.wordpress.org/ticket/6571
-                // this triggers a warning mesage when reading the exif block
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/waffles.jpg');
-
-                $this-&gt;assertEquals(0, $out['aperture']);
-                $this-&gt;assertEquals('', $out['credit']);
-                $this-&gt;assertEquals('', $out['camera']);
-                $this-&gt;assertEquals('', $out['caption']);
-                $this-&gt;assertEquals(0, $out['created_timestamp']);
-                $this-&gt;assertEquals('', $out['copyright']);
-                $this-&gt;assertEquals(0, $out['focal_length']);
-                $this-&gt;assertEquals(0, $out['iso']);
-                $this-&gt;assertEquals(0, $out['shutter_speed']);
-                $this-&gt;assertEquals('', $out['title']);
-        }
-
-        function test_exif_no_data() {
-                // no exif data in this image (from burningwell.org)
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/canola.jpg');
-
-                $this-&gt;assertEquals(0, $out['aperture']);
-                $this-&gt;assertEquals('', $out['credit']);
-                $this-&gt;assertEquals('', $out['camera']);
-                $this-&gt;assertEquals('', $out['caption']);
-                $this-&gt;assertEquals(0, $out['created_timestamp']);
-                $this-&gt;assertEquals('', $out['copyright']);
-                $this-&gt;assertEquals(0, $out['focal_length']);
-                $this-&gt;assertEquals(0, $out['iso']);
-                $this-&gt;assertEquals(0, $out['shutter_speed']);
-                $this-&gt;assertEquals('', $out['title']);
-        }
-
-        /**
-         * @ticket 9417
-         */
-        function test_utf8_iptc_tags() {
-
-                // trilingual UTF-8 text in the ITPC caption-abstract field
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/test-image-iptc.jpg');
-
-                $this-&gt;assertEquals('This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $out['caption']);
-        }
-
-        /**
-         * wp_read_image_metadata() should false if the image file doesn't exist
-         * @return void
-         */
-        public function test_missing_image_file() {
-                $out = wp_read_image_metadata(DIR_TESTDATA.'/images/404_image.png');
-                $this-&gt;assertFalse($out);
-        }
-}
-
-/**
- * @group image
- * @group media
- * @group upload
- */
-class TestImageSizeFunctions extends WP_UnitTestCase {
-        function test_constrain_dims_zero() {
-                if (!is_callable('wp_constrain_dimensions'))
-                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
-
-                // no constraint - should have no effect
-                $out = wp_constrain_dimensions(640, 480, 0, 0);
-                $this-&gt;assertEquals(array(640, 480), $out);
-
-                $out = wp_constrain_dimensions(640, 480);
-                $this-&gt;assertEquals(array(640, 480), $out);
-
-                $out = wp_constrain_dimensions(0, 0, 0, 0);
-                $this-&gt;assertEquals(array(0, 0), $out);
-        }
-
-        function test_constrain_dims_smaller() {
-                if (!is_callable('wp_constrain_dimensions'))
-                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
-
-                // image size is smaller than the constraint - no effect
-                $out = wp_constrain_dimensions(500, 600, 1024, 768);
-                $this-&gt;assertEquals(array(500, 600), $out);
-
-                $out = wp_constrain_dimensions(500, 600, 0, 768);
-                $this-&gt;assertEquals(array(500, 600), $out);
-
-                $out = wp_constrain_dimensions(500, 600, 1024, 0);
-                $this-&gt;assertEquals(array(500, 600), $out);
-        }
-
-        function test_constrain_dims_equal() {
-                if (!is_callable('wp_constrain_dimensions'))
-                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
-
-                // image size is equal to the constraint - no effect
-                $out = wp_constrain_dimensions(1024, 768, 1024, 768);
-                $this-&gt;assertequals(array(1024, 768), $out);
-
-                $out = wp_constrain_dimensions(1024, 768, 0, 768);
-                $this-&gt;assertequals(array(1024, 768), $out);
-
-                $out = wp_constrain_dimensions(1024, 768, 1024, 0);
-                $this-&gt;assertequals(array(1024, 768), $out);
-        }
-
-        function test_constrain_dims_larger() {
-                if (!is_callable('wp_constrain_dimensions'))
-                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
-
-                // image size is larger than the constraint - result should be constrained
-                $out = wp_constrain_dimensions(1024, 768, 500, 600);
-                $this-&gt;assertequals(array(500, 375), $out);
-
-                $out = wp_constrain_dimensions(1024, 768, 0, 600);
-                $this-&gt;assertequals(array(800, 600), $out);
-
-                $out = wp_constrain_dimensions(1024, 768, 500, 0);
-                $this-&gt;assertequals(array(500, 375), $out);
-
-                // also try a portrait oriented image
-                $out = wp_constrain_dimensions(300, 800, 500, 600);
-                $this-&gt;assertequals(array(225, 600), $out);
-
-                $out = wp_constrain_dimensions(300, 800, 0, 600);
-                $this-&gt;assertequals(array(225, 600), $out);
-
-                $out = wp_constrain_dimensions(300, 800, 200, 0);
-                $this-&gt;assertequals(array(200, 533), $out);
-        }
-
-        function test_constrain_dims_boundary() {
-                if (!is_callable('wp_constrain_dimensions'))
-                        $this-&gt;markTestSkipped('wp_constrain_dimensions() is not callable.');
-
-                // one dimension is larger than the constraint, one smaller - result should be constrained
-                $out = wp_constrain_dimensions(1024, 768, 500, 800);
-                $this-&gt;assertequals(array(500, 375), $out);
-
-                $out = wp_constrain_dimensions(1024, 768, 2000, 700);
-                $this-&gt;assertequals(array(933, 700), $out);
-
-                // portrait
-                $out = wp_constrain_dimensions(768, 1024, 800, 500);
-                $this-&gt;assertequals(array(375, 500), $out);
-
-                $out = wp_constrain_dimensions(768, 1024, 2000, 700);
-                $this-&gt;assertequals(array(525, 700), $out);
-        }
-
-        function test_shrink_dimensions_default() {
-                $out = wp_shrink_dimensions(640, 480);
-                $this-&gt;assertEquals(array(128, 96), $out);
-
-                $out = wp_shrink_dimensions(480, 640);
-                $this-&gt;assertEquals(array(72, 96), $out);
-        }
-
-        function test_shrink_dimensions_smaller() {
-                // image size is smaller than the constraint - no effect
-                $out = wp_shrink_dimensions(500, 600, 1024, 768);
-                $this-&gt;assertEquals(array(500, 600), $out);
-
-                $out = wp_shrink_dimensions(600, 500, 1024, 768);
-                $this-&gt;assertEquals(array(600, 500), $out);
-        }
-
-        function test_shrink_dimensions_equal() {
-                // image size is equal to the constraint - no effect
-                $out = wp_shrink_dimensions(500, 600, 500, 600);
-                $this-&gt;assertEquals(array(500, 600), $out);
-
-                $out = wp_shrink_dimensions(600, 500, 600, 500);
-                $this-&gt;assertEquals(array(600, 500), $out);
-        }
-
-        function test_shrink_dimensions_larger() {
-                // image size is larger than the constraint - result should be constrained
-                $out = wp_shrink_dimensions(1024, 768, 500, 600);
-                $this-&gt;assertequals(array(500, 375), $out);
-
-                $out = wp_shrink_dimensions(300, 800, 500, 600);
-                $this-&gt;assertequals(array(225, 600), $out);
-        }
-
-        function test_shrink_dimensions_boundary() {
-                // one dimension is larger than the constraint, one smaller - result should be constrained
-                $out = wp_shrink_dimensions(1024, 768, 500, 800);
-                $this-&gt;assertequals(array(500, 375), $out);
-
-                $out = wp_shrink_dimensions(1024, 768, 2000, 700);
-                $this-&gt;assertequals(array(933, 700), $out);
-
-                // portrait
-                $out = wp_shrink_dimensions(768, 1024, 800, 500);
-                $this-&gt;assertequals(array(375, 500), $out);
-
-                $out = wp_shrink_dimensions(768, 1024, 2000, 700);
-                $this-&gt;assertequals(array(525, 700), $out);
-        }
-
-        function test_constrain_size_for_editor_thumb() {
-                $out = image_constrain_size_for_editor(600, 400, 'thumb');
-                $this-&gt;assertEquals(array(150, 100), $out);
-
-                $out = image_constrain_size_for_editor(64, 64, 'thumb');
-                $this-&gt;assertEquals(array(64, 64), $out);
-        }
-
-        function test_constrain_size_for_editor_medium() {
-                // default max width is 500, no constraint on height
-                global $content_width;
-                $content_width = 0;
-                update_option('medium_size_w', 500);
-                update_option('medium_size_h', 0);
-
-                $out = image_constrain_size_for_editor(600, 400, 'medium');
-                $this-&gt;assertEquals(array(500, 333), $out);
-
-                $out = image_constrain_size_for_editor(400, 600, 'medium');
-                $this-&gt;assertEquals(array(400, 600), $out);
-
-                $out = image_constrain_size_for_editor(64, 64, 'medium');
-                $this-&gt;assertEquals(array(64, 64), $out);
-
-                // content_width should be ignored
-                $content_width = 350;
-                $out = image_constrain_size_for_editor(600, 400, 'medium');
-                $this-&gt;assertEquals(array(500, 333), $out);
-        }
-
-        function test_constrain_size_for_editor_full() {
-                global $content_width;
-                $content_width = 400;
-                $out = image_constrain_size_for_editor(600, 400, 'full');
-                $this-&gt;assertEquals(array(600, 400), $out);
-
-                $out = image_constrain_size_for_editor(64, 64, 'full');
-                $this-&gt;assertEquals(array(64, 64), $out);
-
-                // content_width default is 500
-                $content_width = 0;
-
-                $out = image_constrain_size_for_editor(600, 400, 'full');
-                $this-&gt;assertEquals(array(600, 400), $out);
-
-                $out = image_constrain_size_for_editor(64, 64, 'full');
-                $this-&gt;assertEquals(array(64, 64), $out);
-        }
-
-}
-
-/**
- * @group image
- * @group media
- * @group upload
- */
-class TestImageResizeDimensions extends WP_UnitTestCase {
-        function test_400x400_no_crop() {
-                // landscape: resize 640x480 to fit 400x400: 400x300
-                $out = image_resize_dimensions(640, 480, 400, 400, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
-
-                // portrait: resize 480x640 to fit 400x400: 300x400
-                $out = image_resize_dimensions(480, 640, 400, 400, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
-        }
-
-        function test_400x0_no_crop() {
-                // landscape: resize 640x480 to fit 400w: 400x300
-                $out = image_resize_dimensions(640, 480, 400, 0, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
-
-                // portrait: resize 480x640 to fit 400w: 400x533
-                $out = image_resize_dimensions(480, 640, 400, 0, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
-        }
-
-        function test_0x400_no_crop() {
-                // landscape: resize 640x480 to fit 400h: 533x400
-                $out = image_resize_dimensions(640, 480, 0, 400, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
-
-                // portrait: resize 480x640 to fit 400h: 300x400
-                $out = image_resize_dimensions(480, 640, 0, 400, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
-        }
-
-        function test_800x800_no_crop() {
-                // landscape: resize 640x480 to fit 800x800
-                $out = image_resize_dimensions(640, 480, 800, 800, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-
-                // portrait: resize 480x640 to fit 800x800
-                $out = image_resize_dimensions(480, 640, 800, 800, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-        }
-
-        function test_800x0_no_crop() {
-                // landscape: resize 640x480 to fit 800w
-                $out = image_resize_dimensions(640, 480, 800, 0, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-
-                // portrait: resize 480x640 to fit 800w
-                $out = image_resize_dimensions(480, 640, 800, 0, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-        }
-
-        function test_0x800_no_crop() {
-                // landscape: resize 640x480 to fit 800h
-                $out = image_resize_dimensions(640, 480, 0, 800, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-
-                // portrait: resize 480x640 to fit 800h
-                $out = image_resize_dimensions(480, 640, 0, 800, false);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( false, $out );
-        }
-
-        // cropped versions
-
-        function test_400x400_crop() {
-                // landscape: crop 640x480 to fit 400x400: 400x400 taken from a 480x480 crop at (80. 0)
-                $out = image_resize_dimensions(640, 480, 400, 400, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 80, 0, 400, 400, 480, 480), $out );
-
-                // portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
-                $out = image_resize_dimensions(480, 640, 400, 400, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 80, 400, 400, 480, 480), $out );
-        }
-
-        function test_400x0_crop() {
-                // landscape: resize 640x480 to fit 400w: 400x300
-                $out = image_resize_dimensions(640, 480, 400, 0, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
-
-                // portrait: resize 480x640 to fit 400w: 400x533
-                $out = image_resize_dimensions(480, 640, 400, 0, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
-        }
-
-        function test_0x400_crop() {
-                // landscape: resize 640x480 to fit 400h: 533x400
-                $out = image_resize_dimensions(640, 480, 0, 400, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
-
-                // portrait: resize 480x640 to fit 400h: 300x400
-                $out = image_resize_dimensions(480, 640, 0, 400, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
-        }
-
-        function test_400x500_crop() {
-                // landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop at (80. 0)
-                $out = image_resize_dimensions(640, 480, 400, 500, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 120, 0, 400, 480, 400, 480), $out );
-
-                // portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
-                $out = image_resize_dimensions(480, 640, 400, 500, true);
-                // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
-                $this-&gt;assertEquals( array(0, 0, 0, 20, 400, 500, 480, 600), $out );
-        }
-
-}
-
-/**
- * @group image
- * @group media
- * @group upload
- */
-class TestImageResize extends WP_UnitTestCase {
-        // image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=75)
-
-        function setUp() {
-                if ( ! extension_loaded( 'gd' ) )
-                        $this-&gt;markTestSkipped( 'The gd PHP extension is not loaded.' );
-                parent::setUp();
-        }
-
-        function test_resize_jpg() {
-                $image = image_resize( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 );
-                $this-&gt;assertEquals( 'test-image-25x25.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 25, $w );
-                $this-&gt;assertEquals( 25, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                unlink($image);
-        }
-
-        function test_resize_png() {
-                $image = image_resize( DIR_TESTDATA.'/images/test-image.png', 25, 25 );
-                $this-&gt;assertEquals( 'test-image-25x25.png', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 25, $w );
-                $this-&gt;assertEquals( 25, $h );
-                $this-&gt;assertEquals( IMAGETYPE_PNG, $type );
-                unlink($image);
-        }
-
-        function test_resize_gif() {
-                $image = image_resize( DIR_TESTDATA.'/images/test-image.gif', 25, 25 );
-                $this-&gt;assertEquals( 'test-image-25x25.gif', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 25, $w );
-                $this-&gt;assertEquals( 25, $h );
-                $this-&gt;assertEquals( IMAGETYPE_GIF, $type );
-                unlink($image);
-        }
-
-        function test_resize_larger() {
-                // image_resize() should refuse to make an image larger
-                $image = image_resize( DIR_TESTDATA.'/images/test-image.jpg', 100, 100 );
-                $this-&gt;assertInstanceOf( 'WP_Error', $image );
-                $this-&gt;assertEquals( 'error_getting_dimensions', $image-&gt;get_error_code() );
-        }
-
-        function test_resize_thumb_128x96() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 96 );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-63x96.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 63, $w );
-                $this-&gt;assertEquals( 96, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( 'be8f7aaa7b939970a3ded069a6e3619b', md5_file($image) );
-                unlink($image);
-        }
-
-        function test_resize_thumb_128x0() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 0 );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-128x192.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 128, $w );
-                $this-&gt;assertEquals( 192, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( '7b1c0d5e7d4f6a18ae7541c8abf1fd09', md5_file($image) );
-                unlink($image);
-        }
-
-        function test_resize_thumb_0x96() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 0, 96 );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-63x96.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 63, $w );
-                $this-&gt;assertEquals( 96, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( 'be8f7aaa7b939970a3ded069a6e3619b', md5_file($image) );
-                unlink($image);
-        }
-
-        function test_resize_thumb_150x150_crop() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 150, true );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 150, $w );
-                $this-&gt;assertEquals( 150, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( '9fdcf728e1d43da89edf866d009ca7e8', md5_file($image) );
-                unlink($image);
-        }
-
-        function test_resize_thumb_150x100_crop() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 100, true );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 150, $w );
-                $this-&gt;assertEquals( 100, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( '2eeb18856505ab946074d90babc46452', md5_file($image) );
-                unlink($image);
-        }
-
-        function test_resize_thumb_50x150_crop() {
-                $image = image_resize( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 50, 150, true );
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename($image) );
-                list($w, $h, $type) = getimagesize($image);
-                $this-&gt;assertEquals( 50, $w );
-                $this-&gt;assertEquals( 150, $h );
-                $this-&gt;assertEquals( IMAGETYPE_JPEG, $type );
-                // is this a valid test? do different systems always generate the same file?
-                #$this-&gt;assertEquals( '94ed8e8463475774a5c5ff66118d3127', md5_file($image) );
-                unlink($image);
-        }
-
-}
-
-/**
- * @group image
- * @group media
- * @group upload
- */
-class TestIsImageFunctions extends WP_UnitTestCase {
-        function test_is_image_positive() {
-                // these are all image files recognized by php
-                $files = array(
-                        'test-image-cmyk.jpg',
-                        'test-image.bmp',
-                        'test-image-grayscale.jpg',
-                        'test-image.gif',
-                        'test-image.png',
-                        'test-image.tiff',
-                        'test-image-lzw.tiff',
-                        'test-image.jp2',
-                        'test-image.psd',
-                        'test-image-zip.tiff',
-                        'test-image.jpg',
-                        );
-
-                foreach ($files as $file) {
-                        $this-&gt;assertTrue( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return true&quot; );
-                }
-        }
-
-        function test_is_image_negative() {
-                // these are actually image files but aren't recognized or usable by php
-                $files = array(
-                        'test-image.pct',
-                        'test-image.tga',
-                        'test-image.sgi',
-                        );
-
-                foreach ($files as $file) {
-                        $this-&gt;assertFalse( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return false&quot; );
-                }
-        }
-
-        function test_is_displayable_image_positive() {
-                // these are all usable in typical web browsers
-                $files = array(
-                        'test-image.gif',
-                        'test-image.png',
-                        'test-image.jpg',
-                        );
-
-                foreach ($files as $file) {
-                        $this-&gt;assertTrue( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return true&quot; );
-                }
-        }
-
-        function test_is_displayable_image_negative() {
-                // these are image files but aren't suitable for web pages because of compatibility or size issues
-                $files = array(
-                        // 'test-image-cmyk.jpg', Allowed in r9727
-                        'test-image.bmp',
-                        // 'test-image-grayscale.jpg', Allowed in r9727
-                        'test-image.pct',
-                        'test-image.tga',
-                        'test-image.sgi',
-                        'test-image.tiff',
-                        'test-image-lzw.tiff',
-                        'test-image.jp2',
-                        'test-image.psd',
-                        'test-image-zip.tiff',
-                        );
-
-                foreach ($files as $file) {
-                        $this-&gt;assertFalse( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), &quot;file_is_valid_image($file) should return false&quot; );
-                }
-        }
-
-}
</del></span></pre></div>
<a id="trunkteststest_import_wpphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_import_wp.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_import_wp.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_import_wp.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,575 +0,0 @@
</span><del>-&lt;?php
-
-abstract class WP_Import_UnitTestCase extends WP_UnitTestCase {
-        /**
-         * Import a WXR file.
-         *
-         * The $users parameter provides information on how users specified in the import
-         * file should be imported. Each key is a user login name and indicates if the user
-         * should be mapped to an existing user, created as a new user with a particular login
-         * or imported with the information held in the WXR file. An example of this:
-         *
-         * &lt;code&gt;
-         * $users = array(
-         *   'alice' =&gt; 1, // alice will be mapped to user ID 1
-         *   'bob' =&gt; 'john', // bob will be transformed into john
-         *   'eve' =&gt; false // eve will be imported as is
-         * );&lt;/code&gt;
-         *
-         * @param string $filename Full path of the file to import
-         * @param array $users User import settings
-         * @param bool $fetch_files Whether or not do download remote attachments
-         */
-        protected function _import_wp( $filename, $users = array(), $fetch_files = true ) {
-                $importer = new WP_Import();
-                $file = realpath( $filename );
-                assert('!empty($file)');
-                assert('is_file($file)');
-
-                $authors = $mapping = $new = array();
-                $i = 0;
-
-                // each user is either mapped to a given ID, mapped to a new user
-                // with given login or imported using details in WXR file
-                foreach ( $users as $user =&gt; $map ) {
-                        $authors[$i] = $user;
-                        if ( is_int( $map ) )
-                                $mapping[$i] = $map;
-                        else if ( is_string( $map ) )
-                                $new[$i] = $map;
-
-                        $i++;
-                }
-
-                $_POST = array( 'imported_authors' =&gt; $authors, 'user_map' =&gt; $mapping, 'user_new' =&gt; $new );
-
-                ob_start();
-                $importer-&gt;fetch_attachments = $fetch_files;
-                $importer-&gt;import( $file );
-                ob_end_clean();
-
-                $_POST = array();
-        }
-}
-
-/**
- * @group import
- */
-class WXRParserTest extends WP_Import_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        function test_malformed_wxr() {
-                $file = DIR_TESTDATA . '/export/malformed.xml';
-
-                // regex based parser cannot detect malformed XML
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
-                        $parser = new $p;
-                        $result = $parser-&gt;parse($file);
-                        $this-&gt;assertTrue( is_wp_error( $result ) );
-                        $this-&gt;assertEquals( 'There was an error when reading this WXR file', $result-&gt;get_error_message() );
-                }
-        }
-
-        function test_invalid_wxr() {
-                $f1 = DIR_TESTDATA . '/export/missing-version-tag.xml';
-                $f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml';
-
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        foreach ( array( $f1, $f2 ) as $file ) {
-                                $parser = new $p;
-                                $result = $parser-&gt;parse( $file );
-                                $this-&gt;assertTrue( is_wp_error( $result ) );
-                                $this-&gt;assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result-&gt;get_error_message() );
-                        }
-                }
-        }
-
-        function test_wxr_version_1_1() {
-                $file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml';
-
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        $message = $p . ' failed';
-                        $parser = new $p;
-                        $result = $parser-&gt;parse( $file );
-
-                        $this-&gt;assertTrue( is_array( $result ), $message );
-                        $this-&gt;assertEquals( 'http://localhost/', $result['base_url'], $message );
-                        $this-&gt;assertEquals( array(
-                                'author_id' =&gt; 2,
-                                'author_login' =&gt; 'john',
-                                'author_email' =&gt; 'johndoe@example.org',
-                                'author_display_name' =&gt; 'John Doe',
-                                'author_first_name' =&gt; 'John',
-                                'author_last_name' =&gt; 'Doe'
-                        ), $result['authors']['john'], $message );
-                        $this-&gt;assertEquals( array(
-                                'term_id' =&gt; 3,
-                                'category_nicename' =&gt; 'alpha',
-                                'category_parent' =&gt; '',
-                                'cat_name' =&gt; 'alpha',
-                                'category_description' =&gt; 'The alpha category'
-                        ), $result['categories'][0], $message );
-                        $this-&gt;assertEquals( array(
-                                'term_id' =&gt; 22,
-                                'tag_slug' =&gt; 'clippable',
-                                'tag_name' =&gt; 'Clippable',
-                                'tag_description' =&gt; 'The Clippable post_tag'
-                        ), $result['tags'][0], $message );
-                        $this-&gt;assertEquals( array(
-                                'term_id' =&gt; 40,
-                                'term_taxonomy' =&gt; 'post_tax',
-                                'slug' =&gt; 'bieup',
-                                'term_parent' =&gt; '',
-                                'term_name' =&gt; 'bieup',
-                                'term_description' =&gt; 'The bieup post_tax'
-                        ), $result['terms'][0], $message );
-
-                        $this-&gt;assertEquals( 2, count($result['posts']), $message );
-                        $this-&gt;assertEquals( 19, count($result['posts'][0]), $message );
-                        $this-&gt;assertEquals( 18, count($result['posts'][1]), $message );
-                        $this-&gt;assertEquals( array(
-                                array( 'name' =&gt; 'alpha', 'slug' =&gt; 'alpha', 'domain' =&gt; 'category' ),
-                                array( 'name' =&gt; 'Clippable', 'slug' =&gt; 'clippable', 'domain' =&gt; 'post_tag' ),
-                                array( 'name' =&gt; 'bieup', 'slug' =&gt; 'bieup', 'domain' =&gt; 'post_tax' )
-                        ), $result['posts'][0]['terms'], $message );
-                        $this-&gt;assertEquals( array(
-                                array( 'key' =&gt; '_wp_page_template', 'value' =&gt; 'default' )
-                        ), $result['posts'][1]['postmeta'], $message );
-                }
-        }
-
-        function test_wxr_version_1_0() {
-                $file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml';
-
-                foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        $message = $p . ' failed';
-                        $parser = new $p;
-                        $result = $parser-&gt;parse( $file );
-
-                        $this-&gt;assertTrue( is_array( $result ), $message );
-                        $this-&gt;assertEquals( 'http://localhost/', $result['base_url'], $message );
-                        $this-&gt;assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
-                        $this-&gt;assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
-                        $this-&gt;assertEquals( $result['categories'][0]['category_parent'], '', $message );
-                        $this-&gt;assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
-                        $this-&gt;assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
-                        $this-&gt;assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );
-
-                        $this-&gt;assertEquals( 6, count($result['posts']), $message );
-                        $this-&gt;assertEquals( 19, count($result['posts'][0]), $message );
-                        $this-&gt;assertEquals( 18, count($result['posts'][1]), $message );
-
-                        $this-&gt;assertEquals( array(
-                                array( 'name' =&gt; 'Uncategorized', 'slug' =&gt; 'uncategorized', 'domain' =&gt; 'category' )
-                        ), $result['posts'][0]['terms'], $message );
-                        $this-&gt;assertEquals( array(
-                                array( 'name' =&gt; 'alpha', 'slug' =&gt; 'alpha', 'domain' =&gt; 'category' ),
-                                array( 'name' =&gt; 'news', 'slug' =&gt; 'news', 'domain' =&gt; 'tag' ),
-                                array( 'name' =&gt; 'roar', 'slug' =&gt; 'roar', 'domain' =&gt; 'tag' )
-                        ), $result['posts'][2]['terms'], $message );
-                        $this-&gt;assertEquals( array(
-                                array( 'name' =&gt; 'chicken', 'slug' =&gt; 'chicken', 'domain' =&gt; 'tag' ),
-                                array( 'name' =&gt; 'child', 'slug' =&gt; 'child', 'domain' =&gt; 'category' ),
-                                array( 'name' =&gt; 'face', 'slug' =&gt; 'face', 'domain' =&gt; 'tag' )
-                        ), $result['posts'][3]['terms'], $message );
-
-                        $this-&gt;assertEquals( array(
-                                array( 'key' =&gt; '_wp_page_template', 'value' =&gt; 'default' )
-                        ), $result['posts'][1]['postmeta'], $message );
-                }
-        }
-
-        /**
-         * Test the WXR parser's ability to correctly retrieve content from CDATA
-         * sections that contain escaped closing tags (&quot;]]&gt;&quot; -&gt; &quot;]]]]&gt;&lt;![CDATA[&gt;&quot;).
-         *
-         * @link http://core.trac.wordpress.org/ticket/15203
-         */
-        function test_escaped_cdata_closing_sequence() {
-                $file = DIR_TESTDATA . '/export/crazy-cdata-escaped.xml';
-
-                foreach( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
-                        $message = 'Parser ' . $p;
-                        $parser = new $p;
-                        $result = $parser-&gt;parse( $file );
-
-                        $post = $result['posts'][0];
-                        $this-&gt;assertEquals( 'Content with nested &lt;![CDATA[ tags ]]&gt; :)', $post['post_content'], $message );
-                        foreach ( $post['postmeta'] as $meta ) {
-                                switch ( $meta['key'] ) {
-                                        case 'Plain string': $value = 'Foo'; break;
-                                        case 'Closing CDATA': $value = ']]&gt;'; break;
-                                        case 'Alot of CDATA': $value = 'This has &lt;![CDATA[ opening and ]]&gt; closing &lt;![CDATA[ tags like this: ]]&gt;'; break;
-                                        default: $this-&gt;fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
-                                }
-                                $this-&gt;assertEquals( $value, $meta['value'], $message );
-                        }
-                }
-        }
-
-        /**
-         * Ensure that the regex parser can still parse invalid CDATA blocks (i.e. those
-         * with &quot;]]&gt;&quot; unescaped within a CDATA section).
-         */
-        function test_unescaped_cdata_closing_sequence() {
-                $file = DIR_TESTDATA . '/export/crazy-cdata.xml';
-
-                $parser = new WXR_Parser_Regex;
-                $result = $parser-&gt;parse( $file );
-
-                $post = $result['posts'][0];
-                $this-&gt;assertEquals( 'Content with nested &lt;![CDATA[ tags ]]&gt; :)', $post['post_content'] );
-                foreach ( $post['postmeta'] as $meta ) {
-                        switch ( $meta['key'] ) {
-                                case 'Plain string': $value = 'Foo'; break;
-                                case 'Closing CDATA': $value = ']]&gt;'; break;
-                                case 'Alot of CDATA': $value = 'This has &lt;![CDATA[ opening and ]]&gt; closing &lt;![CDATA[ tags like this: ]]&gt;'; break;
-                                default: $this-&gt;fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
-                        }
-                        $this-&gt;assertEquals( $value, $meta['value'] );
-                }
-        }
-
-        // tags in CDATA #11574
-}
-
-/**
- * @group import
- */
-class WPImportTest extends WP_Import_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-
-                add_filter( 'import_allow_create_users', '__return_true' );
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-
-                global $wpdb;
-                // crude but effective: make sure there's no residual data in the main tables
-                foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
-                        $wpdb-&gt;query(&quot;DELETE FROM {$wpdb-&gt;$table}&quot;);
-        }
-
-        function tearDown() {
-                remove_filter( 'import_allow_create_users', '__return_true' );
-
-                parent::tearDown();
-        }
-
-        function test_small_import() {
-                global $wpdb;
-
-                $authors = array( 'admin' =&gt; false, 'editor' =&gt; false, 'author' =&gt; false );
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-
-                // ensure that authors were imported correctly
-                $user_count = count_users();
-                $this-&gt;assertEquals( 3, $user_count['total_users'] );
-                $admin = get_user_by( 'login', 'admin' );
-                $this-&gt;assertEquals( 'admin', $admin-&gt;user_login );
-                $this-&gt;assertEquals( 'local@host.null', $admin-&gt;user_email );
-                $editor = get_user_by( 'login', 'editor' );
-                $this-&gt;assertEquals( 'editor', $editor-&gt;user_login );
-                $this-&gt;assertEquals( 'editor@example.org', $editor-&gt;user_email );
-                $this-&gt;assertEquals( 'FirstName', $editor-&gt;user_firstname );
-                $this-&gt;assertEquals( 'LastName', $editor-&gt;user_lastname );
-                $author = get_user_by( 'login', 'author' );
-                $this-&gt;assertEquals( 'author', $author-&gt;user_login );
-                $this-&gt;assertEquals( 'author@example.org', $author-&gt;user_email );
-
-                // check that terms were imported correctly
-                $this-&gt;assertEquals( 30, wp_count_terms( 'category' ) );
-                $this-&gt;assertEquals( 3, wp_count_terms( 'post_tag' ) );
-                $foo = get_term_by( 'slug', 'foo', 'category' );
-                $this-&gt;assertEquals( 0, $foo-&gt;parent );
-                $bar = get_term_by( 'slug', 'bar', 'category' );
-                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
-                $this-&gt;assertEquals( $bar-&gt;term_id, $foo_bar-&gt;parent );
-
-                // check that posts/pages were imported correctly
-                $post_count = wp_count_posts( 'post' );
-                $this-&gt;assertEquals( 5, $post_count-&gt;publish );
-                $this-&gt;assertEquals( 1, $post_count-&gt;private );
-                $page_count = wp_count_posts( 'page' );
-                $this-&gt;assertEquals( 4, $page_count-&gt;publish );
-                $this-&gt;assertEquals( 1, $page_count-&gt;draft );
-                $comment_count = wp_count_comments();
-                $this-&gt;assertEquals( 1, $comment_count-&gt;total_comments );
-
-                $posts = get_posts( array( 'numberposts' =&gt; 20, 'post_type' =&gt; 'any', 'post_status' =&gt; 'any', 'orderby' =&gt; 'ID' ) );
-                $this-&gt;assertEquals( 11, count($posts) );
-
-                $post = $posts[0];
-                $this-&gt;assertEquals( 'Many Categories', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'many-categories', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID );
-                $this-&gt;assertEquals( 27, count($cats) );
-
-                $post = $posts[1];
-                $this-&gt;assertEquals( 'Non-standard post format', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'non-standard-post-format', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID );
-                $this-&gt;assertEquals( 1, count($cats) );
-                $this-&gt;assertTrue( has_post_format( 'aside', $post-&gt;ID ) );
-
-                $post = $posts[2];
-                $this-&gt;assertEquals( 'Top-level Foo', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'top-level-foo', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID, array( 'fields' =&gt; 'all' ) );
-                $this-&gt;assertEquals( 1, count($cats) );
-                $this-&gt;assertEquals( 'foo', $cats[0]-&gt;slug );
-
-                $post = $posts[3];
-                $this-&gt;assertEquals( 'Foo-child', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'foo-child', $post-&gt;post_name );
-                $this-&gt;assertEquals( $editor-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID, array( 'fields' =&gt; 'all' ) );
-                $this-&gt;assertEquals( 1, count($cats) );
-                $this-&gt;assertEquals( 'foo-bar', $cats[0]-&gt;slug );
-
-                $post = $posts[4];
-                $this-&gt;assertEquals( 'Private Post', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'private-post', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'private', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID );
-                $this-&gt;assertEquals( 1, count($cats) );
-                $tags = wp_get_post_tags( $post-&gt;ID );
-                $this-&gt;assertEquals( 3, count($tags) );
-                $this-&gt;assertEquals( 'tag1', $tags[0]-&gt;slug );
-                $this-&gt;assertEquals( 'tag2', $tags[1]-&gt;slug );
-                $this-&gt;assertEquals( 'tag3', $tags[2]-&gt;slug );
-
-                $post = $posts[5];
-                $this-&gt;assertEquals( '1-col page', $post-&gt;post_title );
-                $this-&gt;assertEquals( '1-col-page', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $this-&gt;assertEquals( 'onecolumn-page.php', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
-
-                $post = $posts[6];
-                $this-&gt;assertEquals( 'Draft Page', $post-&gt;post_title );
-                $this-&gt;assertEquals( '', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'draft', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
-
-                $post = $posts[7];
-                $this-&gt;assertEquals( 'Parent Page', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'parent-page', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
-
-                $post = $posts[8];
-                $this-&gt;assertEquals( 'Child Page', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'child-page', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( $posts[7]-&gt;ID, $post-&gt;post_parent );
-                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
-
-                $post = $posts[9];
-                $this-&gt;assertEquals( 'Sample Page', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'sample-page', $post-&gt;post_name );
-                $this-&gt;assertEquals( $admin-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'page', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $this-&gt;assertEquals( 'default', get_post_meta( $post-&gt;ID, '_wp_page_template', true ) );
-
-                $post = $posts[10];
-                $this-&gt;assertEquals( 'Hello world!', $post-&gt;post_title );
-                $this-&gt;assertEquals( 'hello-world', $post-&gt;post_name );
-                $this-&gt;assertEquals( $author-&gt;ID, $post-&gt;post_author );
-                $this-&gt;assertEquals( 'post', $post-&gt;post_type );
-                $this-&gt;assertEquals( 'publish', $post-&gt;post_status );
-                $this-&gt;assertEquals( 0, $post-&gt;post_parent );
-                $cats = wp_get_post_categories( $post-&gt;ID );
-                $this-&gt;assertEquals( 1, count($cats) );
-        }
-
-        function test_double_import() {
-                $authors = array( 'admin' =&gt; false, 'editor' =&gt; false, 'author' =&gt; false );
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
-
-                $user_count = count_users();
-                $this-&gt;assertEquals( 3, $user_count['total_users'] );
-                $admin = get_user_by( 'login', 'admin' );
-                $this-&gt;assertEquals( 'admin', $admin-&gt;user_login );
-                $this-&gt;assertEquals( 'local@host.null', $admin-&gt;user_email );
-                $editor = get_user_by( 'login', 'editor' );
-                $this-&gt;assertEquals( 'editor', $editor-&gt;user_login );
-                $this-&gt;assertEquals( 'editor@example.org', $editor-&gt;user_email );
-                $this-&gt;assertEquals( 'FirstName', $editor-&gt;user_firstname );
-                $this-&gt;assertEquals( 'LastName', $editor-&gt;user_lastname );
-                $author = get_user_by( 'login', 'author' );
-                $this-&gt;assertEquals( 'author', $author-&gt;user_login );
-                $this-&gt;assertEquals( 'author@example.org', $author-&gt;user_email );
-
-                $this-&gt;assertEquals( 30, wp_count_terms( 'category' ) );
-                $this-&gt;assertEquals( 3, wp_count_terms( 'post_tag' ) );
-                $foo = get_term_by( 'slug', 'foo', 'category' );
-                $this-&gt;assertEquals( 0, $foo-&gt;parent );
-                $bar = get_term_by( 'slug', 'bar', 'category' );
-                $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
-                $this-&gt;assertEquals( $bar-&gt;term_id, $foo_bar-&gt;parent );
-
-                $post_count = wp_count_posts( 'post' );
-                $this-&gt;assertEquals( 5, $post_count-&gt;publish );
-                $this-&gt;assertEquals( 1, $post_count-&gt;private );
-                $page_count = wp_count_posts( 'page' );
-                $this-&gt;assertEquals( 4, $page_count-&gt;publish );
-                $this-&gt;assertEquals( 1, $page_count-&gt;draft );
-                $comment_count = wp_count_comments();
-                $this-&gt;assertEquals( 1, $comment_count-&gt;total_comments );
-        }
-
-        // function test_menu_import
-}
-
-/**
- * @group import
- */
-class TestImportWP_PostMeta extends WP_Import_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        function test_serialized_postmeta_no_cdata() {
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' =&gt; 'john' ) );
-                $expected['special_post_title'] = 'A special title';
-                $expected['is_calendar'] = '';
-                $this-&gt;assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
-        }
-
-        function test_utw_postmeta() {
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-utw-post-meta-import.xml', array( 'johncoswell' =&gt; 'john' ) );
-
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;album&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;apple&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;art&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;artwork&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;dead-tracks&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;ipod&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;itunes&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;javascript&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;lyrics&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;script&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;tracks&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;windows-scripting-host&quot;;
-                $expected[] = $classy;
-                $classy = new StdClass();
-                $classy-&gt;tag =  &quot;wscript&quot;;
-                $expected[] = $classy;
-
-                $this-&gt;assertEquals( $expected, get_post_meta( 150, 'test', true ) );
-        }
-}
-
-/**
- * @group import
- */
-class TestImportWP_PostMetaCDATA extends WP_Import_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-
-                if ( ! defined( 'WP_IMPORTING' ) )
-                        define( 'WP_IMPORTING', true );
-
-                if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
-                        define( 'WP_LOAD_IMPORTERS', true );
-
-                require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
-        }
-
-        // #9633
-        function test_serialized_postmeta_with_cdata() {
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' =&gt; 'johncoswell' ) );
-
-                //HTML in the CDATA should work with old WordPress version
-                $this-&gt;assertEquals( '&lt;pre&gt;some html&lt;/pre&gt;', get_post_meta( 10, 'contains-html', true ) );
-                //Serialised will only work with 3.0 onwards.
-                $expected[&quot;special_post_title&quot;] = &quot;A special title&quot;;
-                $expected[&quot;is_calendar&quot;] = &quot;&quot;;
-                $this-&gt;assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );
-        }
-
-        // #11574
-        function test_serialized_postmeta_with_evil_stuff_in_cdata() {
-                $this-&gt;_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' =&gt; 'johncoswell' ) );
-                // evil content in the CDATA
-                $this-&gt;assertEquals( '&lt;wp:meta_value&gt;evil&lt;/wp:meta_value&gt;', get_post_meta( 10, 'evil', true ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_formattingphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_formatting.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_formatting.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_formatting.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,1594 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group formatting
- */
-class TestMakeClickable extends WP_UnitTestCase {
-        function test_mailto_xss() {
-                $in = 'testzzz@&quot;STYLE=&quot;behavior:url(\'#default#time2\')&quot;onBegin=&quot;alert(\'refresh-XSS\')&quot;';
-                $this-&gt;assertEquals($in, make_clickable($in));
-        }
-
-        function test_valid_mailto() {
-                $valid_emails = array(
-                        'foo@example.com',
-                        'foo.bar@example.com',
-                        'Foo.Bar@a.b.c.d.example.com',
-                        '0@example.com',
-                        'foo@example-example.com',
-                        );
-                foreach ($valid_emails as $email) {
-                        $this-&gt;assertEquals('&lt;a href=&quot;mailto:'.$email.'&quot;&gt;'.$email.'&lt;/a&gt;', make_clickable($email));
-                }
-        }
-
-        function test_invalid_mailto() {
-                $invalid_emails = array(
-                        'foo',
-                        'foo@',
-                        'foo@@example.com',
-                        '@example.com',
-                        'foo @example.com',
-                        'foo@example',
-                        );
-                foreach ($invalid_emails as $email) {
-                        $this-&gt;assertEquals($email, make_clickable($email));
-                }
-        }
-
-        // tests that make_clickable will not link trailing periods, commas and
-        // (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
-        function test_strip_trailing_with_protocol() {
-                $urls_before = array(
-                        'http://wordpress.org/hello.html',
-                        'There was a spoon named http://wordpress.org. Alice!',
-                        'There was a spoon named http://wordpress.org, said Alice.',
-                        'There was a spoon named http://wordpress.org; said Alice.',
-                        'There was a spoon named http://wordpress.org: said Alice.',
-                        'There was a spoon named (http://wordpress.org) said Alice.'
-                        );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://wordpress.org/hello.html&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org/hello.html&lt;/a&gt;',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;. Alice!',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;, said Alice.',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;; said Alice.',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;: said Alice.',
-                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;) said Alice.'
-                        );
-
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // tests that make_clickable will not link trailing periods, commas and
-        // (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
-        function test_strip_trailing_with_protocol_nothing_afterwards() {
-                $urls_before = array(
-                        'http://wordpress.org/hello.html',
-                        'There was a spoon named http://wordpress.org.',
-                        'There was a spoon named http://wordpress.org,',
-                        'There was a spoon named http://wordpress.org;',
-                        'There was a spoon named http://wordpress.org:',
-                        'There was a spoon named (http://wordpress.org)',
-                        'There was a spoon named (http://wordpress.org)x',
-                        );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://wordpress.org/hello.html&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org/hello.html&lt;/a&gt;',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;.',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;,',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;;',
-                        'There was a spoon named &lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;:',
-                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;)',
-                        'There was a spoon named (&lt;a href=&quot;http://wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://wordpress.org&lt;/a&gt;)x',
-                        );
-
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // tests that make_clickable will not link trailing periods, commas and
-        // (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
-        function test_strip_trailing_without_protocol() {
-                $urls_before = array(
-                        'www.wordpress.org',
-                        'There was a spoon named www.wordpress.org. Alice!',
-                        'There was a spoon named www.wordpress.org, said Alice.',
-                        'There was a spoon named www.wordpress.org; said Alice.',
-                        'There was a spoon named www.wordpress.org: said Alice.',
-                        'There was a spoon named www.wordpress.org) said Alice.'
-                        );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;. Alice!',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;, said Alice.',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;; said Alice.',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;: said Alice.',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;) said Alice.'
-                        );
-
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // tests that make_clickable will not link trailing periods, commas and
-        // (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
-        function test_strip_trailing_without_protocol_nothing_afterwards() {
-                $urls_before = array(
-                        'www.wordpress.org',
-                        'There was a spoon named www.wordpress.org.',
-                        'There was a spoon named www.wordpress.org,',
-                        'There was a spoon named www.wordpress.org;',
-                        'There was a spoon named www.wordpress.org:',
-                        'There was a spoon named www.wordpress.org)'
-                        );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;.',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;,',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;;',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;:',
-                        'There was a spoon named &lt;a href=&quot;http://www.wordpress.org&quot; rel=&quot;nofollow&quot;&gt;http://www.wordpress.org&lt;/a&gt;)'
-                        );
-
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // #4570
-        function test_iri() {
-                $urls_before = array(
-                        'http://www.詹姆斯.com/',
-                        'http://bg.wikipedia.org/Баба',
-                        'http://example.com/?a=баба&amp;b=дядо',
-                );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://www.詹姆斯.com/&quot; rel=&quot;nofollow&quot;&gt;http://www.詹姆斯.com/&lt;/a&gt;',
-                        '&lt;a href=&quot;http://bg.wikipedia.org/Баба&quot; rel=&quot;nofollow&quot;&gt;http://bg.wikipedia.org/Баба&lt;/a&gt;',
-                        '&lt;a href=&quot;http://example.com/?a=баба&amp;#038;b=дядо&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?a=баба&amp;#038;b=дядо&lt;/a&gt;',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // #10990
-        function test_brackets_in_urls() {
-                $urls_before = array(
-                        'http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)',
-                        '(http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software))',
-                        'blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah',
-                        'blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah',
-                        'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah blah',
-                        'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
-                        'blah blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
-                        'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).) blah blah',
-                        'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).)moreurl blah blah',
-                        'In his famous speech “You and Your research” (here:
-                        http://www.cs.virginia.edu/~robins/YouAndYourResearch.html)
-                        Richard Hamming wrote about people getting more done with their doors closed, but',
-                );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;',
-                        '(&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;)',
-                        'blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt; blah',
-                        'blah (&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah',
-                        'blah blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt; blah blah',
-                        'blah blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah blah',
-                        'blah blah (&lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;) blah blah',
-                        'blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;.) blah blah',
-                        'blah blah &lt;a href=&quot;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&quot; rel=&quot;nofollow&quot;&gt;http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)&lt;/a&gt;.)moreurl blah blah',
-                        'In his famous speech “You and Your research” (here:
-                        &lt;a href=&quot;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&lt;/a&gt;)
-                        Richard Hamming wrote about people getting more done with their doors closed, but',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // Based on a real comments which were incorrectly linked. #11211
-        function test_real_world_examples() {
-                $urls_before = array(
-                        'Example: WordPress, test (some text), I love example.com (http://example.org), it is brilliant',
-                        'Example: WordPress, test (some text), I love example.com (http://example.com), it is brilliant',
-                        'Some text followed by a bracketed link with a trailing elipsis (http://example.com)...',
-                        'In his famous speech “You and Your research” (here: http://www.cs.virginia.edu/~robins/YouAndYourResearch.html) Richard Hamming wrote about people getting more done with their doors closed...',
-                );
-                $urls_expected = array(
-                        'Example: WordPress, test (some text), I love example.com (&lt;a href=&quot;http://example.org&quot; rel=&quot;nofollow&quot;&gt;http://example.org&lt;/a&gt;), it is brilliant',
-                        'Example: WordPress, test (some text), I love example.com (&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;), it is brilliant',
-                        'Some text followed by a bracketed link with a trailing elipsis (&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;)...',
-                        'In his famous speech “You and Your research” (here: &lt;a href=&quot;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.virginia.edu/~robins/YouAndYourResearch.html&lt;/a&gt;) Richard Hamming wrote about people getting more done with their doors closed...',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        // #14993
-        function test_twitter_hash_bang() {
-                $urls_before = array(
-                        'http://twitter.com/#!/wordpress/status/25907440233',
-                        'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233 !',
-                        'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233!',
-                );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt;',
-                        'This is a really good tweet &lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt; !',
-                        'This is a really good tweet &lt;a href=&quot;http://twitter.com/#!/wordpress/status/25907440233&quot; rel=&quot;nofollow&quot;&gt;http://twitter.com/#!/wordpress/status/25907440233&lt;/a&gt;!',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        function test_wrapped_in_angles() {
-                $before = array(
-                        'URL wrapped in angle brackets &lt;http://example.com/&gt;',
-                        'URL wrapped in angle brackets with padding &lt; http://example.com/ &gt;',
-                        'mailto wrapped in angle brackets &lt;foo@example.com&gt;',
-                );
-                $expected = array(
-                        'URL wrapped in angle brackets &lt;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;&gt;',
-                        'URL wrapped in angle brackets with padding &lt; &lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt; &gt;',
-                        'mailto wrapped in angle brackets &lt;foo@example.com&gt;',
-                );
-                foreach ($before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($expected[$key], make_clickable($url));
-                }
-        }
-
-        function test_preceded_by_punctuation() {
-                $before = array(
-                        'Comma then URL,http://example.com/',
-                        'Period then URL.http://example.com/',
-                        'Semi-colon then URL;http://example.com/',
-                        'Colon then URL:http://example.com/',
-                        'Exclamation mark then URL!http://example.com/',
-                        'Question mark then URL?http://example.com/',
-                );
-                $expected = array(
-                        'Comma then URL,&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                        'Period then URL.&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                        'Semi-colon then URL;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                        'Colon then URL:&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                        'Exclamation mark then URL!&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                        'Question mark then URL?&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;',
-                );
-                foreach ($before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($expected[$key], make_clickable($url));
-                }
-        }
-
-        function test_dont_break_attributes() {
-                $urls_before = array(
-                        &quot;&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;&quot;,
-                        &quot;(&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;http://trunk.domain/testing#something (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;http://trunk.domain/testing#something
-                        (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;&lt;span style='text-align:center; display: block;'&gt;&lt;object width='425' height='350'&gt;&lt;param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='wmode' value='opaque' /&gt; &lt;embed src='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'&gt;&lt;/embed&gt; &lt;/object&gt;&lt;/span&gt;&quot;,
-                        '&lt;a href=&quot;http://example.com/example.gif&quot; title=&quot;Image from http://example.com&quot;&gt;Look at this image!&lt;/a&gt;',
-                );
-                $urls_expected = array(
-                        &quot;&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;&quot;,
-                        &quot;(&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;&lt;a href=\&quot;http://trunk.domain/testing#something\&quot; rel=\&quot;nofollow\&quot;&gt;http://trunk.domain/testing#something&lt;/a&gt; (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;&lt;a href=\&quot;http://trunk.domain/testing#something\&quot; rel=\&quot;nofollow\&quot;&gt;http://trunk.domain/testing#something&lt;/a&gt;
-                        (&lt;img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'&gt;)&quot;,
-                        &quot;&lt;span style='text-align:center; display: block;'&gt;&lt;object width='425' height='350'&gt;&lt;param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='wmode' value='opaque' /&gt; &lt;embed src='http://www.youtube.com/v/nd_BdvG43rE&amp;rel=1&amp;fs=1&amp;showsearch=0&amp;showinfo=1&amp;iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'&gt;&lt;/embed&gt; &lt;/object&gt;&lt;/span&gt;&quot;,
-                        '&lt;a href=&quot;http://example.com/example.gif&quot; title=&quot;Image from http://example.com&quot;&gt;Look at this image!&lt;/a&gt;',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals($urls_expected[$key], make_clickable($url));
-                }
-        }
-
-        /**
-         * @ticket 16892
-         */
-        function test_click_inside_html() {
-                $urls_before = array(
-                        '&lt;span&gt;http://example.com&lt;/span&gt;',
-                        '&lt;p&gt;http://example.com/&lt;/p&gt;',
-                );
-                $urls_expected = array(
-                        '&lt;span&gt;&lt;a href=&quot;http://example.com&quot; rel=&quot;nofollow&quot;&gt;http://example.com&lt;/a&gt;&lt;/span&gt;',
-                        '&lt;p&gt;&lt;a href=&quot;http://example.com/&quot; rel=&quot;nofollow&quot;&gt;http://example.com/&lt;/a&gt;&lt;/p&gt;',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals( $urls_expected[$key], make_clickable( $url ) );
-                }
-        }
-
-        function test_no_links_within_links() {
-                $in = array(
-                        'Some text with a link &lt;a href=&quot;http://example.com&quot;&gt;http://example.com&lt;/a&gt;',
-                        //'&lt;a href=&quot;http://wordpress.org&quot;&gt;This is already a link www.wordpress.org&lt;/a&gt;', // fails in 3.3.1 too
-                );
-                foreach ( $in as $text ) {
-                        $this-&gt;assertEquals( $text, make_clickable( $text ) );
-                }
-        }
-
-        /**
-         * ticket 16892
-         */
-        function test_no_segfault() {
-                if ( version_compare( $GLOBALS['wp_version'], '3.1.1', '&lt;' ) )
-                        $this-&gt;markTestSkipped();
-
-                $in = str_repeat( 'http://example.com/2011/03/18/post-title/', 256 );
-                $out = make_clickable( $in );
-                if ( version_compare( $GLOBALS['wp_version'], '3.4-alpha', '&gt;=' ) )
-                        $this-&gt;assertEquals( $in, $out );
-        }
-
-        /**
-         * @ticket 16859
-         */
-        function test_square_brackets() {
-                $urls_before = array(
-                        'http://example.com/?foo[bar]=baz',
-                        'http://example.com/?baz=bar&amp;foo[bar]=baz',
-                );
-                $urls_expected = array(
-                        '&lt;a href=&quot;http://example.com/?foo%5Bbar%5D=baz&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?foo%5Bbar%5D=baz&lt;/a&gt;',
-                        '&lt;a href=&quot;http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz&quot; rel=&quot;nofollow&quot;&gt;http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz&lt;/a&gt;',
-                );
-                foreach ($urls_before as $key =&gt; $url) {
-                        $this-&gt;assertEquals( $urls_expected[$key], make_clickable( $url ) );
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestJSEscape extends WP_UnitTestCase {
-        function test_js_escape_simple() {
-                $out = esc_js('foo bar baz();');
-                $this-&gt;assertEquals('foo bar baz();', $out);
-        }
-
-        function test_js_escape_quotes() {
-                $out = esc_js('foo &quot;bar&quot; \'baz\'');
-                // does it make any sense to change &quot; into &amp;quot;?  Why not \&quot;?
-                $this-&gt;assertEquals(&quot;foo &amp;quot;bar&amp;quot; \'baz\'&quot;, $out);
-        }
-
-        function test_js_escape_backslash() {
-                $bs = '\\';
-                $out = esc_js('foo '.$bs.'t bar '.$bs.$bs.' baz');
-                // \t becomes t - bug?
-                $this-&gt;assertEquals('foo t bar '.$bs.$bs.' baz', $out);
-        }
-
-        function test_js_escape_amp() {
-                $out = esc_js('foo &amp; bar &amp;baz; &amp;apos;');
-                $this-&gt;assertEquals(&quot;foo &amp;amp; bar &amp;amp;baz; &amp;apos;&quot;, $out);
-        }
-
-        function test_js_escape_quote_entity() {
-                $out = esc_js('foo &amp;#x27; bar &amp;#39; baz &amp;#x26;');
-                $this-&gt;assertEquals(&quot;foo \\' bar \\' baz &amp;amp;&quot;, $out);
-        }
-
-        function test_js_no_carriage_return() {
-                $out = esc_js(&quot;foo\rbar\nbaz\r&quot;);
-                // \r is stripped
-                $this-&gt;assertequals(&quot;foobar\\nbaz&quot;, $out);
-        }
-
-        function test_js_escape_rn() {
-                $out = esc_js(&quot;foo\r\nbar\nbaz\r\n&quot;);
-                // \r is stripped
-                $this-&gt;assertequals(&quot;foo\\nbar\\nbaz\\n&quot;, $out);
-        }
-}
-
-/**
- * @group formatting
- */
-class TestHtmlExcerpt extends WP_UnitTestCase {
-        function test_simple() {
-                $this-&gt;assertEquals(&quot;Baba&quot;, wp_html_excerpt(&quot;Baba told me not to come&quot;, 4));
-        }
-        function test_html() {
-                $this-&gt;assertEquals(&quot;Baba&quot;, wp_html_excerpt(&quot;&lt;a href='http://baba.net/'&gt;Baba&lt;/a&gt; told me not to come&quot;, 4));
-        }
-        function test_entities() {
-                $this-&gt;assertEquals(&quot;Baba &quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 8));
-                $this-&gt;assertEquals(&quot;Baba &quot;, wp_html_excerpt(&quot;Baba &amp;#038; Dyado&quot;, 8));
-                $this-&gt;assertEquals(&quot;Baba &amp;amp; D&quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 12));
-                $this-&gt;assertEquals(&quot;Baba &amp;amp; Dyado&quot;, wp_html_excerpt(&quot;Baba &amp;amp; Dyado&quot;, 100));
-        }
-}
-
-/* // @todo These tests need to be rewritten for sanitize_sql_orderby
-class TestSanitizeOrderby extends WP_UnitTestCase {
-        function test_empty() {
-                $cols = array('a' =&gt; 'a');
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('  ', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby(&quot;\t&quot;, $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby(null, $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby(0, $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('+', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('-', $cols) );
-        }
-
-        function test_unknown_column() {
-                $cols = array('name' =&gt; 'post_name', 'date' =&gt; 'post_date');
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('unknown_column', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('+unknown_column', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('-unknown_column', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('-unknown1,+unknown2,unknown3', $cols) );
-                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('name,unknown_column', $cols) );
-                $this-&gt;assertEquals( '', sanitize_sql_orderby('!@#$%^&amp;*()_=~`\'&quot;,./', $cols) );
-        }
-
-        function test_valid() {
-                $cols = array('name' =&gt; 'post_name', 'date' =&gt; 'post_date', 'random' =&gt; 'rand()');
-                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('name', $cols) );
-                $this-&gt;assertEquals( 'post_name ASC', sanitize_sql_orderby('+name', $cols) );
-                $this-&gt;assertEquals( 'post_name DESC', sanitize_sql_orderby('-name', $cols) );
-                $this-&gt;assertEquals( 'post_date ASC, post_name ASC', sanitize_sql_orderby('date,name', $cols) );
-                $this-&gt;assertEquals( 'post_date ASC, post_name ASC', sanitize_sql_orderby(' date , name ', $cols) );
-                $this-&gt;assertEquals( 'post_name DESC, post_date ASC', sanitize_sql_orderby('-name,date', $cols) );
-                $this-&gt;assertEquals( 'post_name ASC, post_date ASC', sanitize_sql_orderby('name ,+ date', $cols) );
-                $this-&gt;assertEquals( 'rand() ASC', sanitize_sql_orderby('random', $cols) );
-        }
-}
-*/
-
-/**
- * @group formatting
- */
-class TestWPTexturize extends WP_UnitTestCase {
-        function test_dashes() {
-                $this-&gt;assertEquals('Hey &amp;#8212; boo?', wptexturize('Hey -- boo?'));
-                $this-&gt;assertEquals('&lt;a href=&quot;http://xx--xx&quot;&gt;Hey &amp;#8212; boo?&lt;/a&gt;', wptexturize('&lt;a href=&quot;http://xx--xx&quot;&gt;Hey -- boo?&lt;/a&gt;'));
-        }
-
-        function test_disable() {
-                $this-&gt;assertEquals('&lt;pre&gt;---&lt;/pre&gt;', wptexturize('&lt;pre&gt;---&lt;/pre&gt;'));
-                $this-&gt;assertEquals('[a]a&amp;#8211;b[code]---[/code]a&amp;#8211;b[/a]', wptexturize('[a]a--b[code]---[/code]a--b[/a]'));
-                $this-&gt;assertEquals('&lt;pre&gt;&lt;code&gt;&lt;/code&gt;--&lt;/pre&gt;', wptexturize('&lt;pre&gt;&lt;code&gt;&lt;/code&gt;--&lt;/pre&gt;'));
-
-                $this-&gt;assertEquals('&lt;code&gt;---&lt;/code&gt;', wptexturize('&lt;code&gt;---&lt;/code&gt;'));
-
-                $this-&gt;assertEquals('&lt;code&gt;href=&quot;baba&quot;&lt;/code&gt; &amp;#8220;baba&amp;#8221;', wptexturize('&lt;code&gt;href=&quot;baba&quot;&lt;/code&gt; &quot;baba&quot;'));
-
-                $enabled_tags_inside_code = '&lt;code&gt;curl -s &lt;a href=&quot;http://x/&quot;&gt;baba&lt;/a&gt; | grep sfive | cut -d &quot;\&quot;&quot; -f 10 &amp;gt; topmp3.txt&lt;/code&gt;';
-                $this-&gt;assertEquals($enabled_tags_inside_code, wptexturize($enabled_tags_inside_code));
-
-                $double_nest = '&lt;pre&gt;&quot;baba&quot;&lt;code&gt;&quot;baba&quot;&lt;pre&gt;&lt;/pre&gt;&lt;/code&gt;&quot;baba&quot;&lt;/pre&gt;';
-                $this-&gt;assertEquals($double_nest, wptexturize($double_nest));
-
-                $invalid_nest = '&lt;pre&gt;&lt;/code&gt;&quot;baba&quot;&lt;/pre&gt;';
-                $this-&gt;assertEquals($invalid_nest, wptexturize($invalid_nest));
-
-        }
-
-        //WP Ticket #1418
-        function test_bracketed_quotes_1418() {
-                $this-&gt;assertEquals('(&amp;#8220;test&amp;#8221;)', wptexturize('(&quot;test&quot;)'));
-                $this-&gt;assertEquals('(&amp;#8216;test&amp;#8217;)', wptexturize(&quot;('test')&quot;));
-                $this-&gt;assertEquals('(&amp;#8217;twas)', wptexturize(&quot;('twas)&quot;));
-        }
-
-        //WP Ticket #3810
-        function test_bracketed_quotes_3810() {
-                $this-&gt;assertEquals('A dog (&amp;#8220;Hubertus&amp;#8221;) was sent out.', wptexturize('A dog (&quot;Hubertus&quot;) was sent out.'));
-        }
-
-        //WP Ticket #4539
-        function test_basic_quotes() {
-                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize('test\'s'));
-                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize('test\'s'));
-
-                $this-&gt;assertEquals('&amp;#8216;quoted&amp;#8217;', wptexturize('\'quoted\''));
-                $this-&gt;assertEquals('&amp;#8220;quoted&amp;#8221;', wptexturize('&quot;quoted&quot;'));
-
-                $this-&gt;assertEquals('space before &amp;#8216;quoted&amp;#8217; space after', wptexturize('space before \'quoted\' space after'));
-                $this-&gt;assertEquals('space before &amp;#8220;quoted&amp;#8221; space after', wptexturize('space before &quot;quoted&quot; space after'));
-
-                $this-&gt;assertEquals('(&amp;#8216;quoted&amp;#8217;)', wptexturize('(\'quoted\')'));
-                $this-&gt;assertEquals('{&amp;#8220;quoted&amp;#8221;}', wptexturize('{&quot;quoted&quot;}'));
-
-                $this-&gt;assertEquals('&amp;#8216;qu(ot)ed&amp;#8217;', wptexturize('\'qu(ot)ed\''));
-                $this-&gt;assertEquals('&amp;#8220;qu{ot}ed&amp;#8221;', wptexturize('&quot;qu{ot}ed&quot;'));
-
-                $this-&gt;assertEquals(' &amp;#8216;test&amp;#8217;s quoted&amp;#8217; ', wptexturize(' \'test\'s quoted\' '));
-                $this-&gt;assertEquals(' &amp;#8220;test&amp;#8217;s quoted&amp;#8221; ', wptexturize(' &quot;test\'s quoted&quot; '));
-        }
-
-        /**
-         * @ticket 4539
-         * @ticket 15241
-         */
-        function test_full_sentences_with_unmatched_single_quotes() {
-                $this-&gt;assertEquals(
-                        'That means every moment you&amp;#8217;re working on something without it being in the public it&amp;#8217;s actually dying.',
-                        wptexturize(&quot;That means every moment you're working on something without it being in the public it's actually dying.&quot;)
-                );
-        }
-
-        /**
-         * @ticket 4539
-         */
-        function test_quotes() {
-                $this-&gt;assertEquals('&amp;#8220;Quoted String&amp;#8221;', wptexturize('&quot;Quoted String&quot;'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link and a period&lt;/a&gt;&amp;#8221;.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link and a period&lt;/a&gt;&quot;.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221; and a space.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot; and a space.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt; and some text quoted&amp;#8221;', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt; and some text quoted&quot;'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;, and a comma.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;, and a comma.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;; and a semi-colon.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;; and a semi-colon.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;- and a dash.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;- and a dash.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;&amp;#8230; and ellipses.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;... and ellipses.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;a test &lt;a href=&quot;http://example.com&quot;&gt;with a link&lt;/a&gt;&amp;#8221;.', wptexturize('Here is &quot;a test &lt;a href=&quot;http://example.com&quot;&gt;with a link&lt;/a&gt;&quot;.'));
-                $this-&gt;assertEquals('Here is &amp;#8220;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&amp;#8221;and a work stuck to the end.', wptexturize('Here is &quot;&lt;a href=&quot;http://example.com&quot;&gt;a test with a link&lt;/a&gt;&quot;and a work stuck to the end.'));
-                $this-&gt;assertEquals('A test with a finishing number, &amp;#8220;like 23&amp;#8221;.', wptexturize('A test with a finishing number, &quot;like 23&quot;.'));
-                $this-&gt;assertEquals('A test with a number, &amp;#8220;like 62&amp;#8221;, is nice to have.', wptexturize('A test with a number, &quot;like 62&quot;, is nice to have.'));
-        }
-
-        /**
-         * @ticket 4539
-         */
-        function test_quotes_before_s() {
-                $this-&gt;assertEquals('test&amp;#8217;s', wptexturize(&quot;test's&quot;));
-                $this-&gt;assertEquals('&amp;#8216;test&amp;#8217;s', wptexturize(&quot;'test's&quot;));
-                $this-&gt;assertEquals('&amp;#8216;test&amp;#8217;s&amp;#8217;', wptexturize(&quot;'test's'&quot;));
-                $this-&gt;assertEquals('&amp;#8216;string&amp;#8217;', wptexturize(&quot;'string'&quot;));
-                $this-&gt;assertEquals('&amp;#8216;string&amp;#8217;s&amp;#8217;', wptexturize(&quot;'string's'&quot;));
-        }
-
-        /**
-         * @ticket 4539
-         */
-        function test_quotes_before_numbers() {
-                $this-&gt;assertEquals('Class of &amp;#8217;99', wptexturize(&quot;Class of '99&quot;));
-                $this-&gt;assertEquals('Class of &amp;#8217;99&amp;#8217;s', wptexturize(&quot;Class of '99's&quot;));
-                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;', wptexturize(&quot;'Class of '99'&quot;));
-                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;s&amp;#8217;', wptexturize(&quot;'Class of '99's'&quot;));
-                $this-&gt;assertEquals('&amp;#8216;Class of &amp;#8217;99&amp;#8217;s&amp;#8217;', wptexturize(&quot;'Class of '99&amp;#8217;s'&quot;));
-                $this-&gt;assertEquals('&amp;#8220;Class of 99&amp;#8221;', wptexturize(&quot;\&quot;Class of 99\&quot;&quot;));
-                $this-&gt;assertEquals('&amp;#8220;Class of &amp;#8217;99&amp;#8221;', wptexturize(&quot;\&quot;Class of '99\&quot;&quot;));
-        }
-
-        function test_quotes_after_numbers() {
-                $this-&gt;assertEquals('Class of &amp;#8217;99', wptexturize(&quot;Class of '99&quot;));
-        }
-
-        /**
-         * @ticket 4539
-         * @ticket 15241
-         */
-        function test_other_html() {
-                $this-&gt;assertEquals('&amp;#8216;&lt;strong&gt;', wptexturize(&quot;'&lt;strong&gt;&quot;));
-                $this-&gt;assertEquals('&amp;#8216;&lt;strong&gt;Quoted Text&lt;/strong&gt;&amp;#8217;,', wptexturize(&quot;'&lt;strong&gt;Quoted Text&lt;/strong&gt;',&quot;));
-                $this-&gt;assertEquals('&amp;#8220;&lt;strong&gt;Quoted Text&lt;/strong&gt;&amp;#8221;,', wptexturize('&quot;&lt;strong&gt;Quoted Text&lt;/strong&gt;&quot;,'));
-        }
-
-        function test_x() {
-                $this-&gt;assertEquals('14&amp;#215;24', wptexturize(&quot;14x24&quot;));
-        }
-
-        function test_minutes_seconds() {
-                $this-&gt;assertEquals('9&amp;#8242;', wptexturize('9\''));
-                $this-&gt;assertEquals('9&amp;#8243;', wptexturize(&quot;9\&quot;&quot;));
-
-                $this-&gt;assertEquals('a 9&amp;#8242; b', wptexturize('a 9\' b'));
-                $this-&gt;assertEquals('a 9&amp;#8243; b', wptexturize(&quot;a 9\&quot; b&quot;));
-
-                $this-&gt;assertEquals('&amp;#8220;a 9&amp;#8242; b&amp;#8221;', wptexturize('&quot;a 9\' b&quot;'));
-                $this-&gt;assertEquals('&amp;#8216;a 9&amp;#8243; b&amp;#8217;', wptexturize(&quot;'a 9\&quot; b'&quot;));
-        }
-
-        /**
-         * @ticket 8775
-         */
-        function test_wptexturize_quotes_around_numbers() {
-                $this-&gt;assertEquals('&amp;#8220;12345&amp;#8221;', wptexturize('&quot;12345&quot;'));
-                $this-&gt;assertEquals('&amp;#8216;12345&amp;#8217;', wptexturize('\'12345\''));
-                $this-&gt;assertEquals('&amp;#8220;a 9&amp;#8242; plus a &amp;#8216;9&amp;#8217;, maybe a 9&amp;#8242; &amp;#8216;9&amp;#8217; &amp;#8221;', wptexturize('&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;'));
-                $this-&gt;assertEquals('&lt;p&gt;&amp;#8216;99&lt;br /&gt;&amp;#8216;123&amp;#8217;&lt;br /&gt;&amp;#8217;tis&lt;br /&gt;&amp;#8216;s&amp;#8217;&lt;/p&gt;', wptexturize('&lt;p&gt;\'99&lt;br /&gt;\'123\'&lt;br /&gt;\'tis&lt;br /&gt;\'s\'&lt;/p&gt;'));
-        }
-
-        /**
-         * @ticket 8912
-         */
-        function test_wptexturize_html_comments() {
-                $this-&gt;assertEquals('&lt;!--[if !IE]&gt;--&gt;&lt;!--&lt;![endif]--&gt;', wptexturize('&lt;!--[if !IE]&gt;--&gt;&lt;!--&lt;![endif]--&gt;'));
-                $this-&gt;assertEquals('&lt;!--[if !IE]&gt;&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;&lt;![endif]--&gt;', wptexturize('&lt;!--[if !IE]&gt;&quot;a 9\' plus a \'9\', maybe a 9\' \'9\' &quot;&lt;![endif]--&gt;'));
-                $this-&gt;assertEquals('&lt;ul&gt;&lt;li&gt;Hello.&lt;/li&gt;&lt;!--&lt;li&gt;Goodbye.&lt;/li&gt;--&gt;&lt;/ul&gt;', wptexturize('&lt;ul&gt;&lt;li&gt;Hello.&lt;/li&gt;&lt;!--&lt;li&gt;Goodbye.&lt;/li&gt;--&gt;&lt;/ul&gt;'));
-        }
-
-        /**
-         * @ticket 4539
-         * @ticket 15241
-         */
-        function test_entity_quote_cuddling() {
-                $this-&gt;assertEquals('&amp;nbsp;&amp;#8220;Testing&amp;#8221;', wptexturize('&amp;nbsp;&quot;Testing&quot;'));
-                $this-&gt;assertEquals('&amp;#38;&amp;#8220;Testing&amp;#8221;', wptexturize('&amp;#38;&quot;Testing&quot;'));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestEscUrl extends WP_UnitTestCase {
-        function test_spaces() {
-                $this-&gt;assertEquals('http://example.com/MrWordPress', esc_url('http://example.com/Mr WordPress'));
-                $this-&gt;assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr%20WordPress'));
-        }
-
-        function test_bad_characters() {
-                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0Ago'));
-                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0ago'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0Dgo'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0dgo'));
-                //Nesting Checks
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0ddgo'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0DDgo'));
-                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAD'));
-                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADA'));
-                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAd'));
-                $this-&gt;assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADa'));
-        }
-
-        function test_relative() {
-                $this-&gt;assertEquals('/example.php', esc_url('/example.php'));
-                $this-&gt;assertEquals('example.php', esc_url('example.php'));
-                $this-&gt;assertEquals('#fragment', esc_url('#fragment'));
-                $this-&gt;assertEquals('?foo=bar', esc_url('?foo=bar'));
-        }
-
-        function test_protocol() {
-                $this-&gt;assertEquals('http://example.com', esc_url('http://example.com'));
-                $this-&gt;assertEquals('', esc_url('nasty://example.com/'));
-        }
-
-        function test_display_extras() {
-                $this-&gt;assertEquals('http://example.com/&amp;#039;quoted&amp;#039;', esc_url('http://example.com/\'quoted\''));
-                $this-&gt;assertEquals('http://example.com/\'quoted\'', esc_url('http://example.com/\'quoted\'',null,'notdisplay'));
-        }
-
-        function test_non_ascii() {
-                $this-&gt;assertEquals( 'http://example.org/баба', esc_url( 'http://example.org/баба' ) );
-                $this-&gt;assertEquals( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) );
-                $this-&gt;assertEquals( 'http://müller.com/', esc_url( 'http://müller.com/' ) );
-        }
-
-        function test_feed() {
-                $this-&gt;assertEquals( '', esc_url( 'feed:javascript:alert(1)' ) );
-                $this-&gt;assertEquals( '', esc_url( 'feed:javascript:feed:alert(1)' ) );
-                $this-&gt;assertEquals( '', esc_url( 'feed:feed:javascript:alert(1)' ) );
-                $this-&gt;assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) );
-                $this-&gt;assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) );
-        }
-
-        /**
-         * @ticket 16859
-         */
-        function test_square_brackets() {
-                $this-&gt;assertEquals( 'http://example.com/?foo%5Bbar%5D=baz', esc_url( 'http://example.com/?foo[bar]=baz' ) );
-                $this-&gt;assertEquals( 'http://example.com/?baz=bar&amp;#038;foo%5Bbar%5D=baz', esc_url( 'http://example.com/?baz=bar&amp;foo[bar]=baz' ) );
-                //IPv6 addresses in urls - RFC2732
-                $this-&gt;assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) );
-                $this-&gt;assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) );
-                $this-&gt;assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestAutop extends WP_UnitTestCase {
-        //From ticket http://core.trac.wordpress.org/ticket/11008
-        function test_first_post() {
-                $expected = '&lt;p&gt;Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.&lt;/p&gt;
-&lt;p&gt;First things first:&lt;/p&gt;
-&lt;ul&gt;
-&lt;li&gt;&lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Subscribe to the WordPress mailing list for release notifications&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-&lt;p&gt;As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.&lt;br /&gt;
-When a new version is released, &lt;a href=&quot;%2$s&quot; title=&quot;If you are already logged in, this will take you directly to the Dashboard&quot;&gt;log in to the Dashboard&lt;/a&gt; and follow the instructions.&lt;br /&gt;
-Upgrading is a couple of clicks!&lt;/p&gt;
-&lt;p&gt;Then you can start enjoying the WordPress experience:&lt;/p&gt;
-&lt;ul&gt;
-&lt;li&gt;Edit your personal information at &lt;a href=&quot;%3$s&quot; title=&quot;Edit settings like your password, your display name and your contact information&quot;&gt;Users &amp;#8250; Your Profile&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Start publishing at &lt;a href=&quot;%4$s&quot; title=&quot;Create a new post&quot;&gt;Posts &amp;#8250; Add New&lt;/a&gt; and at &lt;a href=&quot;%5$s&quot; title=&quot;Create a new page&quot;&gt;Pages &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Browse and install plugins at &lt;a href=&quot;%6$s&quot; title=&quot;Browse and install plugins at the official WordPress repository directly from your Dashboard&quot;&gt;Plugins &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Browse and install themes at &lt;a href=&quot;%7$s&quot; title=&quot;Browse and install themes at the official WordPress repository directly from your Dashboard&quot;&gt;Appearance &amp;#8250; Add New Themes&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Modify and prettify your website&amp;#8217;s links at &lt;a href=&quot;%8$s&quot; title=&quot;For example, select a link structure like: http://example.com/1999/12/post-name&quot;&gt;Settings &amp;#8250; Permalinks&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Import content from another system or WordPress site at &lt;a href=&quot;%9$s&quot; title=&quot;WordPress comes with importers for the most common publishing systems&quot;&gt;Tools &amp;#8250; Import&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Find answers to your questions at the &lt;a href=&quot;%10$s&quot; title=&quot;The official WordPress documentation, maintained by the WordPress community&quot;&gt;WordPress Codex&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-&lt;p&gt;To keep this post for reference, &lt;a href=&quot;%11$s&quot; title=&quot;Click to edit the content and settings of this post&quot;&gt;click to edit it&lt;/a&gt;, go to the Publish box and change its Visibility from Public to Private.&lt;/p&gt;
-&lt;p&gt;Thank you for selecting WordPress.  We wish you happy publishing!&lt;/p&gt;
-&lt;p&gt;PS.  Not yet subscribed for update notifications?  &lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Do it now!&lt;/a&gt;&lt;/p&gt;
-';
-                $test_data = '
-Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.
-
-First things first:
-&lt;ul&gt;
-&lt;li&gt;&lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Subscribe to the WordPress mailing list for release notifications&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.
-When a new version is released, &lt;a href=&quot;%2$s&quot; title=&quot;If you are already logged in, this will take you directly to the Dashboard&quot;&gt;log in to the Dashboard&lt;/a&gt; and follow the instructions.
-Upgrading is a couple of clicks!
-
-Then you can start enjoying the WordPress experience:
-&lt;ul&gt;
-&lt;li&gt;Edit your personal information at &lt;a href=&quot;%3$s&quot; title=&quot;Edit settings like your password, your display name and your contact information&quot;&gt;Users &amp;#8250; Your Profile&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Start publishing at &lt;a href=&quot;%4$s&quot; title=&quot;Create a new post&quot;&gt;Posts &amp;#8250; Add New&lt;/a&gt; and at &lt;a href=&quot;%5$s&quot; title=&quot;Create a new page&quot;&gt;Pages &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Browse and install plugins at &lt;a href=&quot;%6$s&quot; title=&quot;Browse and install plugins at the official WordPress repository directly from your Dashboard&quot;&gt;Plugins &amp;#8250; Add New&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Browse and install themes at &lt;a href=&quot;%7$s&quot; title=&quot;Browse and install themes at the official WordPress repository directly from your Dashboard&quot;&gt;Appearance &amp;#8250; Add New Themes&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Modify and prettify your website&amp;#8217;s links at &lt;a href=&quot;%8$s&quot; title=&quot;For example, select a link structure like: http://example.com/1999/12/post-name&quot;&gt;Settings &amp;#8250; Permalinks&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Import content from another system or WordPress site at &lt;a href=&quot;%9$s&quot; title=&quot;WordPress comes with importers for the most common publishing systems&quot;&gt;Tools &amp;#8250; Import&lt;/a&gt;&lt;/li&gt;
-&lt;li&gt;Find answers to your questions at the &lt;a href=&quot;%10$s&quot; title=&quot;The official WordPress documentation, maintained by the WordPress community&quot;&gt;WordPress Codex&lt;/a&gt;&lt;/li&gt;
-&lt;/ul&gt;
-To keep this post for reference, &lt;a href=&quot;%11$s&quot; title=&quot;Click to edit the content and settings of this post&quot;&gt;click to edit it&lt;/a&gt;, go to the Publish box and change its Visibility from Public to Private.
-
-Thank you for selecting WordPress.  We wish you happy publishing!
-
-PS.  Not yet subscribed for update notifications?  &lt;a href=&quot;%1$s&quot; title=&quot;Subscribe to the WordPress mailing list for Release Notifications&quot;&gt;Do it now!&lt;/a&gt;
-';
-
-                // On windows environments, the EOL-style is \r\n
-                $expected = str_replace( &quot;\r\n&quot;, &quot;\n&quot;, $expected);
-
-                $this-&gt;assertEquals($expected, wpautop($test_data));
-        }
-
-        /**
-         * wpautop() Should not alter the contents of &quot;&lt;pre&gt;&quot; elements
-         *
-         * @ticket 19855
-         */
-        public function test_skip_pre_elements() {
-                $code = file_get_contents( DIR_TESTDATA . '/formatting/sizzle.js' );
-                $code = str_replace( &quot;\r&quot;, '', $code );
-                $code = htmlentities( $code );
-
-                // Not wrapped in &lt;p&gt; tags
-                $str = &quot;&lt;pre&gt;$code&lt;/pre&gt;&quot;;
-                $this-&gt;assertEquals( $str, trim( wpautop( $str ) ) );
-
-                // Text before/after is wrapped in &lt;p&gt; tags
-                $str = &quot;Look at this code\n\n&lt;pre&gt;$code&lt;/pre&gt;\n\nIsn't that cool?&quot;;
-
-                // Expected text after wpautop
-                $expected = '&lt;p&gt;Look at this code&lt;/p&gt;' . &quot;\n&lt;pre&gt;&quot; . $code . &quot;&lt;/pre&gt;\n&quot; . '&lt;p&gt;Isn\'t that cool?&lt;/p&gt;';
-                $this-&gt;assertEquals( $expected, trim( wpautop( $str ) ) );
-
-                // Make sure HTML breaks are maintained if manually inserted
-                $str = &quot;Look at this code\n\n&lt;pre&gt;Line1&lt;br /&gt;Line2&lt;br&gt;Line3&lt;br/&gt;Line4\nActual Line 2\nActual Line 3&lt;/pre&gt;\n\nCool, huh?&quot;;
-                $expected = &quot;&lt;p&gt;Look at this code&lt;/p&gt;\n&lt;pre&gt;Line1&lt;br /&gt;Line2&lt;br&gt;Line3&lt;br/&gt;Line4\nActual Line 2\nActual Line 3&lt;/pre&gt;\n&lt;p&gt;Cool, huh?&lt;/p&gt;&quot;;
-                $this-&gt;assertEquals( $expected, trim( wpautop( $str ) ) );
-        }
-
-        /**
-         * wpautop() Should not add &lt;br/&gt; to &quot;&lt;input&gt;&quot; elements
-         *
-         * @ticket 16456
-         */
-        public function test_skip_input_elements() {
-                $str = 'Username: &lt;input type=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; /&gt;&lt;br /&gt;Password: &lt;input type=&quot;password&quot; id=&quot;password1&quot; name=&quot;password1&quot; /&gt;';
-                $this-&gt;assertEquals( &quot;&lt;p&gt;$str&lt;/p&gt;&quot;, trim( wpautop( $str ) ) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestLikeEscape extends WP_UnitTestCase {
-        /**
-         * @ticket 10041
-         */
-        function test_like_escape() {
-
-                $inputs = array(
-                        'howdy%', //Single Percent
-                        'howdy_', //Single Underscore
-                        'howdy\\', //Single slash
-                        'howdy\\howdy%howdy_', //The works
-                );
-                $expected = array(
-                        &quot;howdy\\%&quot;,
-                        'howdy\\_',
-                        'howdy\\\\',
-                        'howdy\\\\howdy\\%howdy\\_'
-                );
-
-                foreach ($inputs as $key =&gt; $input) {
-                        $this-&gt;assertEquals($expected[$key], like_escape($input));
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeTextField extends WP_UnitTestCase {
-        // #11528
-        function test_sanitize_text_field() {
-                $inputs = array(
-                        'оРангутанг', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
-                        'САПР', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
-                        'one is &lt; two',
-                        'tags &lt;span&gt;are&lt;/span&gt; &lt;em&gt;not allowed&lt;/em&gt; here',
-                        ' we should trim leading and trailing whitespace ',
-                        'we  also  trim  extra  internal  whitespace',
-                        'tabs         get removed too',
-                        'newlines are not welcome
-                        here',
-                        'We also %AB remove %ab octets',
-                        'We don\'t need to wory about %A
-                        B removing %a
-                        b octets even when %a        B they are obscured by whitespace',
-                        '%AB%BC%DE', //Just octets
-                        'Invalid octects remain %II',
-                        'Nested octects %%%ABABAB %A%A%ABBB',
-                );
-                $expected = array(
-                        'оРангутанг',
-                        'САПР',
-                        'one is &amp;lt; two',
-                        'tags are not allowed here',
-                        'we should trim leading and trailing whitespace',
-                        'we also trim extra internal whitespace',
-                        'tabs get removed too',
-                        'newlines are not welcome here',
-                        'We also remove octets',
-                        'We don\'t need to wory about %A B removing %a b octets even when %a B they are obscured by whitespace',
-                        '', //Emtpy as we strip all the octets out
-                        'Invalid octects remain %II',
-                        'Nested octects',
-                );
-
-                foreach ($inputs as $key =&gt; $input) {
-                        $this-&gt;assertEquals($expected[$key], sanitize_text_field($input));
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeMimeType extends WP_UnitTestCase {
-        // 17855
-        function test_sanitize_valid_mime_type() {
-                $inputs = array(
-                        'application/atom+xml',
-                        'application/EDI-X12',
-                        'application/EDIFACT',
-                        'application/json',
-                        'application/javascript',
-                        'application/octet-stream',
-                        'application/ogg',
-                        'application/pdf',
-                        'application/postscript',
-                        'application/soap+xml',
-                        'application/x-woff',
-                        'application/xhtml+xml',
-                        'application/xml-dtd',
-                        'application/xop+xml',
-                        'application/zip',
-                        'application/x-gzip',
-                        'audio/basic',
-                        'image/jpeg',
-                        'text/css',
-                        'text/html',
-                        'text/plain',
-                        'video/mpeg',
-                );
-
-                foreach ( $inputs as $input ) {
-                        $this-&gt;assertEquals($input, sanitize_mime_type($input));
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeFileName extends WP_UnitTestCase {
-        function test_munges_extensions() {
-                # r17990
-                $file_name = sanitize_file_name( 'test.phtml.txt' );
-                $this-&gt;assertEquals( 'test.phtml_.txt', $file_name );
-        }
-
-        function test_removes_special_chars() {
-                $special_chars = array(&quot;?&quot;, &quot;[&quot;, &quot;]&quot;, &quot;/&quot;, &quot;\\&quot;, &quot;=&quot;, &quot;&lt;&quot;, &quot;&gt;&quot;, &quot;:&quot;, &quot;;&quot;, &quot;,&quot;, &quot;'&quot;, &quot;\&quot;&quot;, &quot;&amp;&quot;, &quot;$&quot;, &quot;#&quot;, &quot;*&quot;, &quot;(&quot;, &quot;)&quot;, &quot;|&quot;, &quot;~&quot;, &quot;`&quot;, &quot;!&quot;, &quot;{&quot;, &quot;}&quot;, chr(0));
-                $string = 'test';
-                foreach ( $special_chars as $char )
-                        $string .= $char;
-                $string .= 'test';
-                $this-&gt;assertEquals( 'testtest', sanitize_file_name( $string ) );
-        }
-
-        function test_replaces_any_number_of_hyphens_with_one_hyphen() {
-                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_file_name(&quot;a----t----t&quot;));
-        }
-
-        function test_trims_trailing_hyphens() {
-                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_file_name(&quot;a----t----t----&quot;));
-        }
-
-        function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
-                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_file_name(&quot;a          t&quot;));
-                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_file_name(&quot;a    \n\n\nt&quot;));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestWPSpecialchars extends WP_UnitTestCase {
-        function test_wp_specialchars_basics() {
-                $html =  &quot;&amp;amp;&amp;lt;hello world&amp;gt;&quot;;
-                $this-&gt;assertEquals( $html, _wp_specialchars( $html ) );
-
-                $double = &quot;&amp;amp;amp;&amp;amp;lt;hello world&amp;amp;gt;&quot;;
-                $this-&gt;assertEquals( $double, _wp_specialchars( $html, ENT_NOQUOTES, false, true ) );
-        }
-
-        function test_allowed_entity_names() {
-                global $allowedentitynames;
-
-                // Allowed entities should be unchanged
-                foreach ( $allowedentitynames as $ent ) {
-                        $ent = '&amp;' . $ent . ';';
-                        $this-&gt;assertEquals( $ent, _wp_specialchars( $ent ) );
-                }
-        }
-
-        function test_not_allowed_entity_names() {
-                $ents = array( 'iacut', 'aposs', 'pos', 'apo', 'apo?', 'apo.*', '.*apo.*', 'apos ', ' apos', ' apos ' );
-
-                foreach ( $ents as $ent ) {
-                        $escaped = '&amp;amp;' . $ent . ';';
-                        $ent = '&amp;' . $ent . ';';
-                        $this-&gt;assertEquals( $escaped, _wp_specialchars( $ent ) );
-                }
-        }
-
-        function test_optionally_escapes_quotes() {
-                $source = &quot;\&quot;'hello!'\&quot;&quot;;
-                $this-&gt;assertEquals( '&quot;&amp;#039;hello!&amp;#039;&quot;', _wp_specialchars($source, 'single') );
-                $this-&gt;assertEquals( &quot;&amp;quot;'hello!'&amp;quot;&quot;, _wp_specialchars($source, 'double') );
-                $this-&gt;assertEquals( '&amp;quot;&amp;#039;hello!&amp;#039;&amp;quot;', _wp_specialchars($source, true) );
-                $this-&gt;assertEquals( $source, _wp_specialchars($source) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestEscAttr extends WP_UnitTestCase {
-        function test_esc_attr_quotes() {
-                $attr = '&quot;double quotes&quot;';
-                $this-&gt;assertEquals( '&amp;quot;double quotes&amp;quot;', esc_attr( $attr ) );
-
-                $attr = &quot;'single quotes'&quot;;
-                $this-&gt;assertEquals( '&amp;#039;single quotes&amp;#039;', esc_attr( $attr ) );
-
-                $attr = &quot;'mixed' &quot; . '&quot;quotes&quot;';
-                $this-&gt;assertEquals( '&amp;#039;mixed&amp;#039; &amp;quot;quotes&amp;quot;', esc_attr( $attr ) );
-
-                // Handles double encoding?
-                $attr = '&quot;double quotes&quot;';
-                $this-&gt;assertEquals( '&amp;quot;double quotes&amp;quot;', esc_attr( esc_attr( $attr ) ) );
-
-                $attr = &quot;'single quotes'&quot;;
-                $this-&gt;assertEquals( '&amp;#039;single quotes&amp;#039;', esc_attr( esc_attr( $attr ) ) );
-
-                $attr = &quot;'mixed' &quot; . '&quot;quotes&quot;';
-                $this-&gt;assertEquals( '&amp;#039;mixed&amp;#039; &amp;quot;quotes&amp;quot;', esc_attr( esc_attr( $attr ) ) );
-        }
-
-        function test_esc_attr_amp() {
-                $out = esc_attr( 'foo &amp; bar &amp;baz; &amp;apos;' );
-                $this-&gt;assertEquals( &quot;foo &amp;amp; bar &amp;amp;baz; &amp;apos;&quot;, $out );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestEscHtml extends WP_UnitTestCase {
-        function test_esc_html_basics() {
-                // Simple string
-                $html = &quot;The quick brown fox.&quot;;
-                $this-&gt;assertEquals( $html, esc_html( $html ) );
-
-                // URL with &amp;
-                $html = &quot;http://localhost/trunk/wp-login.php?action=logout&amp;_wpnonce=cd57d75985&quot;;
-                $escaped = &quot;http://localhost/trunk/wp-login.php?action=logout&amp;amp;_wpnonce=cd57d75985&quot;;
-                $this-&gt;assertEquals( $escaped, esc_html( $html ) );
-
-                // SQL query
-                $html = &quot;SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1&quot;;
-                $escaped = &quot;SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN (&amp;#039;site_name&amp;#039;, &amp;#039;siteurl&amp;#039;, &amp;#039;active_sitewide_plugins&amp;#039;, &amp;#039;_site_transient_timeout_theme_roots&amp;#039;, &amp;#039;_site_transient_theme_roots&amp;#039;, &amp;#039;site_admins&amp;#039;, &amp;#039;can_compress_scripts&amp;#039;, &amp;#039;global_terms_enabled&amp;#039;) AND site_id = 1&quot;;
-                $this-&gt;assertEquals( $escaped, esc_html( $html ) );
-        }
-
-        function test_escapes_ampersands() {
-                $source = &quot;penn &amp; teller &amp; at&amp;t&quot;;
-                $res = &quot;penn &amp;amp; teller &amp;amp; at&amp;amp;t&quot;;
-                $this-&gt;assertEquals( $res, esc_html($source) );
-        }
-
-        function test_escapes_greater_and_less_than() {
-                $source = &quot;this &gt; that &lt; that &lt;randomhtml /&gt;&quot;;
-                $res = &quot;this &amp;gt; that &amp;lt; that &amp;lt;randomhtml /&amp;gt;&quot;;
-                $this-&gt;assertEquals( $res, esc_html($source) );
-        }
-
-        function test_ignores_existing_entities() {
-                $source = '&amp;#038; &amp;#x00A3; &amp;#x22; &amp;amp;';
-                $res = '&amp;amp; &amp;#xA3; &amp;quot; &amp;amp;';
-                $this-&gt;assertEquals( $res, esc_html($source) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeUser extends WP_UnitTestCase {
-        function test_strips_html() {
-                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
-                $expected = is_multisite() ? 'captain awesome' : 'Captain Awesome';
-                $this-&gt;assertEquals($expected, sanitize_user($input));
-        }
-        /**
-         * @ticket 10823
-         */
-        function test_strips_entities() {
-                $this-&gt;assertEquals(&quot;ATT&quot;, sanitize_user(&quot;AT&amp;amp;T&quot;));
-                $this-&gt;assertEquals(&quot;ATT Test;&quot;, sanitize_user(&quot;AT&amp;amp;T Test;&quot;));
-                $this-&gt;assertEquals(&quot;AT&amp;T Test;&quot;, sanitize_user(&quot;AT&amp;T Test;&quot;));
-        }
-        function test_strips_percent_encoded_octets() {
-                $expected = is_multisite() ? 'franois' : 'Franois';
-                $this-&gt;assertEquals( $expected, sanitize_user( &quot;Fran%c3%a7ois&quot; ) );
-        }
-        function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
-                $this-&gt;assertEquals(&quot;abc&quot;, sanitize_user(&quot;()~ab~ˆcˆ!&quot;, true));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestIsEmail extends WP_UnitTestCase {
-        function test_returns_true_if_given_a_valid_email_address() {
-                $data = array(
-                        &quot;bob@example.com&quot;,
-                        &quot;phil@example.info&quot;,
-                        &quot;ace@204.32.222.14&quot;,
-                        &quot;kevin@many.subdomains.make.a.happy.man.edu&quot;
-                        );
-                foreach ( $data as $datum ) {
-                        $this-&gt;assertEquals( $datum, is_email($datum), $datum );
-                }
-        }
-
-        function test_returns_false_if_given_an_invalid_email_address() {
-                $data = array(
-                        &quot;khaaaaaaaaaaaaaaan!&quot;,
-                        'http://bob.example.com/',
-                        &quot;sif i'd give u it, spamer!1&quot;,
-                        &quot;com.exampleNOSPAMbob&quot;,
-                        &quot;bob@your mom&quot;
-                        );
-                foreach ($data as $datum) {
-                        $this-&gt;assertFalse(is_email($datum), $datum);
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeTitle extends WP_UnitTestCase {
-        function test_strips_html() {
-                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
-                $expected = &quot;captain-awesome&quot;;
-                $this-&gt;assertEquals($expected, sanitize_title($input));
-        }
-
-        function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
-                $input = &quot;&lt;strong&gt;&lt;/strong&gt;&quot;;
-                $fallback = &quot;Captain Awesome&quot;;
-                $this-&gt;assertEquals($fallback, sanitize_title($input, $fallback));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSanitizeTitleWithDashes extends WP_UnitTestCase {
-        function test_strips_html() {
-                $input = &quot;Captain &lt;strong&gt;Awesome&lt;/strong&gt;&quot;;
-                $expected = &quot;captain-awesome&quot;;
-                $this-&gt;assertEquals($expected, sanitize_title($input));
-        }
-
-        function test_strips_unencoded_percent_signs() {
-                $this-&gt;assertEquals(&quot;fran%c3%a7ois&quot;, sanitize_title_with_dashes(&quot;fran%c3%a7%ois&quot;));
-        }
-
-        function test_makes_title_lowercase() {
-                $this-&gt;assertEquals(&quot;abc&quot;, sanitize_title_with_dashes(&quot;ABC&quot;));
-        }
-
-        function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
-                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_title_with_dashes(&quot;a          t&quot;));
-                $this-&gt;assertEquals(&quot;a-t&quot;, sanitize_title_with_dashes(&quot;a    \n\n\nt&quot;));
-        }
-
-        function test_replaces_any_number_of_hyphens_with_one_hyphen() {
-                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_title_with_dashes(&quot;a----t----t&quot;));
-        }
-
-        function test_trims_trailing_hyphens() {
-                $this-&gt;assertEquals(&quot;a-t-t&quot;, sanitize_title_with_dashes(&quot;a----t----t----&quot;));
-        }
-
-        function test_handles_non_entity_ampersands() {
-                $this-&gt;assertEquals(&quot;penn-teller-bull&quot;, sanitize_title_with_dashes(&quot;penn &amp; teller bull&quot;));
-        }
-
-        /**
-         * @ticket 10823
-         */
-        function test_strips_entities() {
-                $this-&gt;assertEquals(&quot;no-entities-here&quot;, sanitize_title_with_dashes(&quot;No &amp;nbsp; Entities &amp;ndash; Here &amp;amp;&quot;));
-                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;amp; Two&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;#123; Two;&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp; Two;&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One Two™;&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;one-two&quot;, sanitize_title_with_dashes(&quot;One &amp;&amp;amp; Two;&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;onetwo&quot;, sanitize_title_with_dashes(&quot;One&amp;Two&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;onetwo-test&quot;, sanitize_title_with_dashes(&quot;One&amp;Two Test;&quot;, '', 'save'));
-        }
-
-        function test_replaces_nbsp() {
-                $this-&gt;assertEquals(&quot;dont-break-the-space&quot;, sanitize_title_with_dashes(&quot;don't break the space&quot;, '', 'save'));
-        }
-
-        function test_replaces_ndash_mdash() {
-                $this-&gt;assertEquals(&quot;do-the-dash&quot;, sanitize_title_with_dashes(&quot;Do – the Dash&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;do-the-dash&quot;, sanitize_title_with_dashes(&quot;Do the — Dash&quot;, '', 'save'));
-        }
-
-        function test_replaces_iexcel_iquest() {
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just ¡a Slug&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just a Slug¿&quot;, '', 'save'));
-        }
-
-        function test_replaces_angle_quotes() {
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;‹Just a Slug›&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;«Just a Slug»&quot;, '', 'save'));
-        }
-
-        function test_replaces_curly_quotes() {
-                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its “Curly Joe”&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its ‘Curly Joe’&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its „Curly Joe“&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its ‚Curly Joe‛&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;hey-its-curly-joe&quot;, sanitize_title_with_dashes(&quot;Hey its „Curly Joe‟&quot;, '', 'save'));
-        }
-
-        function test_replaces_copy_reg_deg_trade() {
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just © a Slug&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;® Just a Slug&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just a ° Slug&quot;, '', 'save'));
-                $this-&gt;assertEquals(&quot;just-a-slug&quot;, sanitize_title_with_dashes(&quot;Just ™ a Slug&quot;, '', 'save'));
-        }
-
-        /**
-         * @ticket 19820
-         */
-        function test_replaces_multiply_sign() {
-                $this-&gt;assertEquals(&quot;6x7-is-42&quot;, sanitize_title_with_dashes(&quot;6×7 is 42&quot;, '', 'save'));
-        }
-
-        /**
-         * @ticket 20772
-         */
-        function test_replaces_standalone_diacritic() {
-                $this-&gt;assertEquals(&quot;aaaa&quot;, sanitize_title_with_dashes(&quot;āáǎà&quot;, '', 'save'));
-        }
-
-}
-
-/**
- * @group formatting
- */
-class TestConvertChars extends WP_UnitTestCase {
-        function test_replaces_windows1252_entities_with_unicode_ones() {
-                $input = &quot;&amp;#130;&amp;#131;&amp;#132;&amp;#133;&amp;#134;&amp;#135;&amp;#136;&amp;#137;&amp;#138;&amp;#139;&amp;#140;&amp;#145;&amp;#146;&amp;#147;&amp;#148;&amp;#149;&amp;#150;&amp;#151;&amp;#152;&amp;#153;&amp;#154;&amp;#155;&amp;#156;&amp;#159;&quot;;
-                $output = &quot;&amp;#8218;&amp;#402;&amp;#8222;&amp;#8230;&amp;#8224;&amp;#8225;&amp;#710;&amp;#8240;&amp;#352;&amp;#8249;&amp;#338;&amp;#8216;&amp;#8217;&amp;#8220;&amp;#8221;&amp;#8226;&amp;#8211;&amp;#8212;&amp;#732;&amp;#8482;&amp;#353;&amp;#8250;&amp;#339;&amp;#376;&quot;;
-                $this-&gt;assertEquals($output, convert_chars($input));
-        }
-
-        /**
-         * @ticket 20503
-         */
-        function test_replaces_latin_letter_z_with_caron() {
-                $input = &quot;&amp;#142;&amp;#158;&quot;;
-                $output = &quot;&amp;#381;&amp;#382;&quot;;
-                $this-&gt;assertEquals( $output, convert_chars( $input ) );
-        }
-
-        function test_converts_html_br_and_hr_to_the_xhtml_self_closing_variety() {
-                $inputs = array(
-                        &quot;abc &lt;br&gt; lol &lt;br /&gt;&quot; =&gt; &quot;abc &lt;br /&gt; lol &lt;br /&gt;&quot;,
-                        &quot;&lt;br&gt; ho ho &lt;hr&gt;&quot;     =&gt; &quot;&lt;br /&gt; ho ho &lt;hr /&gt;&quot;,
-                        &quot;&lt;hr&gt;&lt;br&gt;&quot;            =&gt; &quot;&lt;hr /&gt;&lt;br /&gt;&quot;
-                        );
-                foreach ($inputs as $input =&gt; $expected) {
-                        $this-&gt;assertEquals($expected, convert_chars($input));
-                }
-        }
-
-        function test_escapes_lone_ampersands() {
-                $this-&gt;assertEquals(&quot;at&amp;#038;t&quot;, convert_chars(&quot;at&amp;t&quot;));
-        }
-
-        function test_removes_category_and_title_metadata_tags() {
-                $this-&gt;assertEquals(&quot;&quot;, convert_chars(&quot;&lt;title&gt;&lt;div class='lol'&gt;abc&lt;/div&gt;&lt;/title&gt;&lt;category&gt;a&lt;/category&gt;&quot;));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestZeroise extends WP_UnitTestCase {
-        function test_pads_with_leading_zeroes() {
-                $this-&gt;assertEquals(&quot;00005&quot;, zeroise(5, 5));
-        }
-
-        function test_does_nothing_if_input_is_already_longer() {
-                $this-&gt;assertEquals(&quot;5000000&quot;, zeroise(5000000, 2));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestBackslashit extends WP_UnitTestCase {
-        function test_backslashes_alphas() {
-                $this-&gt;assertEquals(&quot;\\a943\\b\\c&quot;, backslashit(&quot;a943bc&quot;));
-        }
-
-        function test_double_backslashes_leading_numbers() {
-                $this-&gt;assertEquals(&quot;\\\\95&quot;, backslashit(&quot;95&quot;));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestUntrailingslashit extends WP_UnitTestCase {
-        function test_removes_trailing_slashes() {
-                $this-&gt;assertEquals(&quot;a&quot;, untrailingslashit(&quot;a/&quot;));
-                $this-&gt;assertEquals(&quot;a&quot;, untrailingslashit(&quot;a////&quot;));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestTrailingslashit extends WP_UnitTestCase {
-        function test_adds_trailing_slash() {
-                $this-&gt;assertEquals(&quot;a/&quot;, trailingslashit(&quot;a&quot;));
-        }
-
-        function test_does_not_add_trailing_slash_if_one_exists() {
-                $this-&gt;assertEquals(&quot;a/&quot;, trailingslashit(&quot;a/&quot;));
-        }
-}
-
-/**
- * The clean_pre() removes pararaph and line break
- * tags within `&lt;pre&gt;` elements as part of wpautop().
- *
- * @group formatting
- */
-class TestCleanPre extends WP_UnitTestCase {
-        function test_removes_self_closing_br_with_space() {
-                $source = 'a b c\n&lt;br /&gt;sldfj&lt;br /&gt;';
-                $res = 'a b c\nsldfj';
-
-                $this-&gt;assertEquals($res, clean_pre($source));
-        }
-
-        function test_removes_self_closing_br_without_space() {
-                $source = 'a b c\n&lt;br/&gt;sldfj&lt;br/&gt;';
-                $res = 'a b c\nsldfj';
-                $this-&gt;assertEquals($res, clean_pre($source));
-        }
-
-        // I don't think this can ever happen in production;
-        // &lt;br&gt; is changed to &lt;br /&gt; elsewhere. Left in because
-        // that replacement shouldn't happen (what if you want
-        // HTML 4 output?).
-        function test_removes_html_br() {
-                $source = 'a b c\n&lt;br&gt;sldfj&lt;br&gt;';
-                $res = 'a b c\nsldfj';
-                $this-&gt;assertEquals($res, clean_pre($source));
-        }
-
-        function test_removes_p() {
-                $source = &quot;&lt;p&gt;isn't this exciting!&lt;/p&gt;&lt;p&gt;oh indeed!&lt;/p&gt;&quot;;
-                $res = &quot;\nisn't this exciting!\noh indeed!&quot;;
-                $this-&gt;assertEquals($res, clean_pre($source));
-        }
-}
-
-/**
- * @group formatting
- */
-class TestSmilies extends WP_UnitTestCase {
-
-        function test_convert_smilies() {
-                global $wpsmiliestrans;
-                $includes_path = includes_url(&quot;images/smilies/&quot;);
-
-                // standard smilies, use_smilies: ON
-                update_option( 'use_smilies', 1 );
-
-                smilies_init();
-
-                $inputs = array(
-                                                'Lorem ipsum dolor sit amet mauris ;-) Praesent gravida sodales. :lol: Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, :eek: mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, :mrgreen: tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus :?:',
-                                                '&lt;strong&gt;Welcome to the jungle!&lt;/strong&gt; We got fun n games! :) We got everything you want 8-) &lt;em&gt;Honey we know the names :)&lt;/em&gt;',
-                                                &quot;&lt;strong;)&gt;a little bit of this\na little bit:other: of that :D\n:D a little bit of good\nyeah with a little bit of bad8O&quot;,
-                                                '&lt;strong style=&quot;here comes the sun :-D&quot;&gt;and I say it\'s allright:D:D',
-                                                '&lt;!-- Woo-hoo, I\'m a comment, baby! :x &gt; --&gt;',
-                                                ':?:P:?::-x:mrgreen:::', /*
-                                                'the question is, &lt;textarea&gt;Should smilies be converted in textareas :?:&lt;/textarea&gt;',
-                                                'the question is, &lt;code&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
-                                                'the question is, &lt;code style=&quot;color:#fff&quot;&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
-                                                'the question is, &lt;code&gt;Should smilies be converted in invalid code or pre tags :?:&lt;/pre&gt;',
-                                                '&lt;Am I greedy?&gt;Yes I am :)&gt; :) The world makes me :mad:' */
-                                                );
-
-                $outputs = array(
-                                                'Lorem ipsum dolor sit amet mauris &lt;img src=\''.$includes_path.'icon_wink.gif\' alt=\';-)\' class=\'wp-smiley\' /&gt;  Praesent gravida sodales. &lt;img src=\''.$includes_path.'icon_lol.gif\' alt=\':lol:\' class=\'wp-smiley\' /&gt;  Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, &lt;img src=\''.$includes_path.'icon_surprised.gif\' alt=\':eek:\' class=\'wp-smiley\' /&gt;  mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, &lt;img src=\''.$includes_path.'icon_mrgreen.gif\' alt=\':mrgreen:\' class=\'wp-smiley\' /&gt;  tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus &lt;img src=\''.$i
 ncludes_path.'icon_question.gif\' alt=\':?:\' class=\'wp-smiley\' /&gt; ',
-                                                '&lt;strong&gt;Welcome to the jungle!&lt;/strong&gt; We got fun n games! &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt;  We got everything you want &lt;img src=\''.$includes_path.'icon_cool.gif\' alt=\'8-)\' class=\'wp-smiley\' /&gt; &lt;em&gt;Honey we know the names &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt; &lt;/em&gt;',
-                                                &quot;&lt;strong;)&gt;a little bit of this\na little bit:other: of that &lt;img src='{$includes_path}icon_biggrin.gif' alt=':D' class='wp-smiley' /&gt;  &lt;img src='{$includes_path}icon_biggrin.gif' alt=':D' class='wp-smiley' /&gt;  a little bit of good\nyeah with a little bit of bad8O&quot;,
-                                                '&lt;strong style=&quot;here comes the sun :-D&quot;&gt;and I say it\'s allright:D:D',
-                                                '&lt;!-- Woo-hoo, I\'m a comment, baby! :x &gt; --&gt;',
-                                                ' &lt;img src=\''.$includes_path.'icon_question.gif\' alt=\':?:\' class=\'wp-smiley\' /&gt; P:?::-x:mrgreen:::', /*
-                                                'the question is, &lt;textarea&gt;Should smilies be converted in textareas :?:&lt;/textarea&gt;',
-                                                'the question is, &lt;code&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
-                                                'the question is, &lt;code style=&quot;color:#fff&quot;&gt;Should smilies be converted in code or pre tags :?:&lt;/code&gt;',
-                                                'the question is, &lt;code&gt;Should smilies be converted in invalid code or pre tags :?:&lt;/pre&gt;',
-                                                '&lt;Am I greedy?&gt;Yes I am &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt; &gt; &lt;img src=\''.$includes_path.'icon_smile.gif\' alt=\':)\' class=\'wp-smiley\' /&gt;  The world makes me &lt;img src=\'http://wp-test.php/wp-includes/images/smilies/icon_mad.gif\' alt=\':mad:\' class=\'wp-smiley\' /&gt;' */
-                                                );
-
-                foreach ( $inputs as $k =&gt; $input ) {
-                        $this-&gt;assertEquals( $outputs[$k], convert_smilies($input) );
-                }
-
-                update_option( 'use_smilies', 0 );
-
-                // standard smilies, use_smilies: OFF
-
-                foreach ( $inputs as $input ) {
-                        $this-&gt;assertEquals( $input, convert_smilies($input) );
-                }
-
-                return;
-
-                // custom smilies, use_smilies: ON
-                update_option( 'use_smilies', 1 );
-                $wpsmiliestrans = array(
-                  ':PP' =&gt; 'icon_tongue.gif',
-                  ':arrow:' =&gt; 'icon_arrow.gif',
-                  ':monkey:' =&gt; 'icon_shock_the_monkey.gif',
-                  ':nervou:' =&gt; 'icon_nervou.gif'
-                );
-
-                smilies_init();
-
-                $inputs = array('Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. :monkey:',
-                                                'Star Wars Jedi Knight:arrow: Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. :nervou:',
-                                                ':arrow:monkey:Lorem ipsum dolor sit amet enim. Etiam ullam:PP&lt;br /&gt;corper. Suspendisse a pellentesque dui, non felis.&lt;a&gt;:arrow::arrow&lt;/a&gt;'
-                                                );
-
-                $outputs = array('Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. &lt;img src=\''.$includes_path.'icon_shock_the_monkey.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;',
-                                                'Star Wars Jedi Knight&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt; Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. &lt;img src=\''.$includes_path.'icon_nervou.gif\' alt=\'icon_nervou\' class=\'wp-smiley\' /&gt;',
-                                                '&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;monkey:Lorem ipsum dolor sit amet enim. Etiam ullam&lt;img src=\''.$includes_path.'icon_tongue.gif\' alt=\'icon_tongue\' class=\'wp-smiley\' /&gt;&lt;br /&gt;corper. Suspendisse a pellentesque dui, non felis.&lt;a&gt;&lt;img src=\''.$includes_path.'icon_arrow.gif\' alt=\'icon_arrow\' class=\'wp-smiley\' /&gt;:arrow&lt;/a&gt;'
-                                                );
-
-                foreach ( $inputs as $k =&gt; $input ) {
-                        $this-&gt;assertEquals( $outputs[$k], convert_smilies($input) );
-                }
-        }
-}
-
-/**
- * @group formatting
- */
-class TestWPTrimWords extends WP_UnitTestCase {
-        private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit mollis viverra. Pellentesque id urna euismod dolor cursus sagittis.';
-
-        function test_trims_to_55_by_default() {
-                $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit&amp;hellip;';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text ) );
-        }
-
-        function test_trims_to_10() {
-                $trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius&amp;hellip;';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text, 10 ) );
-        }
-
-        function test_trims_to_5_and_uses_custom_more() {
-                $trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $this-&gt;long_text, 5, '[...] Read on!' ) );
-        }
-
-        function test_strips_tags_before_trimming() {
-                $text = 'This text contains a &lt;a href=&quot;http://wordpress.org&quot;&gt; link &lt;/a&gt; to WordPress.org!';
-                $trimmed = 'This text contains a link&amp;hellip;';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text, 5 ) );
-        }
-
-        // #18726
-        function test_strips_script_and_style_content() {
-                $trimmed = 'This text contains. It should go.';
-
-                $text = 'This text contains&lt;script&gt;alert(&quot; Javascript&quot;);&lt;/script&gt;. It should go.';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text ) );
-
-                $text = 'This text contains&lt;style&gt;#css { width:expression(alert(&quot;css&quot;)) }&lt;/style&gt;. It should go.';
-                $this-&gt;assertEquals( $trimmed, wp_trim_words( $text ) );
-        }
-
-        function test_doesnt_trim_short_text() {
-                $text = 'This is some short text.';
-                $this-&gt;assertEquals( $text, wp_trim_words( $text ) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestRemoveAccents extends WP_UnitTestCase {
-        public function test_remove_accents_simple() {
-                $this-&gt;assertEquals( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
-        }
-
-        /**
-         * @ticket 9591
-         */
-        public function test_remove_accents_latin1_supplement() {
-                $input = 'ªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ';
-                $output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy';
-
-                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
-        }
-
-        public function test_remove_accents_latin_extended_a() {
-                $input = 'ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
-                $output = 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkkLlLlLlLlLlNnNnNnNnNOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
-
-                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
-        }
-
-        public function test_remove_accents_latin_extended_b() {
-                $this-&gt;assertEquals( 'SsTt', remove_accents( 'ȘșȚț' ), 'remove_accents replaces Latin Extended B' );
-        }
-
-        public function test_remove_accents_euro_pound_signs() {
-                $this-&gt;assertEquals( 'E', remove_accents( '€' ), 'remove_accents replaces euro sign' );
-                $this-&gt;assertEquals( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
-        }
-
-        public function test_remove_accents_iso8859() {
-                // File is Latin1 encoded
-                $file = DIR_TESTDATA . DIRECTORY_SEPARATOR . 'formatting' . DIRECTORY_SEPARATOR . 'remove_accents.01.input.txt';
-                $input = file_get_contents( $file );
-                $input = trim( $input );
-                $output = &quot;EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyyOEoeAEDHTHssaedhth&quot;;
-
-                $this-&gt;assertEquals( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
-        }
-
-        /**
-         * @ticket 17738
-         */
-        public function test_remove_accents_vowels_diacritic() {
-                // Vowels with diacritic
-                // unmarked
-                $this-&gt;assertEquals( 'OoUu', remove_accents( 'ƠơƯư' ) );
-                // grave accent
-                $this-&gt;assertEquals( 'AaAaEeOoOoUuYy', remove_accents( 'ẦầẰằỀềỒồỜờỪừỲỳ' ) );
-                // hook
-                $this-&gt;assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẢảẨẩẲẳẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ' ) );
-                // tilde
-                $this-&gt;assertEquals( 'AaAaEeEeOoOoUuYy', remove_accents( 'ẪẫẴẵẼẽỄễỖỗỠỡỮữỸỹ' ) );
-                // acute accent
-                $this-&gt;assertEquals( 'AaAaEeOoOoUu', remove_accents( 'ẤấẮắẾếỐốỚớỨứ' ) );
-                // dot below
-                $this-&gt;assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẠạẬậẶặẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ' ) );
-        }
-
-        /**
-         * @ticket 20772
-         */
-        public function test_remove_accents_hanyu_pinyin() {
-                // Vowels with diacritic (Chinese, Hanyu Pinyin)
-                // macron
-                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'āēīōūǖĀĒĪŌŪǕ' ) );
-                // acute accent
-                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'áéíóúǘÁÉÍÓÚǗ' ) );
-                // caron
-                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'ǎěǐǒǔǚǍĚǏǑǓǙ' ) );
-                // grave accent
-                $this-&gt;assertEquals( 'aeiouuAEIOUU', remove_accents( 'àèìòùǜÀÈÌÒÙǛ' ) );
-                // unmarked
-                $this-&gt;assertEquals( 'aaeiouuAEIOUU', remove_accents( 'aɑeiouüAEIOUÜ' ) );
-        }
-}
-
-/**
- * @group formatting
- */
-class TestStripSlashesDeep extends WP_UnitTestCase {
-        /**
-         * @ticket 18026
-         */
-        function test_preserves_original_datatype() {
-
-                $this-&gt;assertEquals( true, stripslashes_deep( true ) );
-                $this-&gt;assertEquals( false, stripslashes_deep( false ) );
-                $this-&gt;assertEquals( 4, stripslashes_deep( 4 ) );
-                $this-&gt;assertEquals( 'foo', stripslashes_deep( 'foo' ) );
-                $arr = array( 'a' =&gt; true, 'b' =&gt; false, 'c' =&gt; 4, 'd' =&gt; 'foo' );
-                $arr['e'] = $arr; // Add a sub-array
-                $this-&gt;assertEquals( $arr, stripslashes_deep( $arr ) ); // Keyed array
-                $this-&gt;assertEquals( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed
-
-                $obj = new stdClass;
-                foreach ( $arr as $k =&gt; $v )
-                        $obj-&gt;$k = $v;
-                $this-&gt;assertEquals( $obj, stripslashes_deep( $obj ) );
-        }
-
-        function test_strips_slashes() {
-                $old = &quot;I can\'t see, isn\'t that it?&quot;;
-                $new = &quot;I can't see, isn't that it?&quot;;
-                $this-&gt;assertEquals( $new, stripslashes_deep( $old ) );
-                $this-&gt;assertEquals( $new, stripslashes_deep( &quot;I can\\'t see, isn\\'t that it?&quot; ) );
-                $this-&gt;assertEquals( array( 'a' =&gt; $new ), stripslashes_deep( array( 'a' =&gt; $old ) ) ); // Keyed array
-                $this-&gt;assertEquals( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed
-
-                $obj_old = new stdClass;
-                $obj_old-&gt;a = $old;
-                $obj_new = new stdClass;
-                $obj_new-&gt;a = $new;
-                $this-&gt;assertEquals( $obj_new, stripslashes_deep( $obj_old ) );
-        }
-
-        function test_permits_escaped_slash() {
-                $txt = &quot;I can't see, isn\'t that it?&quot;;
-                $this-&gt;assertEquals( $txt, stripslashes_deep( &quot;I can\'t see, isn\\\'t that it?&quot; ) );
-                $this-&gt;assertEquals( $txt, stripslashes_deep( &quot;I can\'t see, isn\\\\\'t that it?&quot; ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_functionsphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_functions.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_functions.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_functions.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,477 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group functions.php
- */
-class TestFunctions extends WP_UnitTestCase {
-        function test_wp_parse_args_object() {
-                $x = new MockClass;
-                $x-&gt;_baba = 5;
-                $x-&gt;yZ = &quot;baba&quot;;
-                $x-&gt;a = array(5, 111, 'x');
-                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x));
-                $y = new MockClass;
-                $this-&gt;assertEquals(array(), wp_parse_args($y));
-        }
-        function test_wp_parse_args_array()  {
-                // arrays
-                $a = array();
-                $this-&gt;assertEquals(array(), wp_parse_args($a));
-                $b = array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x'));
-                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($b));
-        }
-        function test_wp_parse_args_defaults() {
-                $x = new MockClass;
-                $x-&gt;_baba = 5;
-                $x-&gt;yZ = &quot;baba&quot;;
-                $x-&gt;a = array(5, 111, 'x');
-                $d = array('pu' =&gt; 'bu');
-                $this-&gt;assertEquals(array('pu' =&gt; 'bu', '_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x, $d));
-                $e = array('_baba' =&gt; 6);
-                $this-&gt;assertEquals(array('_baba' =&gt; 5, 'yZ' =&gt; 'baba', 'a' =&gt; array(5, 111, 'x')), wp_parse_args($x, $e));
-        }
-        function test_wp_parse_args_other() {
-                $b = true;
-                wp_parse_str($b, $s);
-                $this-&gt;assertEquals($s, wp_parse_args($b));
-                $q = 'x=5&amp;_baba=dudu&amp;';
-                wp_parse_str($q, $ss);
-                $this-&gt;assertEquals($ss, wp_parse_args($q));
-        }
-        function test_size_format() {
-                $kb = 1024;
-                $mb = $kb*1024;
-                $gb = $mb*1024;
-                $tb = $gb*1024;
-                // test if boundaries are correct
-                $this-&gt;assertEquals('1 GB', size_format($gb, 0));
-                $this-&gt;assertEquals('1 MB', size_format($mb, 0));
-                $this-&gt;assertEquals('1 kB', size_format($kb, 0));
-                // now some values around
-                // add some bytes to make sure the result isn't 1.4999999
-                $this-&gt;assertEquals('1.5 TB', size_format($tb + $tb/2 + $mb, 1));
-                $this-&gt;assertEquals('1,023.999 GB', size_format($tb-$mb-$kb, 3));
-                // edge
-                $this-&gt;assertFalse(size_format(-1));
-                $this-&gt;assertFalse(size_format(0));
-                $this-&gt;assertFalse(size_format('baba'));
-                $this-&gt;assertFalse(size_format(array()));
-        }
-
-        function test_path_is_absolute() {
-                if ( !is_callable('path_is_absolute') )
-                        $this-&gt;markTestSkipped();
-
-                $absolute_paths = array(
-                        '/',
-                        '/foo/',
-                        '/foo',
-                        '/FOO/bar',
-                        '/foo/bar/',
-                        '/foo/../bar/',
-                        '\\WINDOWS',
-                        'C:\\',
-                        'C:\\WINDOWS',
-                        '\\\\sambashare\\foo',
-                        );
-                foreach ($absolute_paths as $path)
-                        $this-&gt;assertTrue( path_is_absolute($path), &quot;path_is_absolute('$path') should return true&quot; );
-        }
-
-        function test_path_is_not_absolute() {
-                if ( !is_callable('path_is_absolute') )
-                        $this-&gt;markTestSkipped();
-
-                $relative_paths = array(
-                        '',
-                        '.',
-                        '..',
-                        '../foo',
-                        '../',
-                        '../foo.bar',
-                        'foo/bar',
-                        'foo',
-                        'FOO',
-                        '..\\WINDOWS',
-                        );
-                foreach ($relative_paths as $path)
-                        $this-&gt;assertFalse( path_is_absolute($path), &quot;path_is_absolute('$path') should return false&quot; );
-        }
-
-
-        function test_wp_unique_filename() {
-                /* this test requires:
-                   - that you have dir + file 'data/images/test-image.png',
-                   - and that this dir is writeable
-                   - there is an image 'test-image.png' that will be used to test unique filenames
-
-                   NB: there is a hardcoded dependency that the testing file is '.png'; however,
-                       this limitation is arbitary, so change it if you like.
-                */
-                $testdir = DIR_TESTDATA . '/images/';
-                $testimg = 'test-image.png';
-                $this-&gt;assertTrue( file_exists($testdir) );
-                $this-&gt;assertTrue( is_writable($testdir) );
-                $this-&gt;assertTrue( file_exists($testdir . $testimg) );
-
-                $cases = array(
-                        // null case
-                        'null' . $testimg,
-
-                        // edge cases: '.png', 'abc.', 'abc', 'abc0', 'abc1', 'abc0.png', 'abc1.png' (num @ end)
-                        '.png',
-                        'abc',
-                        'abc.',
-                        'abc0',
-                        'abc1',
-                        'abc0.png',
-                        'abc1.png',
-
-                        // replacing # with _
-                        str_replace('-', '#', $testimg), // test#image.png
-                        str_replace('-', '##', $testimg), // test##image.png
-                        str_replace(array('-', 'e'), '#', $testimg), // t#st#imag#.png
-                        str_replace(array('-', 'e'), '##', $testimg), // t##st##imag##.png
-
-                        // replacing \ or ' with nothing
-                        str_replace('-', '\\', $testimg), // test\image.png
-                        str_replace('-', '\\\\', $testimg), // test\\image.png
-                        str_replace(array('-', 'e'), '\\', $testimg), // t\st\imag\.png
-                        str_replace(array('-', 'e'), '\\\\', $testimg), // t\\st\\imag\\.png
-                        str_replace('-', &quot;'&quot;, $testimg), // test'image.png
-                        str_replace('-', &quot;'&quot;, $testimg), // test''image.png
-                        str_replace(array('-', 'e'), &quot;'&quot;, $testimg), // t'st'imag'.png
-                        str_replace(array('-', 'e'), &quot;''&quot;, $testimg), // t''st''imag''.png
-                        str_replace('-', &quot;\'&quot;, $testimg), // test\'image.png
-                        str_replace('-', &quot;\'\'&quot;, $testimg), // test\'\'image.png
-                        str_replace(array('-', 'e'), &quot;\'&quot;, $testimg), // t\'st\'imag\'.png
-                        str_replace(array('-', 'e'), &quot;\'\'&quot;, $testimg), // t\'\'st\'\'imag\'\'.png
-
-                        'test' . str_replace('e', 'é', $testimg), // testtést-imagé.png
-
-                        '12%af34567890~!@#$..%^&amp;*()|_+qwerty  fgh`jkl zx&lt;&gt;?:&quot;{}[]=&quot;\'/?.png', // kitchen sink
-                        $testdir.'test-image-with-path.png',
-                );
-
-                // what we expect the replacements will do
-                $expected = array(
-                                'null' . $testimg,
-
-                                'png',
-                                'abc',
-                                'abc',
-                                'abc0',
-                                'abc1',
-                                'abc0.png',
-                                'abc1.png',
-
-                                'testimage.png',
-                                'testimage.png',
-                                'tstimag.png',
-                                'tstimag.png',
-
-                                'testimage.png',
-                                'testimage.png',
-                                'tstimag.png',
-                                'tstimag.png',
-                                'testimage.png',
-                                'testimage.png',
-                                'tstimag.png',
-                                'tstimag.png',
-                                'testimage.png',
-                                'testimage.png',
-                                'tstimag.png',
-                                'tstimag.png',
-
-                                'testtést-imagé.png',
-
-                                '12%af34567890@..%^_+qwerty-fghjkl-zx.png',
-                                str_replace( array( '\\', '/', ':' ), '', $testdir ).'test-image-with-path.png',
-                        );
-
-                foreach ($cases as $key =&gt; $case) {
-                        // make sure expected file doesn't exist already
-                        // happens when tests fail and the unlinking doesn't happen
-                        if( $expected[$key] !== $testimg &amp;&amp; file_exists($testdir . $expected[$key]) )
-                                unlink($testdir . $expected[$key]);
-
-                        // -- TEST 1: the replacement is as expected
-                        $this-&gt;assertEquals( $expected[$key], wp_unique_filename($testdir, $case, NULL), $case );
-                        // -- end TEST 1
-
-                        // -- TEST 2: the renaming will produce a unique name
-                        // create the expected file
-                        copy($testdir . $testimg, $testdir . $expected[$key]);
-                        // test that wp_unique_filename actually returns a unique filename
-                        $this-&gt;assertFileNotExists( $testdir . wp_unique_filename($testdir, $case, NULL) );
-                        // -- end TEST 2
-
-                        // cleanup
-                        if( $expected[$key] !== $testimg &amp;&amp;  file_exists($testdir . $expected[$key]) )
-                                unlink($testdir . $expected[$key]);
-                }
-        }
-
-        /**
-         * @ticket 9930
-         */
-        function test_is_serialized() {
-                $cases = array(
-                        serialize(null),
-                        serialize(true),
-                        serialize(false),
-                        serialize(-25),
-                        serialize(25),
-                        serialize(1.1),
-                        serialize(2.1E+200),
-                        serialize('this string will be serialized'),
-                        serialize(&quot;a\nb&quot;),
-                        serialize(array()),
-                        serialize(array(1,1,2,3,5,8,13)),
-                        serialize( (object)array('test' =&gt; true, '3', 4) )
-                );
-                foreach ( $cases as $case )
-                        $this-&gt;assertTrue( is_serialized($case), &quot;Serialized data: $case&quot; );
-
-                $not_serialized = array(
-                        'a string',
-                        'garbage:a:0:garbage;',
-                        'b:4;',
-                        's:4:test;'
-                );
-                foreach ( $not_serialized as $case )
-                        $this-&gt;assertFalse( is_serialized($case), &quot;Test data: $case&quot; );
-        }
-
-}
-
-/**
- * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck().
- *
- * @group functions.php
- */
-class TestListFilter extends WP_UnitTestCase {
-        var $object_list = array();
-        var $array_list = array();
-
-        function setUp() {
-                $this-&gt;array_list['foo'] = array( 'name' =&gt; 'foo', 'field1' =&gt; true, 'field2' =&gt; true, 'field3' =&gt; true, 'field4' =&gt; array( 'red' ) );
-                $this-&gt;array_list['bar'] = array( 'name' =&gt; 'bar', 'field1' =&gt; true, 'field2' =&gt; true, 'field3' =&gt; false, 'field4' =&gt; array( 'green' ) );
-                $this-&gt;array_list['baz'] = array( 'name' =&gt; 'baz', 'field1' =&gt; true, 'field2' =&gt; false, 'field3' =&gt; false, 'field4' =&gt; array( 'blue' ) );
-                foreach ( $this-&gt;array_list as $key =&gt; $value ) {
-                        $this-&gt;object_list[ $key ] = (object) $value;
-                }
-        }
-
-        function test_filter_object_list_and() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'AND' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'foo', $list );
-                $this-&gt;assertArrayHasKey( 'bar', $list );
-        }
-
-        function test_filter_object_list_or() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'OR' );
-                $this-&gt;assertEquals( 3, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'foo', $list );
-                $this-&gt;assertArrayHasKey( 'bar', $list );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-        function test_filter_object_list_not() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'NOT' );
-                $this-&gt;assertEquals( 1, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-        function test_filter_object_list_and_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field1' =&gt; true, 'field2' =&gt; true ), 'AND', 'name' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar' ) , $list );
-        }
-
-        function test_filter_object_list_or_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'OR', 'name' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar' ) , $list );
-        }
-
-        function test_filter_object_list_not_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field2' =&gt; true, 'field3' =&gt; true ), 'NOT', 'name' );
-                $this-&gt;assertEquals( 1, count( $list ) );
-                $this-&gt;assertEquals( array( 'baz' =&gt; 'baz' ) , $list );
-        }
-
-        function test_wp_list_pluck() {
-                $list = wp_list_pluck( $this-&gt;object_list, 'name' );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar', 'baz' =&gt; 'baz' ) , $list );
-
-                $list = wp_list_pluck( $this-&gt;array_list, 'name' );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'bar' =&gt; 'bar', 'baz' =&gt; 'baz' ) , $list );
-        }
-
-        function test_filter_object_list_nested_array_and() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'AND' );
-                $this-&gt;assertEquals( 1, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-        function test_filter_object_list_nested_array_not() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'red' ) ), 'NOT' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'bar', $list );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-        function test_filter_object_list_nested_array_or() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field3' =&gt; true, 'field4' =&gt; array( 'blue' ) ), 'OR' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'foo', $list );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-        function test_filter_object_list_nested_array_or_singular() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'OR' );
-                $this-&gt;assertEquals( 1, count( $list ) );
-                $this-&gt;assertArrayHasKey( 'baz', $list );
-        }
-
-
-        function test_filter_object_list_nested_array_and_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'blue' ) ), 'AND', 'name' );
-                $this-&gt;assertEquals( 1, count( $list ) );
-                $this-&gt;assertEquals( array( 'baz' =&gt; 'baz' ) , $list );
-        }
-
-        function test_filter_object_list_nested_array_not_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field4' =&gt; array( 'green' ) ), 'NOT', 'name' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'baz' =&gt; 'baz' ), $list );
-        }
-
-        function test_filter_object_list_nested_array_or_field() {
-                $list = wp_filter_object_list( $this-&gt;object_list, array( 'field3' =&gt; true, 'field4' =&gt; array( 'blue' ) ), 'OR', 'name' );
-                $this-&gt;assertEquals( 2, count( $list ) );
-                $this-&gt;assertEquals( array( 'foo' =&gt; 'foo', 'baz' =&gt; 'baz' ), $list );
-        }
-}
-
-/**
- * @group http
- */
-class TestHTTPFunctions extends WP_UnitTestCase {
-        function test_head_request() {
-                // this url give a direct 200 response
-                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
-                $response = wp_remote_head( $url );
-                $headers = wp_remote_retrieve_headers( $response );
-
-                $this-&gt;assertTrue( is_array( $headers ) );
-                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
-                $this-&gt;assertEquals( '40148', $headers['content-length'] );
-                $this-&gt;assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
-        }
-
-        function test_head_redirect() {
-                // this url will 301 redirect
-                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
-                $response = wp_remote_head( $url );
-                $this-&gt;assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
-        }
-
-        function test_head_404() {
-                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
-                $response = wp_remote_head( $url );
-
-                $this-&gt;assertTrue( is_array($response) );
-                $this-&gt;assertEquals( '404', wp_remote_retrieve_response_code( $response ) );
-        }
-
-        function test_get_request() {
-                $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
-                $file = tempnam('/tmp', 'testfile');
-
-                $headers = wp_get_http($url, $file);
-
-                // should return the same headers as a head request
-                $this-&gt;assertTrue( is_array($headers) );
-                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
-                $this-&gt;assertEquals( '40148', $headers['content-length'] );
-                $this-&gt;assertEquals( '200', $headers['response'] );
-
-                // make sure the file is ok
-                $this-&gt;assertEquals( 40148, filesize($file) );
-                $this-&gt;assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
-        }
-
-        function test_get_redirect() {
-                // this will redirect to asdftestblog1.files.wordpress.com
-                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
-                $file = tempnam('/tmp', 'testfile');
-
-                $headers = wp_get_http($url, $file);
-
-                // should return the same headers as a head request
-                $this-&gt;assertTrue( is_array($headers) );
-                $this-&gt;assertEquals( 'image/jpeg', $headers['content-type'] );
-                $this-&gt;assertEquals( '40148', $headers['content-length'] );
-                $this-&gt;assertEquals( '200', $headers['response'] );
-
-                // make sure the file is ok
-                $this-&gt;assertEquals( 40148, filesize($file) );
-                $this-&gt;assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
-        }
-
-        function test_get_redirect_limit_exceeded() {
-                // this will redirect to asdftestblog1.files.wordpress.com
-                $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
-                $file = tempnam('/tmp', 'testfile');
-                // pretend we've already redirected 5 times
-                $headers = wp_get_http( $url, $file, 6 );
-                $this-&gt;assertFalse( $headers );
-        }
-}
-
-/**
- * @group themes
- * @group plugins
- */
-class Test_WP_File_Headers extends WP_UnitTestCase {
-        function test_get_file_data() {
-                $theme_headers = array(
-                        'Name' =&gt; 'Theme Name',
-                        'ThemeURI' =&gt; 'Theme URI',
-                        'Description' =&gt; 'Description',
-                        'Version' =&gt; 'Version',
-                        'Author' =&gt; 'Author',
-                        'AuthorURI' =&gt; 'Author URI',
-                );
-
-                $actual = get_file_data( DIR_TESTDATA . '/themedir1/default/style.css', $theme_headers );
-
-                $expected = array(
-                        'Name' =&gt; 'WordPress Default',
-                        'ThemeURI' =&gt; 'http://wordpress.org/',
-                        'Description' =&gt; 'The default WordPress theme based on the famous &lt;a href=&quot;http://binarybonsai.com/kubrick/&quot;&gt;Kubrick&lt;/a&gt;.',
-                        'Version' =&gt; '1.6',
-                        'Author' =&gt; 'Michael Heilemann',
-                        'AuthorURI' =&gt; 'http://binarybonsai.com/',
-                );
-
-                foreach ( $actual as $header =&gt; $value )
-                        $this-&gt;assertEquals( $expected[ $header ], $value, $header );
-        }
-
-        function test_get_file_data_cr_line_endings() {
-                $headers = array( 'SomeHeader' =&gt; 'Some Header', 'Description' =&gt; 'Description', 'Author' =&gt; 'Author' );
-                $actual = get_file_data( DIR_TESTDATA . '/formatting/cr-line-endings-file-header.php', $headers );
-                $expected = array(
-                        'SomeHeader' =&gt; 'Some header value!',
-                        'Description' =&gt; 'This file is using CR line endings for a testcase.',
-                        'Author' =&gt; 'A Very Old Mac',
-                );
-
-                foreach ( $actual as $header =&gt; $value )
-                        $this-&gt;assertEquals( $expected[ $header ], $value, $header );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_pluggablephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_pluggable.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_pluggable.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_pluggable.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,271 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group pluggable
- */
-class TestAuthFunctions extends WP_UnitTestCase {
-        var $user_id;
-
-        function setUp() {
-                parent::setUp();
-                $this-&gt;user_id = $this-&gt;factory-&gt;user-&gt;create();
-        }
-
-        function test_auth_cookie_valid() {
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
-                $this-&gt;assertEquals( $this-&gt;user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
-        }
-
-        function test_auth_cookie_invalid() {
-                // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
-                // as an ajax test may have defined DOING_AJAX, failing the test.
-
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() - 7200, 'auth' );
-                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' );
-
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
-                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' );
-
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'auth' );
-                list($a, $b, $c) = explode('|', $cookie);
-                $cookie = $a . '|' . ($b + 1) . '|' . $c;
-                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $this-&gt;user_id, 'auth' ), 'altered cookie' );
-        }
-
-        function test_auth_cookie_scheme() {
-                // arbitrary scheme name
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'foo' );
-                $this-&gt;assertEquals( $this-&gt;user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );
-
-                // wrong scheme name - should fail
-                $cookie = wp_generate_auth_cookie( $this-&gt;user_id, time() + 3600, 'foo' );
-                $this-&gt;assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
-        }
-}
-
-/**
- * @group pluggable
- * @group mail
- * @ticket UT47
- */
-class TestMailFunctions extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-        }
-
-        function test_wp_mail_custom_boundaries() {
-                $to = 'user@example.com';
-                $subject = 'Test email with custom boundaries';
-                $headers  = '' . &quot;\n&quot;;
-                $headers .= 'MIME-Version: 1.0' . &quot;\n&quot;;
-                $headers .= 'Content-Type: multipart/mixed; boundary=&quot;----=_Part_4892_25692638.1192452070893&quot;' . &quot;\n&quot;;
-                $headers .= &quot;\n&quot;;
-                $body  = &quot;\n&quot;;
-                $body .= '------=_Part_4892_25692638.1192452070893' . &quot;\n&quot;;
-                $body .= 'Content-Type: text/plain; charset=ISO-8859-1' . &quot;\n&quot;;
-                $body .= 'Content-Transfer-Encoding: 7bit' . &quot;\n&quot;;
-                $body .= 'Content-Disposition: inline' . &quot;\n&quot;;
-                $body .= &quot;\n&quot;;
-                $body .= 'Here is a message with an attachment of a binary file.' . &quot;\n&quot;;
-                $body .= &quot;\n&quot;;
-                $body .= '------=_Part_4892_25692638.1192452070893' . &quot;\n&quot;;
-                $body .= 'Content-Type: image/x-icon; name=favicon.ico' . &quot;\n&quot;;
-                $body .= 'Content-Transfer-Encoding: base64' . &quot;\n&quot;;
-                $body .= 'Content-Disposition: attachment; filename=favicon.ico' . &quot;\n&quot;;
-                $body .= &quot;\n&quot;;
-                $body .= 'AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
-                $body .= 'AAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA' . &quot;\n&quot;;
-                $body .= '/wD/AP//AAD///8A//3/AP39/wD6/f8A+P3/AP/8/wD9/P8A+vz/AP/7/wD/+v8A/vr/APz6/wD4' . &quot;\n&quot;;
-                $body .= '+v8A+/n/APP5/wD/+P8A+vj/AO/4/wDm+P8A2fj/AP/3/wD/9v8A9vb/AP/1/wD69f8A9PT/AO30' . &quot;\n&quot;;
-                $body .= '/wD/8/8A//L/APnx/wD28P8A///+APj//gD2//4A9P/+AOP//gD//f4A6f/9AP///AD2//wA8//8' . &quot;\n&quot;;
-                $body .= 'APf9/AD///sA/v/7AOD/+wD/+vsA9/X7APr/+gDv/voA///5AP/9+QD/+/kA+e35AP//+ADm//gA' . &quot;\n&quot;;
-                $body .= '4f/4AP/9+AD0+/gA///3APv/9wDz//cA8f/3AO3/9wD/8fcA//32AP369gDr+vYA8f/1AOv/9QD/' . &quot;\n&quot;;
-                $body .= '+/UA///0APP/9ADq//QA///zAP/18wD///IA/fzyAP//8QD///AA9//wAPjw8AD//+8A8//vAP//' . &quot;\n&quot;;
-                $body .= '7gD9/+4A9v/uAP/u7gD//+0A9v/tAP7/6wD/+eoA///pAP//6AD2/+gA//nnAP/45wD38eYA/fbl' . &quot;\n&quot;;
-                $body .= 'AP/25AD29uQA7N/hAPzm4AD/690AEhjdAAAa3AAaJdsA//LXAC8g1gANH9YA+dnTAP/n0gDh5dIA' . &quot;\n&quot;;
-                $body .= 'DyjSABkk0gAdH9EABxDRAP/l0AAAJs4AGRTOAPPczQAAKs0AIi7MAA4UywD56soA8tPKANTSygD/' . &quot;\n&quot;;
-                $body .= '18kA6NLHAAAjxwDj28QA/s7CAP/1wQDw3r8A/9e8APrSrwDCtqoAzamjANmPiQDQj4YA35mBAOme' . &quot;\n&quot;;
-                $body .= 'fgDHj3wA1qR6AO+sbwDpmm8A2IVlAKmEYgCvaFoAvHNXAEq2VgA5s1UAPbhQAFWtTwBStU0ARbNN' . &quot;\n&quot;;
-                $body .= 'AEGxTQA7tEwAObZIAEq5RwDKdEYAULhDANtuQgBEtTwA1ls3ALhgMQCxNzEA2FsvAEC3LQB0MCkA' . &quot;\n&quot;;
-                $body .= 'iyYoANZTJwDLWyYAtjMlALE6JACZNSMAuW4iANlgIgDoWCEAylwgAMUuIAD3Vh8A52gdALRCHQCx' . &quot;\n&quot;;
-                $body .= 'WhwAsEkcALU4HACMOBwA0V4bAMYyGgCPJRoA218ZAJM7FwC/PxYA0msVAM9jFQD2XBUAqioVAIAf' . &quot;\n&quot;;
-                $body .= 'FQDhYRQAujMTAMUxEwCgLBMAnxIPAMsqDgCkFgsA6GMHALE2BAC9JQAAliIAAFYTAAAAAAAAAAAA' . &quot;\n&quot;;
-                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
-                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/' . &quot;\n&quot;;
-                $body .= '//8AsbGxsbGxsbGxsbGxsbGxd7IrMg8PDw8PDw8PUBQeJXjQYE9PcKPM2NfP2sWhcg+BzTE7dLjb' . &quot;\n&quot;;
-                $body .= 'mG03YWaV4JYye8MPbsLZlEouKRRCg9SXMoW/U53enGRAFzCRtNO7mTiAyliw30gRTg9VbJCKfYs0' . &quot;\n&quot;;
-                $body .= 'j9VmuscfLTFbIy8SOhA0Inq5Y77GNBMYIxQUJzM2Vxx2wEmfyCYWMRldXCg5MU0aicRUms58SUVe' . &quot;\n&quot;;
-                $body .= 'RkwjPBRSNIfBMkSgvWkyPxVHFIaMSx1/0S9nkq7WdWo1a43Jt2UqgtJERGJ5m6K8y92znpNWIYS1' . &quot;\n&quot;;
-                $body .= 'UQ89Mmg5cXNaX0EkGyyI3KSsp6mvpaqosaatq7axsQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . &quot;\n&quot;;
-                $body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' . &quot;\n&quot;;
-                $body .= '------=_Part_4892_25692638.1192452070893--' . &quot;\n&quot;;
-                $body .= &quot;\n&quot;;
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail($to, $subject, $body, $headers);
-
-                // We need some better assertions here but these catch the failure for now.
-                $this-&gt;assertEquals($body, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                $this-&gt;assertTrue(strpos($GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], 'boundary=&quot;----=_Part_4892_25692638.1192452070893&quot;') &gt; 0);
-                $this-&gt;assertTrue(strpos($GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], 'charset=&quot;&quot;') &gt; 0);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-
-        /**
-         * @ticket 15448
-         */
-        function test_wp_mail_plain_and_html() {
-
-                $to = 'user@example.com';
-                $subject = 'Test email with plain text and html versions';
-                $messages = array( 'text/plain' =&gt; 'Here is some plain text.',
-                                           'text/html' =&gt;'&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Here is the HTML ;-)&lt;body&gt;&lt;/html&gt;' );
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail( $to, $subject, $messages );
-
-                preg_match( '/boundary=&quot;(.*)&quot;/', $GLOBALS['phpmailer']-&gt;mock_sent[0]['header'], $matches);
-                $boundry = $matches[1];
-                $body = '--' . $boundry . '
-Content-Type: text/plain; charset = &quot;UTF-8&quot;
-Content-Transfer-Encoding: 8bit
-
-Here is some plain text.
-
-
---' . $boundry . '
-Content-Type: text/html; charset = &quot;UTF-8&quot;
-Content-Transfer-Encoding: 8bit
-
-&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Here is the HTML ;-)&lt;body&gt;&lt;/html&gt;
-
-
-
---' . $boundry . '--
-';
-                // We need some better assertions here but these test the behaviour for now.
-                $this-&gt;assertEquals($body, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-
-        /**
-         * @ticket 17305
-         */
-        function test_wp_mail_rfc2822_addresses() {
-
-                $to = &quot;Name &lt;address@tld.com&gt;&quot;;
-                $from = &quot;Another Name &lt;another_address@different-tld.com&gt;&quot;;
-                $cc = &quot;The Carbon Guy &lt;cc@cc.com&gt;&quot;;
-                $bcc = &quot;The Blind Carbon Guy &lt;bcc@bcc.com&gt;&quot;;
-                $subject = &quot;RFC2822 Testing&quot;;
-                $message = &quot;My RFC822 Test Message&quot;;
-                $headers[] = &quot;From: {$from}&quot;;
-                $headers[] = &quot;CC: {$cc}&quot;;
-                $headers[] = &quot;BCC: {$bcc}&quot;;
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail( $to, $subject, $message, $headers );
-
-                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
-                // Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
-                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) ) {
-                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                        $this-&gt;assertEquals('Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][1]);
-                        $this-&gt;assertEquals('cc@cc.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][0]);
-                        $this-&gt;assertEquals('The Carbon Guy', $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][1]);
-                        $this-&gt;assertEquals('bcc@bcc.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][0]);
-                        $this-&gt;assertEquals('The Blind Carbon Guy', $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][1]);
-                } else {
-                        $this-&gt;assertEquals($to, $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                        $this-&gt;assertEquals($cc, $GLOBALS['phpmailer']-&gt;mock_sent[0]['cc'][0][0]);
-                        $this-&gt;assertEquals($bcc, $GLOBALS['phpmailer']-&gt;mock_sent[0]['bcc'][0][0]);
-                }
-
-                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-
-        /**
-         * @ticket 17305
-         */
-        function test_wp_mail_multiple_rfc2822_to_addresses() {
-
-                $to = &quot;Name &lt;address@tld.com&gt;, Another Name &lt;another_address@different-tld.com&gt;&quot;;
-                $subject = &quot;RFC2822 Testing&quot;;
-                $message = &quot;My RFC822 Test Message&quot;;
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail( $to, $subject, $message );
-
-                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
-                // Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
-                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) ) {
-                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                        $this-&gt;assertEquals('Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][1]);
-                        $this-&gt;assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
-                        $this-&gt;assertEquals('Another Name', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][1]);
-                } else {
-                        $this-&gt;assertEquals('Name &lt;address@tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                        $this-&gt;assertEquals('Another Name &lt;another_address@different-tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
-                }
-
-                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-
-        function test_wp_mail_multiple_to_addresses() {
-                $to = &quot;address@tld.com, another_address@different-tld.com&quot;;
-                $subject = &quot;RFC2822 Testing&quot;;
-                $message = &quot;My RFC822 Test Message&quot;;
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail( $to, $subject, $message );
-
-                $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                $this-&gt;assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][1][0]);
-                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-
-        /**
-         * @ticket 18463
-         */
-        function test_wp_mail_to_address_no_name() {
-
-                $to = &quot;&lt;address@tld.com&gt;&quot;;
-                $subject = &quot;RFC2822 Testing&quot;;
-                $message = &quot;My RFC822 Test Message&quot;;
-
-                unset($GLOBALS['phpmailer']-&gt;mock_sent);
-                $_SERVER['SERVER_NAME'] = 'example.com';
-                wp_mail( $to, $subject, $message );
-
-                // Old PHPMailer blindly accepts the address, the new one santizes it
-                if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '&gt;' ) )
-                        $this-&gt;assertEquals('address@tld.com', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                else
-                        $this-&gt;assertEquals('&lt;address@tld.com&gt;', $GLOBALS['phpmailer']-&gt;mock_sent[0]['to'][0][0]);
-                $this-&gt;assertEquals($message . &quot;\n&quot;, $GLOBALS['phpmailer']-&gt;mock_sent[0]['body']);
-                unset( $_SERVER['SERVER_NAME'] );
-        }
-}
-
-/**
- * @group pluggable
- */
-class TestRedirectFunctions extends WP_UnitTestCase {
-        function test_wp_sanitize_redirect() {
-                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0Ago'));
-                $this-&gt;assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo'));
-                //Nesting checks
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo'));
-                $this-&gt;assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_postphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_post.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_post.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_post.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,967 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * test wp-includes/post.php
- *
- * @group post
- */
-class WPTestIncludesPost extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;author_id = $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) );
-                $this-&gt;old_current_user = get_current_user_id();
-                wp_set_current_user( $this-&gt;author_id );
-                _set_cron_array(array());
-                $this-&gt;post_ids = array();
-        }
-
-        function tearDown() {
-                wp_set_current_user( $this-&gt;old_current_user );
-                parent::tearDown();
-        }
-
-        // helper function: return the timestamp(s) of cron jobs for the specified hook and post
-        function _next_schedule_for_post($hook, $id) {
-                return wp_next_scheduled('publish_future_post', array(0=&gt;intval($id)));
-        }
-
-        // test simple valid behavior: insert and get a post
-        function test_vb_insert_get_delete() {
-                register_post_type( 'cpt', array( 'taxonomies' =&gt; array( 'post_tag', 'ctax' ) ) );
-                register_taxonomy( 'ctax', 'cpt' );
-                $post_types = array( 'post', 'cpt' );
-
-                foreach ( $post_types as $post_type ) {
-                        $post = array(
-                                'post_author' =&gt; $this-&gt;author_id,
-                                'post_status' =&gt; 'publish',
-                                'post_content' =&gt; rand_str(),
-                                'post_title' =&gt; rand_str(),
-                                'tax_input' =&gt; array( 'post_tag' =&gt; 'tag1,tag2', 'ctax' =&gt; 'cterm1,cterm2' ),
-                                'post_type' =&gt; $post_type
-                        );
-
-                        // insert a post and make sure the ID is ok
-                        $id = wp_insert_post($post);
-                        $this-&gt;assertTrue(is_numeric($id));
-                        $this-&gt;assertTrue($id &gt; 0);
-
-                        // fetch the post and make sure it matches
-                        $out = wp_get_single_post($id);
-
-                        $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
-                        $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
-                        $this-&gt;assertEquals($post['post_status'], $out-&gt;post_status);
-                        $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
-
-                        // test cache state
-                        $pcache = wp_cache_get( $id, 'posts' );
-                        $this-&gt;assertInstanceOf( 'stdClass', $pcache );
-                        $this-&gt;assertEquals( $id, $pcache-&gt;ID );
-
-                        update_object_term_cache( $id, $post_type );
-                        $tcache = wp_cache_get( $id, &quot;post_tag_relationships&quot; );
-                        $this-&gt;assertInternalType( 'array', $tcache );
-                        $this-&gt;assertEquals( 2, count( $tcache ) );
-
-                        $tcache = wp_cache_get( $id, &quot;ctax_relationships&quot; );
-                        if ( 'cpt' == $post_type ) {
-                                $this-&gt;assertInternalType( 'array', $tcache );
-                                $this-&gt;assertEquals( 2, count( $tcache ) );
-                        } else {
-                                $this-&gt;assertFalse( $tcache );
-                        }
-
-                        wp_delete_post( $id, true );
-                        $this-&gt;assertFalse( wp_cache_get( $id, 'posts' ) );
-                        $this-&gt;assertFalse( wp_cache_get( $id, &quot;post_tag_relationships&quot; ) );
-                        $this-&gt;assertFalse( wp_cache_get( $id, &quot;ctax_relationships&quot; ) );
-                }
-
-                $GLOBALS['wp_taxonomies']['post_tag']-&gt;object_type = array( 'post' );
-        }
-
-        function test_vb_insert_future() {
-                // insert a post with a future date, and make sure the status and cron schedule are correct
-
-                $future_date = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-                #dmp(_get_cron_array());
-                $this-&gt;assertTrue(is_numeric($id));
-                $this-&gt;assertTrue($id &gt; 0);
-
-                // fetch the post and make sure it matches
-                $out = wp_get_single_post($id);
-
-                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
-                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // there should be a publish_future_post hook scheduled on the future date
-                $this-&gt;assertEquals($future_date, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_vb_insert_future_over_dst() {
-                // insert a post with a future date, and make sure the status and cron schedule are correct
-
-                // Some magic days - one dst one not
-                $future_date_1 = strtotime('June 21st +1 year');
-                $future_date_2 = strtotime('Jan 11th +1 year');
-
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                // fetch the post and make sure has the correct date and status
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // check that there's a publish_future_post job scheduled at the right time
-                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                // now save it again with a date further in the future
-
-                $post['ID'] = $id;
-                $post['post_date'] = strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_2);
-                $post['post_date_gmt'] = NULL;
-                wp_update_post($post);
-
-                // fetch the post again and make sure it has the new post_date
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // and the correct date on the cron job
-                $this-&gt;assertEquals($future_date_2, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_vb_insert_future_edit_bug() {
-                // future post bug: posts get published at the wrong time if you edit the timestamp
-                // http://trac.wordpress.org/ticket/4710
-
-                $future_date_1 = strtotime('+1 day');
-                $future_date_2 = strtotime('+2 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                // fetch the post and make sure has the correct date and status
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // check that there's a publish_future_post job scheduled at the right time
-                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                // now save it again with a date further in the future
-
-                $post['ID'] = $id;
-                $post['post_date'] = strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_2);
-                $post['post_date_gmt'] = NULL;
-                wp_update_post($post);
-
-                // fetch the post again and make sure it has the new post_date
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // and the correct date on the cron job
-                $this-&gt;assertEquals($future_date_2, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_vb_insert_future_draft() {
-                // insert a draft post with a future date, and make sure no cron schedule is set
-
-                $future_date = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'draft',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-                #dmp(_get_cron_array());
-                $this-&gt;assertTrue(is_numeric($id));
-                $this-&gt;assertTrue($id &gt; 0);
-
-                // fetch the post and make sure it matches
-                $out = wp_get_single_post($id);
-
-                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
-                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
-                $this-&gt;assertEquals('draft', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // there should be a publish_future_post hook scheduled on the future date
-                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-        }
-
-        function test_vb_insert_future_change_to_draft() {
-                // insert a future post, then edit and change it to draft, and make sure cron gets it right
-                $future_date_1 = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                // fetch the post and make sure has the correct date and status
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // check that there's a publish_future_post job scheduled at the right time
-                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                // now save it again with status set to draft
-
-                $post['ID'] = $id;
-                $post['post_status'] = 'draft';
-                wp_update_post($post);
-
-                // fetch the post again and make sure it has the new post_date
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('draft', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // and the correct date on the cron job
-                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_vb_insert_future_change_status() {
-                // insert a future post, then edit and change the status, and make sure cron gets it right
-                $future_date_1 = strtotime('+1 day');
-
-                $statuses = array('draft', 'static', 'object', 'attachment', 'inherit', 'pending');
-
-                foreach ($statuses as $status) {
-                        $post = array(
-                                'post_author' =&gt; $this-&gt;author_id,
-                                'post_status' =&gt; 'publish',
-                                'post_content' =&gt; rand_str(),
-                                'post_title' =&gt; rand_str(),
-                                'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
-                        );
-
-                        // insert a post and make sure the ID is ok
-                        $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                        // fetch the post and make sure has the correct date and status
-                        $out = wp_get_single_post($id);
-                        $this-&gt;assertEquals('future', $out-&gt;post_status);
-                        $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                        // check that there's a publish_future_post job scheduled at the right time
-                        $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                        // now save it again with status changed
-
-                        $post['ID'] = $id;
-                        $post['post_status'] = $status;
-                        wp_update_post($post);
-
-                        // fetch the post again and make sure it has the new post_date
-                        $out = wp_get_single_post($id);
-                        $this-&gt;assertEquals($status, $out-&gt;post_status);
-                        $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                        // and the correct date on the cron job
-                        $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-                }
-        }
-
-        function test_vb_insert_future_private() {
-                // insert a draft post with a future date, and make sure no cron schedule is set
-
-                $future_date = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'private',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-                #dmp(_get_cron_array());
-                $this-&gt;assertTrue(is_numeric($id));
-                $this-&gt;assertTrue($id &gt; 0);
-
-                // fetch the post and make sure it matches
-                $out = wp_get_single_post($id);
-
-                $this-&gt;assertEquals($post['post_content'], $out-&gt;post_content);
-                $this-&gt;assertEquals($post['post_title'], $out-&gt;post_title);
-                $this-&gt;assertEquals('private', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_author'], $out-&gt;post_author);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // there should be a publish_future_post hook scheduled on the future date
-                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_vb_insert_future_change_to_private() {
-                // insert a future post, then edit and change it to private, and make sure cron gets it right
-                $future_date_1 = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date_1),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                // fetch the post and make sure has the correct date and status
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('future', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // check that there's a publish_future_post job scheduled at the right time
-                $this-&gt;assertEquals($future_date_1, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                // now save it again with status set to draft
-
-                $post['ID'] = $id;
-                $post['post_status'] = 'private';
-                wp_update_post($post);
-
-                // fetch the post again and make sure it has the new post_date
-                $out = wp_get_single_post($id);
-                $this-&gt;assertEquals('private', $out-&gt;post_status);
-                $this-&gt;assertEquals($post['post_date'], $out-&gt;post_date);
-
-                // and the correct date on the cron job
-                $this-&gt;assertEquals(false, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        /**
-         * @ticket 5364
-         */
-        function test_delete_future_post_cron() {
-                // &quot;When I delete a future post using wp_delete_post($post-&gt;ID) it does not update the cron correctly.&quot;
-                $future_date = strtotime('+1 day');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                        'post_date'  =&gt; strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, $future_date),
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                // check that there's a publish_future_post job scheduled at the right time
-                $this-&gt;assertEquals($future_date, $this-&gt;_next_schedule_for_post('publish_future_post', $id));
-
-                // now delete the post and make sure the cron entry is removed
-                wp_delete_post($id);
-
-                $this-&gt;assertFalse($this-&gt;_next_schedule_for_post('publish_future_post', $id));
-        }
-
-        function test_permalink_without_title() {
-                // bug: permalink doesn't work if post title is empty
-                // wpcom #663, also http://trac.wordpress.org/ticket/5305
-
-                global $wp_rewrite;
-                $wp_rewrite-&gt;set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author_id,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; '',
-                        'post_date' =&gt; '2007-10-31 06:15:00',
-                );
-
-                // insert a post and make sure the ID is ok
-                $id = $this-&gt;post_ids[] = wp_insert_post($post);
-
-                $plink = get_permalink($id);
-
-                // permalink should include the post ID at the end
-                $this-&gt;assertEquals(get_option('siteurl').'/2007/10/31/'.$id.'/', $plink);
-
-                $wp_rewrite-&gt;set_permalink_structure('');
-        }
-
-        /**
-         * @ticket 21013
-         */
-        function test_wp_unique_post_slug_with_non_latin_slugs() {
-                $inputs = array(
-                        'Αρνάκι άσπρο και παχύ της μάνας του καμάρι, και άλλα τραγούδια',
-                        'Предлагаем супер металлообрабатывающее оборудование',
-                );
-
-                $outputs = array(
-                        'αρνάκι-άσπρο-και-παχύ-της-μάνας-του-κα-2',
-                        'предлагаем-супер-металлообрабатыва-2',
-                );
-
-                foreach ( $inputs as $k =&gt; $post_title ) {
-                        for ( $i = 0; $i &lt; 2; $i++ ) {
-                                $post = array(
-                                        'post_author' =&gt; $this-&gt;author_id,
-                                        'post_status' =&gt; 'publish',
-                                        'post_content' =&gt; rand_str(),
-                                        'post_title' =&gt; $post_title,
-                                );
-
-                                $id = $this-&gt;post_ids[] = wp_insert_post( $post );
-                        }
-
-                        $post = get_post( $id );
-                        $this-&gt;assertEquals( $outputs[$k], urldecode( $post-&gt;post_name ) );
-                }
-        }
-}
-
-/**
- * @group post
- * @group media
- * @group upload
- */
-class WPTestAttachments extends WP_UnitTestCase {
-
-        function tearDown() {
-                // Remove all uploads.
-                $uploads = wp_upload_dir();
-                foreach ( scandir( $uploads['basedir'] ) as $file )
-                        _rmdir( $uploads['basedir'] . '/' . $file );
-
-                parent::tearDown();
-        }
-
-        function _make_attachment($upload, $parent_post_id=-1) {
-
-                $type = '';
-                if ( !empty($upload['type']) ) {
-                        $type = $upload['type'];
-                } else {
-                        $mime = wp_check_filetype( $upload['file'] );
-                        if ($mime)
-                                $type = $mime['type'];
-                }
-
-                $attachment = array(
-                        'post_title' =&gt; basename( $upload['file'] ),
-                        'post_content' =&gt; '',
-                        'post_type' =&gt; 'attachment',
-                        'post_parent' =&gt; $parent_post_id,
-                        'post_mime_type' =&gt; $type,
-                        'guid' =&gt; $upload[ 'url' ],
-                );
-
-                // Save the data
-                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent_post_id );
-                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
-
-                return $this-&gt;ids[] = $id;
-
-        }
-
-        function test_insert_bogus_image() {
-                $filename = rand_str().'.jpg';
-                $contents = rand_str();
-
-                $upload = wp_upload_bits($filename, null, $contents);
-                $this-&gt;assertTrue( empty($upload['error']) );
-
-                $id = $this-&gt;_make_attachment($upload);
-        }
-
-        function test_insert_image_no_thumb() {
-
-                // this image is smaller than the thumbnail size so it won't have one
-                $filename = ( DIR_TESTDATA.'/images/test-image.jpg' );
-                $contents = file_get_contents($filename);
-
-                $upload = wp_upload_bits(basename($filename), null, $contents);
-                $this-&gt;assertTrue( empty($upload['error']) );
-
-                $id = $this-&gt;_make_attachment($upload);
-
-                // intermediate copies should not exist
-                $this-&gt;assertFalse( image_get_intermediate_size($id, 'thumbnail') );
-                $this-&gt;assertFalse( image_get_intermediate_size($id, 'medium') );
-
-                // medium and full size will both point to the original
-                $downsize = image_downsize($id, 'medium');
-                $this-&gt;assertEquals( 'test-image.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 50, $downsize[1] );
-                $this-&gt;assertEquals( 50, $downsize[2] );
-
-                $downsize = image_downsize($id, 'full');
-                $this-&gt;assertEquals( 'test-image.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 50, $downsize[1] );
-                $this-&gt;assertEquals( 50, $downsize[2] );
-
-        }
-
-        function test_insert_image_thumb_only() {
-                update_option( 'medium_size_w', 0 );
-                update_option( 'medium_size_h', 0 );
-
-                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
-                $contents = file_get_contents($filename);
-
-                $upload = wp_upload_bits(basename($filename), null, $contents);
-                $this-&gt;assertTrue( empty($upload['error']) );
-
-                $id = $this-&gt;_make_attachment($upload);
-
-                // intermediate copies should exist: thumbnail only
-                $thumb = image_get_intermediate_size($id, 'thumbnail');
-                $this-&gt;assertEquals( 'a2-small-150x150.jpg', $thumb['file'] );
-
-                $uploads = wp_upload_dir();
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
-
-                $this-&gt;assertFalse( image_get_intermediate_size($id, 'medium') );
-
-                // the thumb url should point to the thumbnail intermediate
-                $this-&gt;assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
-
-                // image_downsize() should return the correct images and sizes
-                $downsize = image_downsize($id, 'thumbnail');
-                $this-&gt;assertEquals( 'a2-small-150x150.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 150, $downsize[1] );
-                $this-&gt;assertEquals( 150, $downsize[2] );
-
-                // medium and full will both point to the original
-                $downsize = image_downsize($id, 'medium');
-                $this-&gt;assertEquals( 'a2-small.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 400, $downsize[1] );
-                $this-&gt;assertEquals( 300, $downsize[2] );
-
-                $downsize = image_downsize($id, 'full');
-                $this-&gt;assertEquals( 'a2-small.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 400, $downsize[1] );
-                $this-&gt;assertEquals( 300, $downsize[2] );
-
-        }
-
-        function test_insert_image_medium() {
-                update_option('medium_size_w', 400);
-                update_option('medium_size_h', 0);
-
-                $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
-                $contents = file_get_contents($filename);
-
-                $upload = wp_upload_bits(basename($filename), null, $contents);
-                $this-&gt;assertTrue( empty($upload['error']) );
-
-                $id = $this-&gt;_make_attachment($upload);
-                $uploads = wp_upload_dir();
-
-                // intermediate copies should exist: thumbnail and medium
-                $thumb = image_get_intermediate_size($id, 'thumbnail');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
-
-                $medium = image_get_intermediate_size($id, 'medium');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
-
-                // the thumb url should point to the thumbnail intermediate
-                $this-&gt;assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
-
-                // image_downsize() should return the correct images and sizes
-                $downsize = image_downsize($id, 'thumbnail');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 150, $downsize[1] );
-                $this-&gt;assertEquals( 150, $downsize[2] );
-
-                $downsize = image_downsize($id, 'medium');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 400, $downsize[1] );
-                $this-&gt;assertEquals( 602, $downsize[2] );
-
-                $downsize = image_downsize($id, 'full');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) );
-                $this-&gt;assertEquals( 680, $downsize[1] );
-                $this-&gt;assertEquals( 1024, $downsize[2] );
-        }
-
-
-        function test_insert_image_delete() {
-                update_option('medium_size_w', 400);
-                update_option('medium_size_h', 0);
-
-                $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
-                $contents = file_get_contents($filename);
-
-                $upload = wp_upload_bits(basename($filename), null, $contents);
-                $this-&gt;assertTrue( empty($upload['error']) );
-
-                $id = $this-&gt;_make_attachment($upload);
-                $uploads = wp_upload_dir();
-
-                // check that the file and intermediates exist
-                $thumb = image_get_intermediate_size($id, 'thumbnail');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
-
-                $medium = image_get_intermediate_size($id, 'medium');
-                $this-&gt;assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
-
-                $meta = wp_get_attachment_metadata($id);
-                $original = $meta['file'];
-                $this-&gt;assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) );
-
-                // now delete the attachment and make sure all files are gone
-                wp_delete_attachment($id);
-
-                $this-&gt;assertFalse( is_file($thumb['path']) );
-                $this-&gt;assertFalse( is_file($medium['path']) );
-                $this-&gt;assertFalse( is_file($original) );
-        }
-
-}
-
-/**
- * @group post
- * @group meta
- */
-class WPTestPostMeta extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-
-                $this-&gt;author = new WP_User( $this-&gt;factory-&gt;user-&gt;create( array( 'role' =&gt; 'editor' ) ) );
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author-&gt;ID,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                );
-
-                // insert a post
-                $this-&gt;post_id = wp_insert_post($post);
-
-
-                $post = array(
-                        'post_author' =&gt; $this-&gt;author-&gt;ID,
-                        'post_status' =&gt; 'publish',
-                        'post_content' =&gt; rand_str(),
-                        'post_title' =&gt; rand_str(),
-                );
-
-                // insert a post
-                $this-&gt;post_id_2 = wp_insert_post($post);
-        }
-
-        function tearDown() {
-                parent::tearDown();
-                wp_delete_post($this-&gt;post_id);
-                wp_delete_post($this-&gt;post_id_2);
-        }
-
-        function test_unique_postmeta() {
-                // Add a unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique', 'value', true) );
-
-                // Check unique is enforced
-                $this-&gt;assertFalse(add_post_meta($this-&gt;post_id, 'unique', 'another value', true));
-
-                //Check it exists
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique', true));
-                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique', false));
-
-                //Fail to delete the wrong value
-                $this-&gt;assertFalse(delete_post_meta($this-&gt;post_id, 'unique', 'wrong value'));
-
-                //Delete it
-                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'unique', 'value'));
-
-                //Check it is deleted
-                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id, 'unique', true));
-                $this-&gt;assertEquals(array(), get_post_meta($this-&gt;post_id, 'unique', false));
-
-        }
-
-        function test_nonunique_postmeta() {
-                // Add two non unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'value') );
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'another value'));
-
-                //Check they exists
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique', true));
-                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique', false));
-
-                //Fail to delete the wrong value
-                $this-&gt;assertFalse(delete_post_meta($this-&gt;post_id, 'nonunique', 'wrong value'));
-
-                //Delete the first one
-                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'nonunique', 'value'));
-
-                //Check the remainder exists
-                $this-&gt;assertEquals('another value', get_post_meta($this-&gt;post_id, 'nonunique', true));
-                $this-&gt;assertEquals(array('another value'), get_post_meta($this-&gt;post_id, 'nonunique', false));
-
-                //Add a third one
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique', 'someother value') );
-
-                //Check they exists
-                $expected = array(
-                        'someother value',
-                        'another value'
-                );
-                sort( $expected );
-                $this-&gt;assertTrue( in_array( get_post_meta( $this-&gt;post_id, 'nonunique', true ), $expected ) );
-                $actual = get_post_meta( $this-&gt;post_id, 'nonunique', false );
-                sort( $actual );
-                $this-&gt;assertEquals( $expected, $actual );
-
-                //Delete the lot
-                $this-&gt;assertTrue(delete_post_meta_by_key('nonunique'));
-        }
-
-        function test_update_post_meta() {
-                // Add a unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_update', 'value', true) );
-
-                // Add two non unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique_update', 'value') );
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'nonunique_update', 'another value') );
-
-                //Check they exists
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_update', true));
-                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique_update', false));
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
-                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
-
-                // Update them
-                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'unique_update', 'new', 'value'));
-                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'nonunique_update', 'new', 'value'));
-                $this-&gt;assertTrue(update_post_meta($this-&gt;post_id, 'nonunique_update', 'another new', 'another value'));
-
-                //Check they updated
-                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'unique_update', true));
-                $this-&gt;assertEquals(array('new'), get_post_meta($this-&gt;post_id, 'unique_update', false));
-                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
-                $this-&gt;assertEquals(array('new', 'another new'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
-
-        }
-
-        function test_delete_post_meta() {
-                // Add a unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_delete', 'value', true) );
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id_2, 'unique_delete', 'value', true) );
-
-                //Check they exists
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_delete', true));
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete', true));
-
-                //Delete one of them
-                $this-&gt;assertTrue(delete_post_meta($this-&gt;post_id, 'unique_delete', 'value'));
-
-                //Check the other still exitsts
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete', true));
-
-
-        }
-
-        function test_delete_post_meta_by_key() {
-                // Add a unique post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'unique_delete_by_key', 'value', true) );
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', 'value', true) );
-
-                //Check they exist
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_delete_by_key', true));
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
-
-                //Delete one of them
-                $this-&gt;assertTrue(delete_post_meta_by_key('unique_delete_by_key'));
-
-                //Check the other still exists
-                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
-                $this-&gt;assertEquals('', get_post_meta($this-&gt;post_id_2, 'unique_delete_by_key', true));
-        }
-
-        function test_get_post_meta_by_id() {
-                $mid = add_post_meta( $this-&gt;post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true );
-                $this-&gt;assertInternalType( 'integer', $mid );
-
-                $mobj = new stdClass;
-                $mobj-&gt;meta_id = $mid;
-                $mobj-&gt;post_id = $this-&gt;post_id;
-                $mobj-&gt;meta_key = 'get_post_meta_by_key';
-                $mobj-&gt;meta_value = 'get_post_meta_by_key_value';
-                $this-&gt;assertEquals( $mobj, get_post_meta_by_id( $mid ) );
-                delete_metadata_by_mid( 'post', $mid );
-
-                $mid = add_post_meta( $this-&gt;post_id, 'get_post_meta_by_key', array( 'foo', 'bar' ), true );
-                $this-&gt;assertInternalType( 'integer', $mid );
-                $mobj-&gt;meta_id = $mid;
-                $mobj-&gt;meta_value = array( 'foo', 'bar' );
-                $this-&gt;assertEquals( $mobj, get_post_meta_by_id( $mid ) );
-                delete_metadata_by_mid( 'post', $mid );
-        }
-
-        function test_delete_meta() {
-                $mid = add_post_meta( $this-&gt;post_id, 'delete_meta', 'delete_meta_value', true );
-                $this-&gt;assertInternalType( 'integer', $mid );
-
-                $this-&gt;assertTrue( delete_meta( $mid ) );
-                $this-&gt;assertFalse( get_metadata_by_mid( 'post', $mid ) );
-
-                $this-&gt;assertFalse( delete_meta( 123456789 ) );
-        }
-
-        function test_update_meta() {
-                // Add a unique post meta item
-                $this-&gt;assertInternalType( 'integer', $mid1 = add_post_meta($this-&gt;post_id, 'unique_update', 'value', true) );
-
-                // Add two non unique post meta item
-                $this-&gt;assertInternalType( 'integer', $mid2 = add_post_meta($this-&gt;post_id, 'nonunique_update', 'value') );
-                $this-&gt;assertInternalType( 'integer', $mid3 = add_post_meta($this-&gt;post_id, 'nonunique_update', 'another value') );
-
-                //Check they exist
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'unique_update', true));
-                $this-&gt;assertEquals(array('value'), get_post_meta($this-&gt;post_id, 'unique_update', false));
-                $this-&gt;assertEquals('value', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
-                $this-&gt;assertEquals(array('value', 'another value'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
-
-                // Update them
-                $this-&gt;assertTrue( update_meta( $mid1, 'unique_update', 'new' ) );
-                $this-&gt;assertTrue( update_meta( $mid2, 'nonunique_update', 'new' ) );
-                $this-&gt;assertTrue( update_meta( $mid3, 'nonunique_update', 'another new' ) );
-
-                //Check they updated
-                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'unique_update', true));
-                $this-&gt;assertEquals(array('new'), get_post_meta($this-&gt;post_id, 'unique_update', false));
-                $this-&gt;assertEquals('new', get_post_meta($this-&gt;post_id, 'nonunique_update', true));
-                $this-&gt;assertEquals(array('new', 'another new'), get_post_meta($this-&gt;post_id, 'nonunique_update', false));
-
-                // Slashed update
-                $data = &quot;'quote and \slash&quot;;
-                $this-&gt;assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) );
-                $meta = get_metadata_by_mid( 'post', $mid1 );
-                $this-&gt;assertEquals( $data, $meta-&gt;meta_value );
-        }
-
-        /**
-         * @ticket 12860
-         */
-        function test_funky_post_meta() {
-                $classy = new StdClass();
-                $classy-&gt;ID = 1;
-                $classy-&gt;stringy = &quot;I love slashes\\\\&quot;;
-                $funky_meta[] = $classy;
-
-                $classy = new StdClass();
-                $classy-&gt;ID = 2;
-                $classy-&gt;stringy = &quot;I love slashes\\\\ more&quot;;
-                $funky_meta[] = $classy;
-
-                // Add a post meta item
-                $this-&gt;assertInternalType( 'integer', add_post_meta($this-&gt;post_id, 'test_funky_post_meta', $funky_meta, true) );
-
-                //Check they exists
-                $this-&gt;assertEquals($funky_meta, get_post_meta($this-&gt;post_id, 'test_funky_post_meta', true));
-
-        }
-}
-
-/**
- * @group post
- */
-class WPTestPostTypes extends WP_UnitTestCase {
-        function test_register_post_type() {
-                $this-&gt;assertNull( get_post_type_object( 'foo' ) );
-                register_post_type( 'foo' );
-
-                $pobj = get_post_type_object( 'foo' );
-                $this-&gt;assertInstanceOf( 'stdClass', $pobj );
-                $this-&gt;assertEquals( 'foo', $pobj-&gt;name );
-
-                // Test some defaults
-                $this-&gt;assertFalse( is_post_type_hierarchical( 'foo' ) );
-                $this-&gt;assertEquals( array(), get_object_taxonomies( 'foo' ) );
-        }
-
-        function test_register_taxonomy_for_object_type() {
-                global $wp_taxonomies;
-
-                register_post_type( 'bar' );
-                register_taxonomy_for_object_type( 'post_tag', 'bar' );
-                $this-&gt;assertEquals( array( 'post_tag' ), get_object_taxonomies( 'bar' ) );
-                register_taxonomy_for_object_type( 'category', 'bar' );
-                $this-&gt;assertEquals( array( 'category', 'post_tag' ), get_object_taxonomies( 'bar' ) );
-
-                $this-&gt;assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
-                $this-&gt;assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
-
-                // Clean up. Remove the 'bar' post type from these taxonomies.
-                $GLOBALS['wp_taxonomies']['post_tag']-&gt;object_type = array( 'post' );
-                $GLOBALS['wp_taxonomies']['category']-&gt;object_type = array( 'post' );
-
-                $this-&gt;assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
-                $this-&gt;assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
-        }
-
-        function test_post_type_exists() {
-                $this-&gt;assertFalse( post_type_exists( 'notaposttype' ) );
-                $this-&gt;assertTrue( post_type_exists( 'post' ) );
-        }
-
-        function test_post_type_supports() {
-                $this-&gt;assertTrue( post_type_supports( 'post', 'post-formats' ) );
-                $this-&gt;assertFalse( post_type_supports( 'page', 'post-formats' ) );
-                $this-&gt;assertFalse( post_type_supports( 'notaposttype', 'post-formats' ) );
-                $this-&gt;assertFalse( post_type_supports( 'post', 'notafeature' ) );
-                $this-&gt;assertFalse( post_type_supports( 'notaposttype', 'notafeature' ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_taxonomyphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_taxonomy.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_taxonomy.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_taxonomy.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,401 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * @group taxonomy
- */
-class TestTaxonomy extends WP_UnitTestCase {
-        function test_get_post_taxonomies() {
-                $this-&gt;assertEquals(array('category', 'post_tag', 'post_format'), get_object_taxonomies('post'));
-        }
-
-        function test_get_link_taxonomies() {
-                $this-&gt;assertEquals(array('link_category'), get_object_taxonomies('link'));
-        }
-
-        /**
-         * @ticket 5417
-         */
-        function test_get_unknown_taxonomies() {
-                // taxonomies for an unknown object type
-                $this-&gt;assertEquals( array(), get_object_taxonomies(rand_str()) );
-                $this-&gt;assertEquals( array(), get_object_taxonomies('') );
-                $this-&gt;assertEquals( array(), get_object_taxonomies(0) );
-                $this-&gt;assertEquals( array(), get_object_taxonomies(NULL) );
-        }
-
-        function test_get_post_taxonomy() {
-                foreach ( get_object_taxonomies('post') as $taxonomy ) {
-                        $tax = get_taxonomy($taxonomy);
-                        // should return an object with the correct taxonomy object type
-                        $this-&gt;assertTrue( is_object( $tax ) );
-                        $this-&gt;assertTrue( is_array( $tax-&gt;object_type ) );
-                        $this-&gt;assertEquals( array( 'post' ), $tax-&gt;object_type );
-                }
-        }
-
-        function test_get_link_taxonomy() {
-                foreach ( get_object_taxonomies('link') as $taxonomy ) {
-                        $tax = get_taxonomy($taxonomy);
-                        // should return an object with the correct taxonomy object type
-                        $this-&gt;assertTrue( is_object($tax) );
-                        $this-&gt;assertTrue( is_array( $tax-&gt;object_type ) );
-                        $this-&gt;assertEquals( array( 'link' ), $tax-&gt;object_type );
-                }
-        }
-
-        function test_taxonomy_exists_known() {
-                $this-&gt;assertTrue( taxonomy_exists('category') );
-                $this-&gt;assertTrue( taxonomy_exists('post_tag') );
-                $this-&gt;assertTrue( taxonomy_exists('link_category') );
-        }
-
-        function test_taxonomy_exists_unknown() {
-                $this-&gt;assertFalse( taxonomy_exists(rand_str()) );
-                $this-&gt;assertFalse( taxonomy_exists('') );
-                $this-&gt;assertFalse( taxonomy_exists(0) );
-                $this-&gt;assertFalse( taxonomy_exists(NULL) );
-        }
-
-        function test_is_taxonomy_hierarchical() {
-                $this-&gt;assertTrue( is_taxonomy_hierarchical('category') );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical('post_tag') );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical('link_category') );
-        }
-
-        function test_is_taxonomy_hierarchical_unknown() {
-                $this-&gt;assertFalse( is_taxonomy_hierarchical(rand_str()) );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical('') );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical(0) );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical(NULL) );
-        }
-
-        function test_register_taxonomy() {
-
-                // make up a new taxonomy name, and ensure it's unused
-                $tax = rand_str();
-                $this-&gt;assertFalse( taxonomy_exists($tax) );
-
-                register_taxonomy( $tax, 'post' );
-                $this-&gt;assertTrue( taxonomy_exists($tax) );
-                $this-&gt;assertFalse( is_taxonomy_hierarchical($tax) );
-
-                // clean up
-                unset($GLOBALS['wp_taxonomies'][$tax]);
-        }
-
-        function test_register_hierarchical_taxonomy() {
-
-                // make up a new taxonomy name, and ensure it's unused
-                $tax = rand_str();
-                $this-&gt;assertFalse( taxonomy_exists($tax) );
-
-                register_taxonomy( $tax, 'post', array('hierarchical'=&gt;true) );
-                $this-&gt;assertTrue( taxonomy_exists($tax) );
-                $this-&gt;assertTrue( is_taxonomy_hierarchical($tax) );
-
-                // clean up
-                unset($GLOBALS['wp_taxonomies'][$tax]);
-        }
-}
-
-/**
- * @group taxonomy
- */
-class TestTermAPI extends WP_UnitTestCase {
-        var $taxonomy = 'category';
-
-        function setUp() {
-                parent::setUp();
-                // insert one term into every post taxonomy
-                // otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs
-                $term = rand_str();
-                foreach(get_object_taxonomies('post') as $tax)
-                        wp_insert_term( $term, $tax );
-        }
-
-        function test_wp_insert_delete_term() {
-                // a new unused term
-                $term = rand_str();
-                $this-&gt;assertNull( term_exists($term) );
-
-                $initial_count = wp_count_terms( $this-&gt;taxonomy );
-
-                $t = wp_insert_term( $term, $this-&gt;taxonomy );
-                $this-&gt;assertTrue( is_array($t) );
-                $this-&gt;assertFalse( is_wp_error($t) );
-                $this-&gt;assertTrue( $t['term_id'] &gt; 0 );
-                $this-&gt;assertTrue( $t['term_taxonomy_id'] &gt; 0 );
-                $this-&gt;assertEquals( $initial_count + 1, wp_count_terms($this-&gt;taxonomy) );
-
-                // make sure the term exists
-                $this-&gt;assertTrue( term_exists($term) &gt; 0 );
-                $this-&gt;assertTrue( term_exists($t['term_id']) &gt; 0 );
-
-                // now delete it
-                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
-                $this-&gt;assertNull( term_exists($term) );
-                $this-&gt;assertNull( term_exists($t['term_id']) );
-                $this-&gt;assertEquals( $initial_count, wp_count_terms($this-&gt;taxonomy) );
-        }
-
-        function test_term_exists_known() {
-                // insert a term
-                $term = rand_str();
-                $t = wp_insert_term( $term, $this-&gt;taxonomy );
-
-                $this-&gt;assertEquals( $t['term_id'], term_exists($t['term_id']) );
-                $this-&gt;assertEquals( $t['term_id'], term_exists($term) );
-
-                // clean up
-                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
-        }
-
-        function test_term_exists_unknown() {
-                $this-&gt;assertNull( term_exists(rand_str()) );
-                $this-&gt;assertEquals( 0, term_exists(0) );
-                $this-&gt;assertEquals( 0, term_exists('') );
-                $this-&gt;assertEquals( 0, term_exists(NULL) );
-        }
-
-        /**
-         * @ticket 5381
-         */
-        function test_is_term_type() {
-                // insert a term
-                $term = rand_str();
-                $t = wp_insert_term( $term, $this-&gt;taxonomy );
-
-                $term_obj = get_term_by('name', $term, $this-&gt;taxonomy);
-                $this-&gt;assertEquals( $t['term_id'], term_exists($term_obj-&gt;slug) );
-
-                // clean up
-                $this-&gt;assertTrue( wp_delete_term($t['term_id'], $this-&gt;taxonomy) );
-        }
-
-        function test_set_object_terms_by_id() {
-                $ids = $this-&gt;factory-&gt;post-&gt;create_many(5);
-
-                $terms = array();
-                for ($i=0; $i&lt;3; $i++ ) {
-                        $term = rand_str();
-                        $result = wp_insert_term( $term, $this-&gt;taxonomy );
-                        $term_id[$term] = $result['term_id'];
-                }
-
-                foreach ($ids as $id) {
-                                $tt = wp_set_object_terms( $id, array_values($term_id), $this-&gt;taxonomy );
-                                // should return three term taxonomy ids
-                                $this-&gt;assertEquals( 3, count($tt) );
-                }
-
-                // each term should be associated with every post
-                foreach ($term_id as $term=&gt;$id) {
-                        $actual = get_objects_in_term($id, $this-&gt;taxonomy);
-                        $this-&gt;assertEquals( $ids, array_map('intval', $actual) );
-                }
-
-                // each term should have a count of 5
-                foreach (array_keys($term_id) as $term) {
-                        $t = get_term_by('name', $term, $this-&gt;taxonomy);
-                        $this-&gt;assertEquals( 5, $t-&gt;count );
-                }
-        }
-
-        function test_set_object_terms_by_name() {
-                $ids = $this-&gt;factory-&gt;post-&gt;create_many(5);
-
-                $terms = array(
-                                rand_str(),
-                                rand_str(),
-                                rand_str());
-
-                foreach ($ids as $id) {
-                                $tt = wp_set_object_terms( $id, $terms, $this-&gt;taxonomy );
-                                // should return three term taxonomy ids
-                                $this-&gt;assertEquals( 3, count($tt) );
-                                // remember which term has which term_id
-                                for ($i=0; $i&lt;3; $i++) {
-                                        $term = get_term_by('name', $terms[$i], $this-&gt;taxonomy);
-                                        $term_id[$terms[$i]] = intval($term-&gt;term_id);
-                                }
-                }
-
-                // each term should be associated with every post
-                foreach ($term_id as $term=&gt;$id) {
-                        $actual = get_objects_in_term($id, $this-&gt;taxonomy);
-                        $this-&gt;assertEquals( $ids, array_map('intval', $actual) );
-                }
-
-                // each term should have a count of 5
-                foreach ($terms as $term) {
-                        $t = get_term_by('name', $term, $this-&gt;taxonomy);
-                        $this-&gt;assertEquals( 5, $t-&gt;count );
-                }
-        }
-
-        function test_change_object_terms_by_name() {
-                // set some terms on an object; then change them while leaving one intact
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                $terms_1 = array('foo', 'bar', 'baz');
-                $terms_2 = array('bar', 'bing');
-
-                // set the initial terms
-                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
-                $this-&gt;assertEquals( 3, count($tt_1) );
-
-                // make sure they're correct
-                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'names', 'orderby' =&gt; 't.term_id'));
-                $this-&gt;assertEquals( $terms_1, $terms );
-
-                // change the terms
-                $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this-&gt;taxonomy );
-                $this-&gt;assertEquals( 2, count($tt_2) );
-
-                // make sure they're correct
-                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'names', 'orderby' =&gt; 't.term_id'));
-                $this-&gt;assertEquals( $terms_2, $terms );
-
-                // make sure the tt id for 'bar' matches
-                $this-&gt;assertEquals( $tt_1[1], $tt_2[0] );
-
-        }
-
-        function test_change_object_terms_by_id() {
-                // set some terms on an object; then change them while leaving one intact
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                // first set: 3 terms
-                $terms_1 = array();
-                for ($i=0; $i&lt;3; $i++ ) {
-                        $term = rand_str();
-                        $result = wp_insert_term( $term, $this-&gt;taxonomy );
-                        $terms_1[$i] = $result['term_id'];
-                }
-
-                // second set: one of the original terms, plus one new term
-                $terms_2 = array();
-                $terms_2[0] = $terms_1[1];
-
-                $term = rand_str();
-                $result = wp_insert_term( $term, $this-&gt;taxonomy );
-                $terms_2[1] = $result['term_id'];
-
-
-                // set the initial terms
-                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
-                $this-&gt;assertEquals( 3, count($tt_1) );
-
-                // make sure they're correct
-                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'ids', 'orderby' =&gt; 't.term_id'));
-                $this-&gt;assertEquals( $terms_1, $terms );
-
-                // change the terms
-                $tt_2 = wp_set_object_terms( $post_id, $terms_2, $this-&gt;taxonomy );
-                $this-&gt;assertEquals( 2, count($tt_2) );
-
-                // make sure they're correct
-                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'ids', 'orderby' =&gt; 't.term_id'));
-                $this-&gt;assertEquals( $terms_2, $terms );
-
-                // make sure the tt id for 'bar' matches
-                $this-&gt;assertEquals( $tt_1[1], $tt_2[0] );
-
-        }
-
-        function test_get_object_terms_by_slug() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                $terms_1 = array('Foo', 'Bar', 'Baz');
-                $terms_1_slugs = array('foo', 'bar', 'baz');
-
-                // set the initial terms
-                $tt_1 = wp_set_object_terms( $post_id, $terms_1, $this-&gt;taxonomy );
-                $this-&gt;assertEquals( 3, count($tt_1) );
-
-                // make sure they're correct
-                $terms = wp_get_object_terms($post_id, $this-&gt;taxonomy, array('fields' =&gt; 'slugs', 'orderby' =&gt; 't.term_id'));
-                $this-&gt;assertEquals( $terms_1_slugs, $terms );
-        }
-
-        function test_set_object_terms_invalid() {
-                $post_id = $this-&gt;factory-&gt;post-&gt;create();
-
-                // bogus taxonomy
-                $result = wp_set_object_terms( $post_id, array(rand_str()), rand_str() );
-                $this-&gt;assertTrue( is_wp_error($result) );
-        }
-
-        function test_term_is_ancestor_of( ) {
-                $term = rand_str();
-                $term2 = rand_str();
-
-                $t = wp_insert_term( $term, 'category' );
-                $t2 = wp_insert_term( $term, 'category', array( 'parent' =&gt; $t['term_id'] ) );
-                if ( function_exists( 'term_is_ancestor_of' ) ) {
-                        $this-&gt;assertTrue( term_is_ancestor_of( $t['term_id'], $t2['term_id'], 'category' ) );
-                        $this-&gt;assertFalse( term_is_ancestor_of( $t2['term_id'], $t['term_id'], 'category' ) );
-                }
-                $this-&gt;assertTrue( cat_is_ancestor_of( $t['term_id'], $t2['term_id']) );
-                $this-&gt;assertFalse( cat_is_ancestor_of( $t2['term_id'], $t['term_id']) );
-
-                wp_delete_term($t['term_id'], 'category');
-                wp_delete_term($t2['term_id'], 'category');
-        }
-
-        function test_wp_insert_delete_category() {
-                $term = rand_str();
-                $this-&gt;assertNull( category_exists( $term ) );
-
-                $initial_count = wp_count_terms( 'category' );
-
-                $t = wp_insert_category( array( 'cat_name' =&gt; $term ) );
-                $this-&gt;assertTrue( is_numeric($t) );
-                $this-&gt;assertFalse( is_wp_error($t) );
-                $this-&gt;assertTrue( $t &gt; 0 );
-                $this-&gt;assertEquals( $initial_count + 1, wp_count_terms( 'category' ) );
-
-                // make sure the term exists
-                $this-&gt;assertTrue( term_exists($term) &gt; 0 );
-                $this-&gt;assertTrue( term_exists($t) &gt; 0 );
-
-                // now delete it
-                $this-&gt;assertTrue( wp_delete_category($t) );
-                $this-&gt;assertNull( term_exists($term) );
-                $this-&gt;assertNull( term_exists($t) );
-                $this-&gt;assertEquals( $initial_count, wp_count_terms('category') );
-        }
-
-        function test_wp_unique_term_slug() {
-                // set up test data
-                $a = wp_insert_term( 'parent', $this-&gt;taxonomy );
-                $b = wp_insert_term( 'child',  $this-&gt;taxonomy, array( 'parent' =&gt; $a['term_id'] ) );
-                $c = wp_insert_term( 'neighbor', $this-&gt;taxonomy );
-                $d = wp_insert_term( 'pet',  $this-&gt;taxonomy, array( 'parent' =&gt; $c['term_id'] )  );
-
-                $a_term = get_term( $a['term_id'], $this-&gt;taxonomy );
-                $b_term = get_term( $b['term_id'], $this-&gt;taxonomy );
-                $c_term = get_term( $c['term_id'], $this-&gt;taxonomy );
-                $d_term = get_term( $d['term_id'], $this-&gt;taxonomy );
-
-                // a unique slug gets unchanged
-                $this-&gt;assertEquals( 'unique-term', wp_unique_term_slug( 'unique-term', $c_term ) );
-
-                // a non-hierarchicial dupe gets suffixed with &quot;-#&quot;
-                $this-&gt;assertEquals( 'parent-2', wp_unique_term_slug( 'parent', $c_term ) );
-
-                // a hierarchical dupe initially gets suffixed with its parent term
-                $this-&gt;assertEquals( 'child-neighbor', wp_unique_term_slug( 'child', $d_term ) );
-
-                // a hierarchical dupe whose parent already contains the {term}-{parent term}
-                // term gets suffixed with parent term name and then '-#'
-                $e = wp_insert_term( 'child-neighbor', $this-&gt;taxonomy, array( 'parent' =&gt; $c['term_id'] ) );
-                $this-&gt;assertEquals( 'child-neighbor-2', wp_unique_term_slug( 'child', $d_term ) );
-
-                // clean up
-                foreach ( array( $a, $b, $c, $d, $e ) as $t )
-                        $this-&gt;assertTrue( wp_delete_term( $t['term_id'], $this-&gt;taxonomy ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_includes_themephp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_includes_theme.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_includes_theme.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_includes_theme.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,621 +0,0 @@
</span><del>-&lt;?php
-
-/**
- * test wp-includes/theme.php
- *
- * @group themes
- */
-class TestDefaultThemes extends WP_UnitTestCase {
-
-        var $theme_slug = 'twentyeleven';
-        var $theme_name = 'Twenty Eleven';
-
-        function setUp() {
-                parent::setUp();
-                add_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                remove_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-                parent::tearDown();
-        }
-
-        function test_wp_get_themes_default() {
-                $themes = wp_get_themes();
-                $this-&gt;assertInstanceOf( 'WP_Theme', $themes[ $this-&gt;theme_slug ] );
-                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_slug ]-&gt;get('Name') );
-
-                $single_theme = wp_get_theme( $this-&gt;theme_slug );
-                $this-&gt;assertEquals( $single_theme-&gt;get('Name'), $themes[ $this-&gt;theme_slug ]-&gt;get('Name') );
-                $this-&gt;assertEquals( $themes[ $this-&gt;theme_slug ], $single_theme );
-        }
-
-        function test_get_themes_default() {
-                $themes = get_themes();
-                $this-&gt;assertInstanceOf( 'WP_Theme', $themes[ $this-&gt;theme_name ] );
-                $this-&gt;assertEquals( $themes[ $this-&gt;theme_name ], get_theme( $this-&gt;theme_name ) );
-
-                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]['Name'] );
-                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]-&gt;Name );
-                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]-&gt;name );
-        }
-
-        function test_get_theme() {
-                $themes = get_themes();
-                foreach (array_keys($themes) as $name) {
-                        $theme = get_theme($name);
-                        // WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array().
-                        $this-&gt;assertFalse( is_array( $theme ) );
-                        $this-&gt;assertInstanceOf( 'WP_Theme', $theme );
-                        $this-&gt;assertEquals($theme, $themes[$name]);
-                }
-        }
-
-        function test_wp_get_theme() {
-                $themes = wp_get_themes();
-                foreach ( $themes as $theme ) {
-                        $this-&gt;assertInstanceOf( 'WP_Theme', $theme );
-                        $this-&gt;assertFalse( $theme-&gt;errors() );
-                        $_theme = wp_get_theme( $theme-&gt;get_stylesheet() );
-                        // This primes internal WP_Theme caches for the next assertion (headers_sanitized, textdomain_loaded)
-                        $this-&gt;assertEquals( $theme-&gt;get('Name'), $_theme-&gt;get('Name') );
-                        $this-&gt;assertEquals( $theme, $_theme );
-                }
-        }
-
-        function test_get_themes_contents() {
-                $themes = get_themes();
-
-                // Generic tests that should hold true for any theme
-                foreach ($themes as $k=&gt;$theme) {
-                        $this-&gt;assertEquals($theme['Name'], $k);
-                        $this-&gt;assertTrue(!empty($theme['Title']));
-
-                        // important attributes should all be set
-                        $default_headers = array(
-                                'Title' =&gt; 'Theme Title',
-                                'Version' =&gt; 'Version',
-                                'Parent Theme' =&gt; 'Parent Theme',
-                                'Template Dir' =&gt; 'Template Dir',
-                                'Stylesheet Dir' =&gt; 'Stylesheet Dir',
-                                'Template' =&gt; 'Template',
-                                'Stylesheet' =&gt; 'Stylesheet',
-                                'Screenshot' =&gt; 'Screenshot',
-                                'Description' =&gt; 'Description',
-                                'Author' =&gt; 'Author',
-                                'Tags' =&gt; 'Tags',
-                                // Introduced in WordPress 2.9
-                                'Theme Root' =&gt; 'Theme Root',
-                                'Theme Root URI' =&gt; 'Theme Root URI'
-                        );
-                        foreach ($default_headers as $name =&gt; $value) {
-                                $this-&gt;assertTrue(isset($theme[$name]));
-                        }
-
-                        // Make the tests work both for WordPress 2.8.5 and WordPress 2.9-rare
-                        $dir = isset($theme['Theme Root']) ? '' : WP_CONTENT_DIR;
-
-                        // important attributes should all not be empty as well
-                        $this-&gt;assertTrue(!empty($theme['Description']));
-                        $this-&gt;assertTrue(!empty($theme['Author']));
-                        $this-&gt;assertTrue(is_numeric($theme['Version']));
-                        $this-&gt;assertTrue(!empty($theme['Template']));
-                        $this-&gt;assertTrue(!empty($theme['Stylesheet']));
-
-                        // template files should all exist
-                        $this-&gt;assertTrue(is_array($theme['Template Files']));
-                        $this-&gt;assertTrue(count($theme['Template Files']) &gt; 0);
-                        foreach ($theme['Template Files'] as $file) {
-                                $this-&gt;assertTrue(is_file($dir . $file));
-                                $this-&gt;assertTrue(is_readable($dir . $file));
-                        }
-
-                        // css files should all exist
-                        $this-&gt;assertTrue(is_array($theme['Stylesheet Files']));
-                        $this-&gt;assertTrue(count($theme['Stylesheet Files']) &gt; 0);
-                        foreach ($theme['Stylesheet Files'] as $file) {
-                                $this-&gt;assertTrue(is_file($dir . $file));
-                                $this-&gt;assertTrue(is_readable($dir . $file));
-                        }
-
-                        $this-&gt;assertTrue(is_dir($dir . $theme['Template Dir']));
-                        $this-&gt;assertTrue(is_dir($dir . $theme['Stylesheet Dir']));
-
-                        $this-&gt;assertEquals('publish', $theme['Status']);
-
-                        $this-&gt;assertTrue(is_file($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
-                        $this-&gt;assertTrue(is_readable($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
-                }
-        }
-
-        /**
-         * @ticket 20897
-         */
-        function test_extra_theme_headers() {
-                $wp_theme = wp_get_theme( $this-&gt;theme_slug );
-                $this-&gt;assertNotEmpty( $wp_theme-&gt;get('License') );
-                $path_to_style_css = $wp_theme-&gt;get_theme_root() . '/' . $wp_theme-&gt;get_stylesheet() . '/style.css';
-                $this-&gt;assertTrue( file_exists( $path_to_style_css ) );
-                $theme_data = get_theme_data( $path_to_style_css );
-                $this-&gt;assertArrayHasKey( 'License', $theme_data );
-                $this-&gt;assertArrayNotHasKey( 'Not a Valid Key', $theme_data );
-                $this-&gt;assertNotEmpty( $theme_data['License'] );
-                $this-&gt;assertSame( $theme_data['License'], $wp_theme-&gt;get('License') );
-        }
-
-        function _theme_data_extra_headers() {
-                return array( 'License' );
-        }
-
-        function test_switch_theme() {
-                $themes = get_themes();
-
-                $switch_theme_one_argument = version_compare( $GLOBALS['wp_version'], '3.5-alpha-21103', '&gt;=' );
-
-                // switch to each theme in sequence
-                // do it twice to make sure we switch to the first theme, even if it's our starting theme
-                for ( $i = 0; $i &lt; 3; $i++ ) {
-                        foreach ($themes as $name=&gt;$theme) {
-                                // switch to this theme
-                                if ( $i === 2 || $switch_theme_one_argument )
-                                        switch_theme( $theme['Template'], $theme['Stylesheet'] );
-                                else
-                                        switch_theme( $theme['Stylesheet'] );
-
-                                $this-&gt;assertEquals($name, get_current_theme());
-
-                                // make sure the various get_* functions return the correct values
-                                $this-&gt;assertEquals($theme['Template'], get_template());
-                                $this-&gt;assertEquals($theme['Stylesheet'], get_stylesheet());
-
-                                $root_fs = get_theme_root();
-                                $this-&gt;assertTrue(is_dir($root_fs));
-
-                                $root_uri = get_theme_root_uri();
-                                $this-&gt;assertTrue(!empty($root_uri));
-
-                                $this-&gt;assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
-                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
-                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
-#                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
-
-                                $this-&gt;assertEquals($root_fs . '/' . get_template(), get_template_directory());
-                                $this-&gt;assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
-
-                                //get_query_template
-
-                                // template file that doesn't exist
-                                $this-&gt;assertEquals('', get_query_template(rand_str()));
-
-                                // template files that do exist
-                                //foreach ($theme['Template Files'] as $path) {
-                                //$file = basename($path, '.php');
-                                // FIXME: untestable because get_query_template uses TEMPLATEPATH
-                                //$this-&gt;assertEquals('', get_query_template($file));
-                                //}
-
-                                // these are kind of tautologies but at least exercise the code
-                                $this-&gt;assertEquals(get_404_template(), get_query_template('404'));
-                                $this-&gt;assertEquals(get_archive_template(), get_query_template('archive'));
-                                $this-&gt;assertEquals(get_author_template(), get_query_template('author'));
-                                $this-&gt;assertEquals(get_category_template(), get_query_template('category'));
-                                $this-&gt;assertEquals(get_date_template(), get_query_template('date'));
-                                $this-&gt;assertEquals(get_home_template(), get_query_template('home', array('home.php','index.php')));
-                                $this-&gt;assertEquals(get_page_template(), get_query_template('page'));
-                                $this-&gt;assertEquals(get_paged_template(), get_query_template('paged'));
-                                $this-&gt;assertEquals(get_search_template(), get_query_template('search'));
-                                $this-&gt;assertEquals(get_single_template(), get_query_template('single'));
-                                $this-&gt;assertEquals(get_attachment_template(), get_query_template('attachment'));
-
-                                // this one doesn't behave like the others
-                                if (get_query_template('comments-popup'))
-                                        $this-&gt;assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
-                                else
-                                        $this-&gt;assertEquals(get_comments_popup_template(), ABSPATH.'wp-includes/theme-compat/comments-popup.php');
-
-                                $this-&gt;assertEquals(get_tag_template(), get_query_template('tag'));
-
-                                // nb: this probably doesn't run because WP_INSTALLING is defined
-                                $this-&gt;assertTrue(validate_current_theme());
-                        }
-                }
-        }
-
-        function test_switch_theme_bogus() {
-                // try switching to a theme that doesn't exist
-                $template = rand_str();
-                $style = rand_str();
-                update_option('template', $template);
-                update_option('stylesheet', $style);
-
-                $theme = wp_get_theme();
-                $this-&gt;assertEquals( $style, (string) $theme );
-                $this-&gt;assertNotSame( false, $theme-&gt;errors() );
-                $this-&gt;assertFalse( $theme-&gt;exists() );
-
-                // these return the bogus name - perhaps not ideal behaviour?
-                $this-&gt;assertEquals($template, get_template());
-                $this-&gt;assertEquals($style, get_stylesheet());
-        }
-}
-
-/**
- * Test functions that fetch stuff from the theme directory
- *
- * @group themes
- */
-class TestThemeDir extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;theme_root = DIR_TESTDATA . '/themedir1';
-
-                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
-
-                // /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
-                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
-
-                add_filter('theme_root', array(&amp;$this, '_theme_root'));
-                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
-                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
-                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
-                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-                parent::tearDown();
-        }
-
-        // replace the normal theme root dir with our premade test dir
-        function _theme_root($dir) {
-                return $this-&gt;theme_root;
-        }
-
-        function test_theme_default() {
-                $themes = get_themes();
-                $theme = get_theme('WordPress Default');
-                $this-&gt;assertEquals( $themes['WordPress Default'], $theme );
-
-                $this-&gt;assertFalse( empty($theme) );
-
-                #echo gen_tests_array('theme', $theme);
-
-                $this-&gt;assertEquals( 'WordPress Default', $theme['Name'] );
-                $this-&gt;assertEquals( 'WordPress Default', $theme['Title'] );
-                $this-&gt;assertEquals( 'The default WordPress theme based on the famous &lt;a href=&quot;http://binarybonsai.com/kubrick/&quot;&gt;Kubrick&lt;/a&gt;.', $theme['Description'] );
-                $this-&gt;assertEquals( '&lt;a href=&quot;http://binarybonsai.com/&quot; title=&quot;Visit author homepage&quot;&gt;Michael Heilemann&lt;/a&gt;', $theme['Author'] );
-                $this-&gt;assertEquals( '1.6', $theme['Version'] );
-                $this-&gt;assertEquals( 'default', $theme['Template'] );
-                $this-&gt;assertEquals( 'default', $theme['Stylesheet'] );
-
-                $this-&gt;assertContains( $this-&gt;theme_root . '/default/functions.php', $theme['Template Files'] );
-                $this-&gt;assertContains( $this-&gt;theme_root . '/default/index.php', $theme['Template Files'] );
-                $this-&gt;assertContains( $this-&gt;theme_root . '/default/style.css', $theme['Stylesheet Files'] );
-
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/default', $theme['Template Dir'] );
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/default', $theme['Stylesheet Dir'] );
-                $this-&gt;assertEquals( 'publish', $theme['Status'] );
-                $this-&gt;assertEquals( '', $theme['Parent Theme'] );
-        }
-
-        function test_theme_sandbox() {
-                $theme = get_theme('Sandbox');
-
-                $this-&gt;assertFalse( empty($theme) );
-
-                #echo gen_tests_array('theme', $theme);
-
-                $this-&gt;assertEquals( 'Sandbox', $theme['Name'] );
-                $this-&gt;assertEquals( 'Sandbox', $theme['Title'] );
-                $this-&gt;assertEquals( 'A theme with powerful, semantic CSS selectors and the ability to add new skins.', $theme['Description'] );
-                $this-&gt;assertEquals( '&lt;a href=&quot;http://andy.wordpress.com/&quot;&gt;Andy Skelton&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://www.plaintxt.org/&quot;&gt;Scott Allan Wallick&lt;/a&gt;', $theme['Author'] );
-                $this-&gt;assertEquals( '0.6.1-wpcom', $theme['Version'] );
-                $this-&gt;assertEquals( 'sandbox', $theme['Template'] );
-                $this-&gt;assertEquals( 'sandbox', $theme['Stylesheet'] );
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/functions.php', reset($theme['Template Files']) );
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/index.php', next($theme['Template Files']) );
-
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/style.css', reset($theme['Stylesheet Files']) );
-
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Template Dir'] );
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Stylesheet Dir'] );
-                $this-&gt;assertEquals( 'publish', $theme['Status'] );
-                $this-&gt;assertEquals( '', $theme['Parent Theme'] );
-
-        }
-
-        // a css only theme
-        function test_theme_stylesheet_only() {
-                $themes = get_themes();
-
-                $theme = $themes['Stylesheet Only'];
-                $this-&gt;assertFalse( empty($theme) );
-
-                #echo gen_tests_array('theme', $theme);
-
-                $this-&gt;assertEquals( 'Stylesheet Only', $theme['Name'] );
-                $this-&gt;assertEquals( 'Stylesheet Only', $theme['Title'] );
-                $this-&gt;assertEquals( 'A three-column widget-ready theme in dark blue.', $theme['Description'] );
-                $this-&gt;assertEquals( '&lt;a href=&quot;http://www.example.com/&quot; title=&quot;Visit author homepage&quot;&gt;Henry Crun&lt;/a&gt;', $theme['Author'] );
-                $this-&gt;assertEquals( '1.0', $theme['Version'] );
-                $this-&gt;assertEquals( 'sandbox', $theme['Template'] );
-                $this-&gt;assertEquals( 'stylesheetonly', $theme['Stylesheet'] );
-                $this-&gt;assertContains( $this-&gt;theme_root.'/sandbox/functions.php', $theme['Template Files'] );
-                $this-&gt;assertContains( $this-&gt;theme_root.'/sandbox/index.php', $theme['Template Files'] );
-
-                $this-&gt;assertContains( $this-&gt;theme_root.'/stylesheetonly/style.css', $theme['Stylesheet Files']);
-
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Template Dir'] );
-                $this-&gt;assertEquals( $this-&gt;theme_root.'/stylesheetonly', $theme['Stylesheet Dir'] );
-                $this-&gt;assertEquals( 'publish', $theme['Status'] );
-                $this-&gt;assertEquals( 'Sandbox', $theme['Parent Theme'] );
-
-        }
-
-        function test_theme_list() {
-                $themes = get_themes();
-
-                // Ignore themes in the default /themes directory.
-                foreach ( $themes as $theme_name =&gt; $theme ) {
-                        if ( $theme-&gt;get_theme_root() != $this-&gt;theme_root )
-                                unset( $themes[ $theme_name ] );
-                }
-
-                $theme_names = array_keys($themes);
-                $expected = array(
-                        'WordPress Default',
-                        'Sandbox',
-                        'Stylesheet Only',
-                        'My Theme',
-                        'My Theme/theme1', // duplicate theme should be given a unique name
-                        'My Subdir Theme',// theme in a subdirectory should work
-                        'Page Template Theme', // theme with page templates for other test code
-                );
-
-                sort($theme_names);
-                sort($expected);
-
-                $this-&gt;assertEquals($expected, $theme_names);
-        }
-
-        function test_broken_themes() {
-                $themes = get_themes();
-                $expected = array('broken-theme' =&gt; array('Name' =&gt; 'broken-theme', 'Title' =&gt; 'broken-theme', 'Description' =&gt; __('Stylesheet is missing.')));
-
-                $this-&gt;assertEquals($expected, get_broken_themes() );
-        }
-
-        function test_wp_get_theme_with_non_default_theme_root() {
-                $this-&gt;assertFalse( wp_get_theme( 'sandbox', $this-&gt;theme_root )-&gt;errors() );
-                $this-&gt;assertFalse( wp_get_theme( 'sandbox' )-&gt;errors() );
-        }
-
-        function test_page_templates() {
-                $themes = get_themes();
-
-                $theme = $themes['Page Template Theme'];
-                $this-&gt;assertFalse( empty($theme) );
-
-                $templates = $theme['Template Files'];
-                $this-&gt;assertTrue( in_array( $this-&gt;theme_root . '/page-templates/template-top-level.php', $templates));
-        }
-
-        function test_get_theme_data_top_level() {
-                $theme_data = get_theme_data( DIR_TESTDATA . '/themedir1/theme1/style.css' );
-
-                $this-&gt;assertEquals( 'My Theme', $theme_data['Name'] );
-                $this-&gt;assertEquals( 'http://example.org/', $theme_data['URI'] );
-                $this-&gt;assertEquals( 'An example theme', $theme_data['Description'] );
-                $this-&gt;assertEquals( '&lt;a href=&quot;http://example.com/&quot; title=&quot;Visit author homepage&quot;&gt;Minnie Bannister&lt;/a&gt;', $theme_data['Author'] );
-                $this-&gt;assertEquals( 'http://example.com/', $theme_data['AuthorURI'] );
-                $this-&gt;assertEquals( '1.3', $theme_data['Version'] );
-                $this-&gt;assertEquals( '', $theme_data['Template'] );
-                $this-&gt;assertEquals( 'publish', $theme_data['Status'] );
-                $this-&gt;assertEquals( array(), $theme_data['Tags'] );
-                $this-&gt;assertEquals( 'My Theme', $theme_data['Title'] );
-                $this-&gt;assertEquals( 'Minnie Bannister', $theme_data['AuthorName'] );
-        }
-
-        function test_get_theme_data_subdir() {
-                $theme_data = get_theme_data( $this-&gt;theme_root . '/subdir/theme2/style.css' );
-
-                $this-&gt;assertEquals( 'My Subdir Theme', $theme_data['Name'] );
-                $this-&gt;assertEquals( 'http://example.org/', $theme_data['URI'] );
-                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme_data['Description'] );
-                $this-&gt;assertEquals( '&lt;a href=&quot;http://wordpress.org/&quot; title=&quot;Visit author homepage&quot;&gt;Mr. WordPress&lt;/a&gt;', $theme_data['Author'] );
-                $this-&gt;assertEquals( 'http://wordpress.org/', $theme_data['AuthorURI'] );
-                $this-&gt;assertEquals( '0.1', $theme_data['Version'] );
-                $this-&gt;assertEquals( '', $theme_data['Template'] );
-                $this-&gt;assertEquals( 'publish', $theme_data['Status'] );
-                $this-&gt;assertEquals( array(), $theme_data['Tags'] );
-                $this-&gt;assertEquals( 'My Subdir Theme', $theme_data['Title'] );
-                $this-&gt;assertEquals( 'Mr. WordPress', $theme_data['AuthorName'] );
-        }
-
-}
-
-/**
- * @group themes
- */
-class TestLargeThemeDir extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                $this-&gt;theme_root = DIR_TESTDATA . '/wpcom-themes';
-
-                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
-                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
-
-                add_filter('theme_root', array(&amp;$this, '_theme_root'));
-
-                // clear caches
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-        }
-
-        function tearDown() {
-                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
-                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
-                wp_clean_themes_cache();
-                unset( $GLOBALS['wp_themes'] );
-                parent::tearDown();
-        }
-
-        // replace the normal theme root dir with our premade test dir
-        function _theme_root($dir) {
-                return $this-&gt;theme_root;
-        }
-
-        function _filter_out_themes_not_in_root( &amp;$themes ) {
-                foreach ( $themes as $key =&gt; $theme ) {
-                        if ( $theme-&gt;get_theme_root() != $this-&gt;theme_root )
-                                unset( $themes[ $key ] );
-                }
-        }
-
-        function test_theme_list() {
-                $themes = get_themes();
-                $this-&gt;_filter_out_themes_not_in_root( $themes );
-                $theme_names = array_keys( $themes );
-                $this-&gt;assertEquals(87, count( $theme_names ) );
-                $length = strlen( serialize( $themes ) );
-
-                //2.9 pre [12226]
-                $this-&gt;assertLessThanOrEqual(387283, $length );
-                //2.8.5
-                $this-&gt;assertLessThanOrEqual(368319, $length );
-                //2.9 post [12226]
-                $this-&gt;assertLessThanOrEqual(261998, $length );
-                //3.4 post [20029], #20103
-                $this-&gt;assertLessThanOrEqual(100000, $length );
-        }
-
-        /**
-         * Reducing in-memory size further.
-         *
-         * @ticket 11214
-         */
-        function test_smaller_storage() {
-                $themes = get_themes();
-                $this-&gt;_filter_out_themes_not_in_root( $themes );
-                $theme_names = array_keys($themes);
-                $this-&gt;assertEquals(87, count($theme_names));
-                $this-&gt;assertLessThanOrEqual(136342, strlen(serialize($themes)));
-        }
-}
-
-/**
- * @group themes
- */
-class TestThemeSupport extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-        }
-
-        function tearDown() {
-                parent::tearDown();
-        }
-
-        function test_the_basics() {
-                add_theme_support( 'automatic-feed-links' );
-                $this-&gt;assertTrue( current_theme_supports( 'automatic-feed-links' ) );
-                remove_theme_support( 'automatic-feed-links' );
-                $this-&gt;assertFalse( current_theme_supports( 'automatic-feed-links' ) );
-                add_theme_support( 'automatic-feed-links' );
-                $this-&gt;assertTrue( current_theme_supports( 'automatic-feed-links' ) );
-        }
-
-        function test_admin_bar() {
-                add_theme_support( 'admin-bar' );
-                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
-                remove_theme_support( 'admin-bar' );
-                $this-&gt;assertFalse( current_theme_supports( 'admin-bar' ) );
-                add_theme_support( 'admin-bar' );
-                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
-
-                add_theme_support( 'admin-bar', array( 'callback' =&gt; '__return_false' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
-
-                $this-&gt;assertEquals(
-                        array( 0 =&gt; array( 'callback' =&gt; '__return_false' ) ),
-                        get_theme_support( 'admin-bar' )
-                );
-                remove_theme_support( 'admin-bar' );
-                $this-&gt;assertFalse( current_theme_supports( 'admin-bar' ) );
-                $this-&gt;assertFalse( get_theme_support( 'admin-bar' ) );
-        }
-
-        function test_post_thumbnails() {
-                add_theme_support( 'post-thumbnails' );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-                remove_theme_support( 'post-thumbnails' );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
-                add_theme_support( 'post-thumbnails' );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-
-                // simple array of post types.
-                add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
-                remove_theme_support( 'post-thumbnails' );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
-
-                #WP18548
-                if ( ! function_exists( '_wp_render_title_tag' ) )
-                        return;
-
-                // array of arguments, with the key of 'types' holding the post types.
-                add_theme_support( 'post-thumbnails', array( 'types' =&gt; array( 'post', 'page' ) ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
-                remove_theme_support( 'post-thumbnails' );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
-
-                // array of arguments, with the key of 'types' holding the post types.
-                add_theme_support( 'post-thumbnails', array( 'types' =&gt; true ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
-                remove_theme_support( 'post-thumbnails' );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
-
-                // array of arguments, with some other argument, and no 'types' argument.
-                add_theme_support( 'post-thumbnails', array( rand_str() =&gt; rand_str() ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
-                remove_theme_support( 'post-thumbnails' );
-                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
-
-        }
-
-        function supports_foobar( $yesno, $args, $feature ) {
-                if ( $args[0] == $feature[0] )
-                        return true;
-                return false;
-        }
-
-        function test_plugin_hook() {
-                $this-&gt;assertFalse( current_theme_supports( 'foobar' ) );
-                add_theme_support( 'foobar' );
-                $this-&gt;assertTrue( current_theme_supports( 'foobar' ) );
-
-                add_filter( 'current_theme_supports-foobar', array( $this, 'supports_foobar'), 10, 3 );
-
-                add_theme_support( 'foobar', 'bar' );
-                $this-&gt;assertFalse( current_theme_supports( 'foobar', 'foo' ) );
-                $this-&gt;assertTrue( current_theme_supports( 'foobar', 'bar' ) );
-
-                remove_theme_support( 'foobar' );
-                $this-&gt;assertFalse( current_theme_supports( 'foobar', 'bar' ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststest_post_outputphp"></a>
<div class="delfile"><h4>Deleted: trunk/tests/test_post_output.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/test_post_output.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/test_post_output.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -1,336 +0,0 @@
</span><del>-&lt;?php
-
-// test the output of post template tags etc
-
-/**
- * @group post
- * @group formatting
- */
-class WP_Test_Post_Output extends WP_UnitTestCase {
-
-        function setUp() {
-                parent::setUp();
-                add_shortcode( 'dumptag', array( $this, '_shortcode_dumptag' ) );
-                add_shortcode( 'paragraph', array( $this, '_shortcode_paragraph' ) );
-        }
-
-        function tearDown() {
-                global $shortcode_tags;
-                unset( $shortcode_tags['dumptag'], $shortcode_tags['paragraph'] );
-                parent::tearDown();
-        }
-
-        function _shortcode_dumptag( $atts ) {
-                $out = '';
-                foreach ($atts as $k=&gt;$v)
-                        $out .= &quot;$k = $v\n&quot;;
-                return $out;
-        }
-
-        function _shortcode_paragraph( $atts, $content ) {
-                extract(shortcode_atts(array(
-                        'class' =&gt; 'graf',
-                ), $atts));
-                return &quot;&lt;p class='$class'&gt;$content&lt;/p&gt;\n&quot;;
-        }
-
-        function test_the_content() {
-                $post_content = &lt;&lt;&lt;EOF
-&lt;i&gt;This is the excerpt.&lt;/i&gt;
-&lt;!--more--&gt;
-This is the &lt;b&gt;body&lt;/b&gt;.
-EOF;
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;p&gt;&lt;i&gt;This is the excerpt.&lt;/i&gt;&lt;br /&gt;
-&lt;span id=&quot;more-{$post_id}&quot;&gt;&lt;/span&gt;&lt;br /&gt;
-This is the &lt;b&gt;body&lt;/b&gt;.&lt;/p&gt;
-EOF;
-
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertTrue( is_single() );
-                $this-&gt;assertTrue( have_posts() );
-                $this-&gt;assertNull( the_post() );
-
-                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
-        }
-
-        function test_the_content_shortcode() {
-                $post_content = &lt;&lt;&lt;EOF
-[dumptag foo=&quot;bar&quot; baz=&quot;123&quot;]
-
-[dumptag foo=123 baz=bar]
-
-[dumptag http://example.com]
-
-EOF;
-
-                $expected =&lt;&lt;&lt;EOF
-foo = bar
-baz = 123
-foo = 123
-baz = bar
-0 = http://example.com
-
-EOF;
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertTrue( is_single() );
-                $this-&gt;assertTrue( have_posts() );
-                $this-&gt;assertNull( the_post() );
-
-                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
-        }
-
-        function test_the_content_shortcode_paragraph() {
-                $post_content = &lt;&lt;&lt;EOF
-Graf by itself:
-
-[paragraph]my graf[/paragraph]
-
-  [paragraph foo=&quot;bar&quot;]another graf with whitespace[/paragraph]
-
-An [paragraph]inline graf[/paragraph], this doesn't make much sense.
-
-A graf with a single EOL first:
-[paragraph]blah[/paragraph]
-
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;p&gt;Graf by itself:&lt;/p&gt;
-&lt;p class='graf'&gt;my graf&lt;/p&gt;
-
-  &lt;p class='graf'&gt;another graf with whitespace&lt;/p&gt;
-
-&lt;p&gt;An &lt;p class='graf'&gt;inline graf&lt;/p&gt;
-, this doesn&amp;#8217;t make much sense.&lt;/p&gt;
-&lt;p&gt;A graf with a single EOL first:&lt;br /&gt;
-&lt;p class='graf'&gt;blah&lt;/p&gt;
-&lt;/p&gt;
-
-EOF;
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertTrue( is_single() );
-                $this-&gt;assertTrue( have_posts() );
-                $this-&gt;assertNull( the_post() );
-
-                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
-        }
-}
-
-/**
- * @group media
- * @group gallery
- * @ticket UT30
- */
-class WPTestGalleryPost extends WP_UnitTestCase { // _WPDataset1
-        function setUp() {
-                parent::setUp();
-                global $wp_rewrite;
-                $wp_rewrite-&gt;set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
-                $wp_rewrite-&gt;flush_rules();
-        }
-
-        function test_the_content() {
-                // permalink page
-                $link = '/2008/04/01/simple-gallery-test/';
-                $this-&gt;go_to('/2008/04/01/simple-gallery-test/');
-                the_post();
-                // filtered output
-                $out = get_echo('the_content');
-                $this-&gt;assertNotEmpty($out, &quot;Could not get the_content for $link.&quot;);
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;p&gt;There are ten images attached to this post.  Here&amp;#8217;s a gallery:&lt;/p&gt;
-
-                &lt;style type='text/css'&gt;
-                        .gallery {
-                                margin: auto;
-                        }
-                        .gallery-item {
-                                float: left;
-                                margin-top: 10px;
-                                text-align: center;
-                                width: 33%;                        }
-                        .gallery img {
-                                border: 2px solid #cfcfcf;
-                        }
-                        .gallery-caption {
-                                margin-left: 0;
-                        }
-                &lt;/style&gt;
-                &lt;!-- see gallery_shortcode() in wp-includes/media.php --&gt;
-                &lt;div class='gallery'&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20040724_152504_53/' title='dsc20040724_152504_53'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/canola/' title='canola'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/canola3.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050315_145007_13/' title='dsc20050315_145007_13'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050604_133440_34/' title='dsc20050604_133440_34'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050831_165238_33/' title='dsc20050831_165238_33'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050901_105100_21/' title='dsc20050901_105100_21'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050813_115856_5/' title='dsc20050813_115856_5'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050720_123726_27/' title='dsc20050720_123726_27'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050727_091048_22/' title='Title: Seedlings'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050726_083116_18/' title='dsc20050726_083116_18'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg&quot; class=&quot;attachment-thumbnail&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;
-                        &lt;br style='clear: both;' /&gt;
-                &lt;/div&gt;
-
-&lt;p&gt;It&amp;#8217;s the simplest form of the gallery tag.  All images are from the public domain site burningwell.org.&lt;/p&gt;
-&lt;p&gt;The images have various combinations of titles, captions and descriptions.&lt;/p&gt;
-EOF;
-                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
-        }
-
-        function test_gallery_attributes() {
-                // make sure the gallery shortcode attributes are parsed correctly
-
-                $id = 575;
-                $post = get_post($id);
-                $this-&gt;assertNotNull($post, &quot;get_post($id) could not find the post.&quot;);
-                $post-&gt;post_content = '[gallery columns=&quot;1&quot; size=&quot;medium&quot;]';
-                wp_update_post($post);
-
-                // permalink page
-                $this-&gt;go_to('/2008/04/01/simple-gallery-test/');
-                the_post();
-                // filtered output
-                $out = get_echo('the_content');
-
-                $expected = &lt;&lt;&lt;EOF
-                &lt;style type='text/css'&gt;
-                        .gallery {
-                                margin: auto;
-                        }
-                        .gallery-item {
-                                float: left;
-                                margin-top: 10px;
-                                text-align: center;
-                                width: 100%;                        }
-                        .gallery img {
-                                border: 2px solid #cfcfcf;
-                        }
-                        .gallery-caption {
-                                margin-left: 0;
-                        }
-                &lt;/style&gt;
-                &lt;!-- see gallery_shortcode() in wp-includes/media.php --&gt;
-                &lt;div class='gallery'&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=565' title='dsc20040724_152504_53'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=566' title='canola'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/canola3.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=567' title='dsc20050315_145007_13'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=568' title='dsc20050604_133440_34'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=569' title='dsc20050831_165238_33'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=570' title='dsc20050901_105100_21'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=571' title='dsc20050813_115856_5'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=572' title='dsc20050720_123726_27'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=573' title='Title: Seedlings'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;&lt;dl class='gallery-item'&gt;
-                        &lt;dt class='gallery-icon'&gt;
-                                &lt;a href='http://example.com/?attachment_id=574' title='dsc20050726_083116_18'&gt;&lt;img src=&quot;http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg&quot; class=&quot;attachment-medium&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
-                        &lt;/dt&gt;&lt;/dl&gt;&lt;br style=&quot;clear: both&quot; /&gt;
-                        &lt;br style='clear: both;' /&gt;
-                &lt;/div&gt;
-
-EOF;
-                $this-&gt;assertEquals(strip_ws($expected), strip_ws($out));
-        }
-
-}
-
-/**
- * @group post
- * @group formatting
- */
-class WPTestAttributeFiltering extends WP_UnitTestCase {
-        function setUp() {
-                parent::setUp();
-                kses_init_filters();
-        }
-
-        function tearDown() {
-                kses_remove_filters();
-                parent::tearDown();
-        }
-
-        function test_the_content_attribute_filtering() {
-                // http://bpr3.org/?p=87
-                // the title attribute should make it through unfiltered
-                $post_content = &lt;&lt;&lt;EOF
-&lt;span class=&quot;Z3988&quot; title=&quot;ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.aulast=Mariat&amp;rft.aufirst=Denis&amp;rft. au=Denis+Mariat&amp;rft.au=Sead+Taourit&amp;rft.au=G%C3%A9rard+Gu%C3%A9rin&amp; rft.title=Genetics+Selection+Evolution&amp;rft.atitle=&amp;rft.date=2003&amp;rft. volume=35&amp;rft.issue=1&amp;rft.spage=119&amp;rft.epage=133&amp;rft.genre=article&amp; rft.id=info:DOI/10.1051%2Fgse%3A2002039&quot;&gt;&lt;/span&gt;Mariat, D., Taourit, S., Guérin, G. (2003). . &lt;span style=&quot;font-style: italic;&quot;&gt;Genetics Selection Evolution, 35&lt;/span&gt;(1), 119-133. DOI: &lt;a rev=&quot;review&quot; href= &quot;http://dx.doi.org/10.1051/gse:2002039&quot;&gt;10.1051/gse:2002039&lt;/a&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;p&gt;&lt;span class=&quot;Z3988&quot; title=&quot;ctx_ver=Z39.88-2004&amp;amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;amp;rft.aulast=Mariat&amp;amp;rft.aufirst=Denis&amp;amp;rft. au=Denis+Mariat&amp;amp;rft.au=Sead+Taourit&amp;amp;rft.au=G%C3%A9rard+Gu%C3%A9rin&amp;amp; rft.title=Genetics+Selection+Evolution&amp;amp;rft.atitle=&amp;amp;rft.date=2003&amp;amp;rft. volume=35&amp;amp;rft.issue=1&amp;amp;rft.spage=119&amp;amp;rft.epage=133&amp;amp;rft.genre=article&amp;amp; rft.id=info:DOI/10.1051%2Fgse%3A2002039&quot;&gt;&lt;/span&gt;Mariat, D., Taourit, S., Guérin, G. (2003). . &lt;span style=&quot;font-style: italic&quot;&gt;Genetics Selection Evolution, 35&lt;/span&gt;(1), 119-133. DOI: &lt;a rev=&quot;review&quot; href=&quot;http://dx.doi.org/10.1051/gse:2002039&quot;&gt;10.1051/gse:2002039&lt;/a&gt;&lt;/p&gt;
-EOF;
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertTrue( is_single() );
-                $this-&gt;assertTrue( have_posts() );
-                $this-&gt;assertNull( the_post() );
-
-                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
-        }
-
-        function test_the_content_attribute_value_with_colon() {
-                // http://bpr3.org/?p=87
-                // the title attribute should make it through unfiltered
-                $post_content = &lt;&lt;&lt;EOF
-&lt;span title=&quot;My friends: Alice, Bob and Carol&quot;&gt;foo&lt;/span&gt;
-EOF;
-
-                $expected = &lt;&lt;&lt;EOF
-&lt;p&gt;&lt;span title=&quot;My friends: Alice, Bob and Carol&quot;&gt;foo&lt;/span&gt;&lt;/p&gt;
-EOF;
-
-                $post_id = $this-&gt;factory-&gt;post-&gt;create( compact( 'post_content' ) );
-                $this-&gt;go_to( get_permalink( $post_id ) );
-                $this-&gt;assertTrue( is_single() );
-                $this-&gt;assertTrue( have_posts() );
-                $this-&gt;assertNull( the_post() );
-
-                $this-&gt;assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
-        }
-}
</del></span></pre></div>
<a id="trunkteststhemesupportphpfromrev903trunkteststest_includes_themephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/theme/support.php (from rev 903, trunk/tests/test_includes_theme.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/theme/support.php                                (rev 0)
+++ trunk/tests/theme/support.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+&lt;?php
+
+/**
+ * @group themes
+ */
+class Tests_Theme_Support extends WP_UnitTestCase {
+
+        function test_the_basics() {
+                add_theme_support( 'automatic-feed-links' );
+                $this-&gt;assertTrue( current_theme_supports( 'automatic-feed-links' ) );
+                remove_theme_support( 'automatic-feed-links' );
+                $this-&gt;assertFalse( current_theme_supports( 'automatic-feed-links' ) );
+                add_theme_support( 'automatic-feed-links' );
+                $this-&gt;assertTrue( current_theme_supports( 'automatic-feed-links' ) );
+        }
+
+        function test_admin_bar() {
+                add_theme_support( 'admin-bar' );
+                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
+                remove_theme_support( 'admin-bar' );
+                $this-&gt;assertFalse( current_theme_supports( 'admin-bar' ) );
+                add_theme_support( 'admin-bar' );
+                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
+
+                add_theme_support( 'admin-bar', array( 'callback' =&gt; '__return_false' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'admin-bar' ) );
+
+                $this-&gt;assertEquals(
+                        array( 0 =&gt; array( 'callback' =&gt; '__return_false' ) ),
+                        get_theme_support( 'admin-bar' )
+                );
+                remove_theme_support( 'admin-bar' );
+                $this-&gt;assertFalse( current_theme_supports( 'admin-bar' ) );
+                $this-&gt;assertFalse( get_theme_support( 'admin-bar' ) );
+        }
+
+        function test_post_thumbnails() {
+                add_theme_support( 'post-thumbnails' );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+                remove_theme_support( 'post-thumbnails' );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
+                add_theme_support( 'post-thumbnails' );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+
+                // simple array of post types.
+                add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
+                remove_theme_support( 'post-thumbnails' );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
+
+                #WP18548
+                if ( ! function_exists( '_wp_render_title_tag' ) )
+                        return;
+
+                // array of arguments, with the key of 'types' holding the post types.
+                add_theme_support( 'post-thumbnails', array( 'types' =&gt; array( 'post', 'page' ) ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
+                remove_theme_support( 'post-thumbnails' );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
+
+                // array of arguments, with the key of 'types' holding the post types.
+                add_theme_support( 'post-thumbnails', array( 'types' =&gt; true ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
+                remove_theme_support( 'post-thumbnails' );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
+
+                // array of arguments, with some other argument, and no 'types' argument.
+                add_theme_support( 'post-thumbnails', array( rand_str() =&gt; rand_str() ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
+                remove_theme_support( 'post-thumbnails' );
+                $this-&gt;assertFalse( current_theme_supports( 'post-thumbnails' ) );
+
+        }
+
+        function supports_foobar( $yesno, $args, $feature ) {
+                if ( $args[0] == $feature[0] )
+                        return true;
+                return false;
+        }
+
+        function test_plugin_hook() {
+                $this-&gt;assertFalse( current_theme_supports( 'foobar' ) );
+                add_theme_support( 'foobar' );
+                $this-&gt;assertTrue( current_theme_supports( 'foobar' ) );
+
+                add_filter( 'current_theme_supports-foobar', array( $this, 'supports_foobar'), 10, 3 );
+
+                add_theme_support( 'foobar', 'bar' );
+                $this-&gt;assertFalse( current_theme_supports( 'foobar', 'foo' ) );
+                $this-&gt;assertTrue( current_theme_supports( 'foobar', 'bar' ) );
+
+                remove_theme_support( 'foobar' );
+                $this-&gt;assertFalse( current_theme_supports( 'foobar', 'bar' ) );
+        }
+}
</ins></span></pre></div>
<a id="trunkteststhemethemeDirphpfromrev903trunkteststest_includes_themephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/theme/themeDir.php (from rev 903, trunk/tests/test_includes_theme.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/theme/themeDir.php                                (rev 0)
+++ trunk/tests/theme/themeDir.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,202 @@
</span><ins>+&lt;?php
+
+/**
+ * Test functions that fetch stuff from the theme directory
+ *
+ * @group themes
+ */
+class Tests_Theme_ThemeDir extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;theme_root = DIR_TESTDATA . '/themedir1';
+
+                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
+
+                // /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
+                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
+
+                add_filter('theme_root', array(&amp;$this, '_theme_root'));
+                add_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                add_filter( 'template_root', array(&amp;$this, '_theme_root') );
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
+                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
+                remove_filter( 'stylesheet_root', array(&amp;$this, '_theme_root') );
+                remove_filter( 'template_root', array(&amp;$this, '_theme_root') );
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+                parent::tearDown();
+        }
+
+        // replace the normal theme root dir with our premade test dir
+        function _theme_root($dir) {
+                return $this-&gt;theme_root;
+        }
+
+        function test_theme_default() {
+                $themes = get_themes();
+                $theme = get_theme('WordPress Default');
+                $this-&gt;assertEquals( $themes['WordPress Default'], $theme );
+
+                $this-&gt;assertFalse( empty($theme) );
+
+                #echo gen_tests_array('theme', $theme);
+
+                $this-&gt;assertEquals( 'WordPress Default', $theme['Name'] );
+                $this-&gt;assertEquals( 'WordPress Default', $theme['Title'] );
+                $this-&gt;assertEquals( 'The default WordPress theme based on the famous &lt;a href=&quot;http://binarybonsai.com/kubrick/&quot;&gt;Kubrick&lt;/a&gt;.', $theme['Description'] );
+                $this-&gt;assertEquals( '&lt;a href=&quot;http://binarybonsai.com/&quot; title=&quot;Visit author homepage&quot;&gt;Michael Heilemann&lt;/a&gt;', $theme['Author'] );
+                $this-&gt;assertEquals( '1.6', $theme['Version'] );
+                $this-&gt;assertEquals( 'default', $theme['Template'] );
+                $this-&gt;assertEquals( 'default', $theme['Stylesheet'] );
+
+                $this-&gt;assertContains( $this-&gt;theme_root . '/default/functions.php', $theme['Template Files'] );
+                $this-&gt;assertContains( $this-&gt;theme_root . '/default/index.php', $theme['Template Files'] );
+                $this-&gt;assertContains( $this-&gt;theme_root . '/default/style.css', $theme['Stylesheet Files'] );
+
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/default', $theme['Template Dir'] );
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/default', $theme['Stylesheet Dir'] );
+                $this-&gt;assertEquals( 'publish', $theme['Status'] );
+                $this-&gt;assertEquals( '', $theme['Parent Theme'] );
+        }
+
+        function test_theme_sandbox() {
+                $theme = get_theme('Sandbox');
+
+                $this-&gt;assertFalse( empty($theme) );
+
+                #echo gen_tests_array('theme', $theme);
+
+                $this-&gt;assertEquals( 'Sandbox', $theme['Name'] );
+                $this-&gt;assertEquals( 'Sandbox', $theme['Title'] );
+                $this-&gt;assertEquals( 'A theme with powerful, semantic CSS selectors and the ability to add new skins.', $theme['Description'] );
+                $this-&gt;assertEquals( '&lt;a href=&quot;http://andy.wordpress.com/&quot;&gt;Andy Skelton&lt;/a&gt; &amp;amp; &lt;a href=&quot;http://www.plaintxt.org/&quot;&gt;Scott Allan Wallick&lt;/a&gt;', $theme['Author'] );
+                $this-&gt;assertEquals( '0.6.1-wpcom', $theme['Version'] );
+                $this-&gt;assertEquals( 'sandbox', $theme['Template'] );
+                $this-&gt;assertEquals( 'sandbox', $theme['Stylesheet'] );
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/functions.php', reset($theme['Template Files']) );
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/index.php', next($theme['Template Files']) );
+
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox/style.css', reset($theme['Stylesheet Files']) );
+
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Template Dir'] );
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Stylesheet Dir'] );
+                $this-&gt;assertEquals( 'publish', $theme['Status'] );
+                $this-&gt;assertEquals( '', $theme['Parent Theme'] );
+
+        }
+
+        // a css only theme
+        function test_theme_stylesheet_only() {
+                $themes = get_themes();
+
+                $theme = $themes['Stylesheet Only'];
+                $this-&gt;assertFalse( empty($theme) );
+
+                #echo gen_tests_array('theme', $theme);
+
+                $this-&gt;assertEquals( 'Stylesheet Only', $theme['Name'] );
+                $this-&gt;assertEquals( 'Stylesheet Only', $theme['Title'] );
+                $this-&gt;assertEquals( 'A three-column widget-ready theme in dark blue.', $theme['Description'] );
+                $this-&gt;assertEquals( '&lt;a href=&quot;http://www.example.com/&quot; title=&quot;Visit author homepage&quot;&gt;Henry Crun&lt;/a&gt;', $theme['Author'] );
+                $this-&gt;assertEquals( '1.0', $theme['Version'] );
+                $this-&gt;assertEquals( 'sandbox', $theme['Template'] );
+                $this-&gt;assertEquals( 'stylesheetonly', $theme['Stylesheet'] );
+                $this-&gt;assertContains( $this-&gt;theme_root.'/sandbox/functions.php', $theme['Template Files'] );
+                $this-&gt;assertContains( $this-&gt;theme_root.'/sandbox/index.php', $theme['Template Files'] );
+
+                $this-&gt;assertContains( $this-&gt;theme_root.'/stylesheetonly/style.css', $theme['Stylesheet Files']);
+
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/sandbox', $theme['Template Dir'] );
+                $this-&gt;assertEquals( $this-&gt;theme_root.'/stylesheetonly', $theme['Stylesheet Dir'] );
+                $this-&gt;assertEquals( 'publish', $theme['Status'] );
+                $this-&gt;assertEquals( 'Sandbox', $theme['Parent Theme'] );
+
+        }
+
+        function test_theme_list() {
+                $themes = get_themes();
+
+                // Ignore themes in the default /themes directory.
+                foreach ( $themes as $theme_name =&gt; $theme ) {
+                        if ( $theme-&gt;get_theme_root() != $this-&gt;theme_root )
+                                unset( $themes[ $theme_name ] );
+                }
+
+                $theme_names = array_keys($themes);
+                $expected = array(
+                        'WordPress Default',
+                        'Sandbox',
+                        'Stylesheet Only',
+                        'My Theme',
+                        'My Theme/theme1', // duplicate theme should be given a unique name
+                        'My Subdir Theme',// theme in a subdirectory should work
+                        'Page Template Theme', // theme with page templates for other test code
+                );
+
+                sort($theme_names);
+                sort($expected);
+
+                $this-&gt;assertEquals($expected, $theme_names);
+        }
+
+        function test_broken_themes() {
+                $themes = get_themes();
+                $expected = array('broken-theme' =&gt; array('Name' =&gt; 'broken-theme', 'Title' =&gt; 'broken-theme', 'Description' =&gt; __('Stylesheet is missing.')));
+
+                $this-&gt;assertEquals($expected, get_broken_themes() );
+        }
+
+        function test_wp_get_theme_with_non_default_theme_root() {
+                $this-&gt;assertFalse( wp_get_theme( 'sandbox', $this-&gt;theme_root )-&gt;errors() );
+                $this-&gt;assertFalse( wp_get_theme( 'sandbox' )-&gt;errors() );
+        }
+
+        function test_page_templates() {
+                $themes = get_themes();
+
+                $theme = $themes['Page Template Theme'];
+                $this-&gt;assertFalse( empty($theme) );
+
+                $templates = $theme['Template Files'];
+                $this-&gt;assertTrue( in_array( $this-&gt;theme_root . '/page-templates/template-top-level.php', $templates));
+        }
+
+        function test_get_theme_data_top_level() {
+                $theme_data = get_theme_data( DIR_TESTDATA . '/themedir1/theme1/style.css' );
+
+                $this-&gt;assertEquals( 'My Theme', $theme_data['Name'] );
+                $this-&gt;assertEquals( 'http://example.org/', $theme_data['URI'] );
+                $this-&gt;assertEquals( 'An example theme', $theme_data['Description'] );
+                $this-&gt;assertEquals( '&lt;a href=&quot;http://example.com/&quot; title=&quot;Visit author homepage&quot;&gt;Minnie Bannister&lt;/a&gt;', $theme_data['Author'] );
+                $this-&gt;assertEquals( 'http://example.com/', $theme_data['AuthorURI'] );
+                $this-&gt;assertEquals( '1.3', $theme_data['Version'] );
+                $this-&gt;assertEquals( '', $theme_data['Template'] );
+                $this-&gt;assertEquals( 'publish', $theme_data['Status'] );
+                $this-&gt;assertEquals( array(), $theme_data['Tags'] );
+                $this-&gt;assertEquals( 'My Theme', $theme_data['Title'] );
+                $this-&gt;assertEquals( 'Minnie Bannister', $theme_data['AuthorName'] );
+        }
+
+        function test_get_theme_data_subdir() {
+                $theme_data = get_theme_data( $this-&gt;theme_root . '/subdir/theme2/style.css' );
+
+                $this-&gt;assertEquals( 'My Subdir Theme', $theme_data['Name'] );
+                $this-&gt;assertEquals( 'http://example.org/', $theme_data['URI'] );
+                $this-&gt;assertEquals( 'An example theme in a sub directory', $theme_data['Description'] );
+                $this-&gt;assertEquals( '&lt;a href=&quot;http://wordpress.org/&quot; title=&quot;Visit author homepage&quot;&gt;Mr. WordPress&lt;/a&gt;', $theme_data['Author'] );
+                $this-&gt;assertEquals( 'http://wordpress.org/', $theme_data['AuthorURI'] );
+                $this-&gt;assertEquals( '0.1', $theme_data['Version'] );
+                $this-&gt;assertEquals( '', $theme_data['Template'] );
+                $this-&gt;assertEquals( 'publish', $theme_data['Status'] );
+                $this-&gt;assertEquals( array(), $theme_data['Tags'] );
+                $this-&gt;assertEquals( 'My Subdir Theme', $theme_data['Title'] );
+                $this-&gt;assertEquals( 'Mr. WordPress', $theme_data['AuthorName'] );
+        }
+
+}
</ins></span></pre></div>
<a id="trunkteststhemethemeDirLargephpfromrev903trunkteststest_includes_themephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/theme/themeDirLarge.php (from rev 903, trunk/tests/test_includes_theme.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/theme/themeDirLarge.php                                (rev 0)
+++ trunk/tests/theme/themeDirLarge.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+&lt;?php
+
+/**
+ * @group themes
+ */
+class Tests_Theme_ThemeDirLarge extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;theme_root = DIR_TESTDATA . '/wpcom-themes';
+
+                $this-&gt;orig_theme_dir = $GLOBALS['wp_theme_directories'];
+                $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this-&gt;theme_root );
+
+                add_filter('theme_root', array(&amp;$this, '_theme_root'));
+
+                // clear caches
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                $GLOBALS['wp_theme_directories'] = $this-&gt;orig_theme_dir;
+                remove_filter('theme_root', array(&amp;$this, '_theme_root'));
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+                parent::tearDown();
+        }
+
+        // replace the normal theme root dir with our premade test dir
+        function _theme_root($dir) {
+                return $this-&gt;theme_root;
+        }
+
+        function _filter_out_themes_not_in_root( &amp;$themes ) {
+                foreach ( $themes as $key =&gt; $theme ) {
+                        if ( $theme-&gt;get_theme_root() != $this-&gt;theme_root )
+                                unset( $themes[ $key ] );
+                }
+        }
+
+        function test_theme_list() {
+                $themes = get_themes();
+                $this-&gt;_filter_out_themes_not_in_root( $themes );
+                $theme_names = array_keys( $themes );
+                $this-&gt;assertEquals(87, count( $theme_names ) );
+                $length = strlen( serialize( $themes ) );
+
+                //2.9 pre [12226]
+                $this-&gt;assertLessThanOrEqual(387283, $length );
+                //2.8.5
+                $this-&gt;assertLessThanOrEqual(368319, $length );
+                //2.9 post [12226]
+                $this-&gt;assertLessThanOrEqual(261998, $length );
+                //3.4 post [20029], #20103
+                $this-&gt;assertLessThanOrEqual(100000, $length );
+        }
+
+        /**
+         * Reducing in-memory size further.
+         *
+         * @ticket 11214
+         */
+        function test_smaller_storage() {
+                $themes = get_themes();
+                $this-&gt;_filter_out_themes_not_in_root( $themes );
+                $theme_names = array_keys($themes);
+                $this-&gt;assertEquals(87, count($theme_names));
+                $this-&gt;assertLessThanOrEqual(136342, strlen(serialize($themes)));
+        }
+}
</ins></span></pre></div>
<a id="trunkteststhemephpfromrev903trunkteststest_includes_themephp"></a>
<div class="copfile"><h4>Copied: trunk/tests/theme.php (from rev 903, trunk/tests/test_includes_theme.php) (0 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/theme.php                                (rev 0)
+++ trunk/tests/theme.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -0,0 +1,244 @@
</span><ins>+&lt;?php
+
+/**
+ * test wp-includes/theme.php
+ *
+ * @group themes
+ */
+class Tests_Theme extends WP_UnitTestCase {
+
+        var $theme_slug = 'twentyeleven';
+        var $theme_name = 'Twenty Eleven';
+
+        function setUp() {
+                parent::setUp();
+                add_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+        }
+
+        function tearDown() {
+                remove_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
+                wp_clean_themes_cache();
+                unset( $GLOBALS['wp_themes'] );
+                parent::tearDown();
+        }
+
+        function test_wp_get_themes_default() {
+                $themes = wp_get_themes();
+                $this-&gt;assertInstanceOf( 'WP_Theme', $themes[ $this-&gt;theme_slug ] );
+                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_slug ]-&gt;get('Name') );
+
+                $single_theme = wp_get_theme( $this-&gt;theme_slug );
+                $this-&gt;assertEquals( $single_theme-&gt;get('Name'), $themes[ $this-&gt;theme_slug ]-&gt;get('Name') );
+                $this-&gt;assertEquals( $themes[ $this-&gt;theme_slug ], $single_theme );
+        }
+
+        function test_get_themes_default() {
+                $themes = get_themes();
+                $this-&gt;assertInstanceOf( 'WP_Theme', $themes[ $this-&gt;theme_name ] );
+                $this-&gt;assertEquals( $themes[ $this-&gt;theme_name ], get_theme( $this-&gt;theme_name ) );
+
+                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]['Name'] );
+                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]-&gt;Name );
+                $this-&gt;assertEquals( $this-&gt;theme_name, $themes[ $this-&gt;theme_name ]-&gt;name );
+        }
+
+        function test_get_theme() {
+                $themes = get_themes();
+                foreach (array_keys($themes) as $name) {
+                        $theme = get_theme($name);
+                        // WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array().
+                        $this-&gt;assertFalse( is_array( $theme ) );
+                        $this-&gt;assertInstanceOf( 'WP_Theme', $theme );
+                        $this-&gt;assertEquals($theme, $themes[$name]);
+                }
+        }
+
+        function test_wp_get_theme() {
+                $themes = wp_get_themes();
+                foreach ( $themes as $theme ) {
+                        $this-&gt;assertInstanceOf( 'WP_Theme', $theme );
+                        $this-&gt;assertFalse( $theme-&gt;errors() );
+                        $_theme = wp_get_theme( $theme-&gt;get_stylesheet() );
+                        // This primes internal WP_Theme caches for the next assertion (headers_sanitized, textdomain_loaded)
+                        $this-&gt;assertEquals( $theme-&gt;get('Name'), $_theme-&gt;get('Name') );
+                        $this-&gt;assertEquals( $theme, $_theme );
+                }
+        }
+
+        function test_get_themes_contents() {
+                $themes = get_themes();
+
+                // Generic tests that should hold true for any theme
+                foreach ($themes as $k=&gt;$theme) {
+                        $this-&gt;assertEquals($theme['Name'], $k);
+                        $this-&gt;assertTrue(!empty($theme['Title']));
+
+                        // important attributes should all be set
+                        $default_headers = array(
+                                'Title' =&gt; 'Theme Title',
+                                'Version' =&gt; 'Version',
+                                'Parent Theme' =&gt; 'Parent Theme',
+                                'Template Dir' =&gt; 'Template Dir',
+                                'Stylesheet Dir' =&gt; 'Stylesheet Dir',
+                                'Template' =&gt; 'Template',
+                                'Stylesheet' =&gt; 'Stylesheet',
+                                'Screenshot' =&gt; 'Screenshot',
+                                'Description' =&gt; 'Description',
+                                'Author' =&gt; 'Author',
+                                'Tags' =&gt; 'Tags',
+                                // Introduced in WordPress 2.9
+                                'Theme Root' =&gt; 'Theme Root',
+                                'Theme Root URI' =&gt; 'Theme Root URI'
+                        );
+                        foreach ($default_headers as $name =&gt; $value) {
+                                $this-&gt;assertTrue(isset($theme[$name]));
+                        }
+
+                        // Make the tests work both for WordPress 2.8.5 and WordPress 2.9-rare
+                        $dir = isset($theme['Theme Root']) ? '' : WP_CONTENT_DIR;
+
+                        // important attributes should all not be empty as well
+                        $this-&gt;assertTrue(!empty($theme['Description']));
+                        $this-&gt;assertTrue(!empty($theme['Author']));
+                        $this-&gt;assertTrue(is_numeric($theme['Version']));
+                        $this-&gt;assertTrue(!empty($theme['Template']));
+                        $this-&gt;assertTrue(!empty($theme['Stylesheet']));
+
+                        // template files should all exist
+                        $this-&gt;assertTrue(is_array($theme['Template Files']));
+                        $this-&gt;assertTrue(count($theme['Template Files']) &gt; 0);
+                        foreach ($theme['Template Files'] as $file) {
+                                $this-&gt;assertTrue(is_file($dir . $file));
+                                $this-&gt;assertTrue(is_readable($dir . $file));
+                        }
+
+                        // css files should all exist
+                        $this-&gt;assertTrue(is_array($theme['Stylesheet Files']));
+                        $this-&gt;assertTrue(count($theme['Stylesheet Files']) &gt; 0);
+                        foreach ($theme['Stylesheet Files'] as $file) {
+                                $this-&gt;assertTrue(is_file($dir . $file));
+                                $this-&gt;assertTrue(is_readable($dir . $file));
+                        }
+
+                        $this-&gt;assertTrue(is_dir($dir . $theme['Template Dir']));
+                        $this-&gt;assertTrue(is_dir($dir . $theme['Stylesheet Dir']));
+
+                        $this-&gt;assertEquals('publish', $theme['Status']);
+
+                        $this-&gt;assertTrue(is_file($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
+                        $this-&gt;assertTrue(is_readable($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
+                }
+        }
+
+        /**
+         * @ticket 20897
+         */
+        function test_extra_theme_headers() {
+                $wp_theme = wp_get_theme( $this-&gt;theme_slug );
+                $this-&gt;assertNotEmpty( $wp_theme-&gt;get('License') );
+                $path_to_style_css = $wp_theme-&gt;get_theme_root() . '/' . $wp_theme-&gt;get_stylesheet() . '/style.css';
+                $this-&gt;assertTrue( file_exists( $path_to_style_css ) );
+                $theme_data = get_theme_data( $path_to_style_css );
+                $this-&gt;assertArrayHasKey( 'License', $theme_data );
+                $this-&gt;assertArrayNotHasKey( 'Not a Valid Key', $theme_data );
+                $this-&gt;assertNotEmpty( $theme_data['License'] );
+                $this-&gt;assertSame( $theme_data['License'], $wp_theme-&gt;get('License') );
+        }
+
+        function _theme_data_extra_headers() {
+                return array( 'License' );
+        }
+
+        function test_switch_theme() {
+                $themes = get_themes();
+
+                $switch_theme_one_argument = version_compare( $GLOBALS['wp_version'], '3.5-alpha-21103', '&gt;=' );
+
+                // switch to each theme in sequence
+                // do it twice to make sure we switch to the first theme, even if it's our starting theme
+                for ( $i = 0; $i &lt; 3; $i++ ) {
+                        foreach ($themes as $name=&gt;$theme) {
+                                // switch to this theme
+                                if ( $i === 2 || $switch_theme_one_argument )
+                                        switch_theme( $theme['Template'], $theme['Stylesheet'] );
+                                else
+                                        switch_theme( $theme['Stylesheet'] );
+
+                                $this-&gt;assertEquals($name, get_current_theme());
+
+                                // make sure the various get_* functions return the correct values
+                                $this-&gt;assertEquals($theme['Template'], get_template());
+                                $this-&gt;assertEquals($theme['Stylesheet'], get_stylesheet());
+
+                                $root_fs = get_theme_root();
+                                $this-&gt;assertTrue(is_dir($root_fs));
+
+                                $root_uri = get_theme_root_uri();
+                                $this-&gt;assertTrue(!empty($root_uri));
+
+                                $this-&gt;assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
+                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
+                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
+#                                $this-&gt;assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
+
+                                $this-&gt;assertEquals($root_fs . '/' . get_template(), get_template_directory());
+                                $this-&gt;assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
+
+                                //get_query_template
+
+                                // template file that doesn't exist
+                                $this-&gt;assertEquals('', get_query_template(rand_str()));
+
+                                // template files that do exist
+                                //foreach ($theme['Template Files'] as $path) {
+                                //$file = basename($path, '.php');
+                                // FIXME: untestable because get_query_template uses TEMPLATEPATH
+                                //$this-&gt;assertEquals('', get_query_template($file));
+                                //}
+
+                                // these are kind of tautologies but at least exercise the code
+                                $this-&gt;assertEquals(get_404_template(), get_query_template('404'));
+                                $this-&gt;assertEquals(get_archive_template(), get_query_template('archive'));
+                                $this-&gt;assertEquals(get_author_template(), get_query_template('author'));
+                                $this-&gt;assertEquals(get_category_template(), get_query_template('category'));
+                                $this-&gt;assertEquals(get_date_template(), get_query_template('date'));
+                                $this-&gt;assertEquals(get_home_template(), get_query_template('home', array('home.php','index.php')));
+                                $this-&gt;assertEquals(get_page_template(), get_query_template('page'));
+                                $this-&gt;assertEquals(get_paged_template(), get_query_template('paged'));
+                                $this-&gt;assertEquals(get_search_template(), get_query_template('search'));
+                                $this-&gt;assertEquals(get_single_template(), get_query_template('single'));
+                                $this-&gt;assertEquals(get_attachment_template(), get_query_template('attachment'));
+
+                                // this one doesn't behave like the others
+                                if (get_query_template('comments-popup'))
+                                        $this-&gt;assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
+                                else
+                                        $this-&gt;assertEquals(get_comments_popup_template(), ABSPATH.'wp-includes/theme-compat/comments-popup.php');
+
+                                $this-&gt;assertEquals(get_tag_template(), get_query_template('tag'));
+
+                                // nb: this probably doesn't run because WP_INSTALLING is defined
+                                $this-&gt;assertTrue(validate_current_theme());
+                        }
+                }
+        }
+
+        function test_switch_theme_bogus() {
+                // try switching to a theme that doesn't exist
+                $template = rand_str();
+                $style = rand_str();
+                update_option('template', $template);
+                update_option('stylesheet', $style);
+
+                $theme = wp_get_theme();
+                $this-&gt;assertEquals( $style, (string) $theme );
+                $this-&gt;assertNotSame( false, $theme-&gt;errors() );
+                $this-&gt;assertFalse( $theme-&gt;exists() );
+
+                // these return the bogus name - perhaps not ideal behaviour?
+                $this-&gt;assertEquals($template, get_template());
+                $this-&gt;assertEquals($style, get_stylesheet());
+        }
+}
</ins></span></pre></div>
<a id="trunktestsuserphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/user.php (908 => 909)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/user.php        2012-07-18 22:35:42 UTC (rev 908)
+++ trunk/tests/user.php        2012-07-19 01:52:37 UTC (rev 909)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> /**
</span><span class="cx">  * @group user
</span><span class="cx">  */
</span><del>-class Tests_User_User extends WP_UnitTestCase {
</del><ins>+class Tests_User extends WP_UnitTestCase {
</ins><span class="cx"> 
</span><span class="cx">         protected $_deprecated_errors = array();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>