<!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>[47338] branches/3.8: Build/Test Tools: Fix the Travis CI build for the 3.8 branch.</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 { white-space: pre-line; 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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/47338">47338</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/47338","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-02-21 13:05:39 +0000 (Fri, 21 Feb 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Build/Test Tools: Fix the Travis CI build for the 3.8 branch.
Among other fixes, this backports <a href="https://core.trac.wordpress.org/changeset/26871">[26871]</a>, [26909-26910], <a href="https://core.trac.wordpress.org/changeset/26940">[26940]</a>, <a href="https://core.trac.wordpress.org/changeset/27086">[27086]</a>, <a href="https://core.trac.wordpress.org/changeset/27168">[27168]</a>, <a href="https://core.trac.wordpress.org/changeset/28799">[28799]</a>, <a href="https://core.trac.wordpress.org/changeset/28873">[28873]</a>, <a href="https://core.trac.wordpress.org/changeset/28943">[28943]</a>, <a href="https://core.trac.wordpress.org/changeset/28961">[28961]</a>, <a href="https://core.trac.wordpress.org/changeset/28964">[28964]</a>, [28966-28967], <a href="https://core.trac.wordpress.org/changeset/29120">[29120]</a>, <a href="https://core.trac.wordpress.org/changeset/29251">[29251]</a>, <a href="https://core.trac.wordpress.org/changeset/29503">[29503]</a>, <a href="https://core.trac.wordpress.org/changeset/29860">[29860]</a>, <a href="ht
tps://core.trac.wordpress.org/changeset/29869">[29869]</a>, <a href="https://core.trac.wordpress.org/changeset/29954">[29954]</a>, <a href="https://core.trac.wordpress.org/changeset/30001">[30001]</a>, <a href="https://core.trac.wordpress.org/changeset/30160">[30160]</a>, <a href="https://core.trac.wordpress.org/changeset/30282">[30282]</a>, <a href="https://core.trac.wordpress.org/changeset/30285">[30285]</a>, [30289-30291], [30513-30514], [30516-30521], <a href="https://core.trac.wordpress.org/changeset/30524">[30524]</a>, <a href="https://core.trac.wordpress.org/changeset/30526">[30526]</a>, [30529-30530], [31253-31254], [31257-31259], <a href="https://core.trac.wordpress.org/changeset/31622">[31622]</a>, <a href="https://core.trac.wordpress.org/changeset/40241">[40241]</a>, <a href="https://core.trac.wordpress.org/changeset/40255">[40255]</a>, <a href="https://core.trac.wordpress.org/changeset/40257">[40257]</a>, <a href="https://core.trac.wordpress.org/changeset/40259">[40259]<
/a>, <a href="https://core.trac.wordpress.org/changeset/40269">[40269]</a>, <a href="https://core.trac.wordpress.org/changeset/40271">[40271]</a>, <a href="https://core.trac.wordpress.org/changeset/40446">[40446]</a>, <a href="https://core.trac.wordpress.org/changeset/40449">[40449]</a>, <a href="https://core.trac.wordpress.org/changeset/40457">[40457]</a>, <a href="https://core.trac.wordpress.org/changeset/40604">[40604]</a>, <a href="https://core.trac.wordpress.org/changeset/40538">[40538]</a>, <a href="https://core.trac.wordpress.org/changeset/40833">[40833]</a>, <a href="https://core.trac.wordpress.org/changeset/41082">[41082]</a>, <a href="https://core.trac.wordpress.org/changeset/41303">[41303]</a>, <a href="https://core.trac.wordpress.org/changeset/41306">[41306]</a>, <a href="https://core.trac.wordpress.org/changeset/44993">[44993]</a>.
See <a href="https://core.trac.wordpress.org/ticket/49485">#49485</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches38travisyml">branches/3.8/.travis.yml</a></li>
<li><a href="#branches38Gruntfilejs">branches/3.8/Gruntfile.js</a></li>
<li><a href="#branches38packagejson">branches/3.8/package.json</a></li>
<li><a href="#branches38phpunitxmldist">branches/3.8/phpunit.xml.dist</a></li>
<li><a href="#branches38testsphpunitincludesbootstrapphp">branches/3.8/tests/phpunit/includes/bootstrap.php</a></li>
<li><a href="#branches38testsphpunitincludestestcasephp">branches/3.8/tests/phpunit/includes/testcase.php</a></li>
<li><a href="#branches38testsphpunitincludestracphp">branches/3.8/tests/phpunit/includes/trac.php</a></li>
<li><a href="#branches38testsphpunitincludesutilsphp">branches/3.8/tests/phpunit/includes/utils.php</a></li>
<li><a href="#branches38testsphpunitmultisitexml">branches/3.8/tests/phpunit/multisite.xml</a></li>
<li><a href="#branches38testsphpunittestsajaxDeleteCommentphp">branches/3.8/tests/phpunit/tests/ajax/DeleteComment.php</a></li>
<li><a href="#branches38testsphpunittestsajaxDimCommentphp">branches/3.8/tests/phpunit/tests/ajax/DimComment.php</a></li>
<li><a href="#branches38testsphpunittestsajaxMediaEditphp">branches/3.8/tests/phpunit/tests/ajax/MediaEdit.php</a></li>
<li><a href="#branches38testsphpunittestsajaxReplytoCommentphp">branches/3.8/tests/phpunit/tests/ajax/ReplytoComment.php</a></li>
<li><a href="#branches38testsphpunittestsbasicphp">branches/3.8/tests/phpunit/tests/basic.php</a></li>
<li><a href="#branches38testsphpunittestscanonicalcustomRulesphp">branches/3.8/tests/phpunit/tests/canonical/customRules.php</a></li>
<li><a href="#branches38testsphpunittestscanonicalpageOnFrontphp">branches/3.8/tests/phpunit/tests/canonical/pageOnFront.php</a></li>
<li><a href="#branches38testsphpunittestscanonicalphp">branches/3.8/tests/phpunit/tests/canonical.php</a></li>
<li><a href="#branches38testsphpunittestsdependenciesscriptsphp">branches/3.8/tests/phpunit/tests/dependencies/scripts.php</a></li>
<li><a href="#branches38testsphpunittestsfeedrss2php">branches/3.8/tests/phpunit/tests/feed/rss2.php</a></li>
<li><a href="#branches38testsphpunittestsfiltersphp">branches/3.8/tests/phpunit/tests/filters.php</a></li>
<li><a href="#branches38testsphpunittestsformattingEscUrlphp">branches/3.8/tests/phpunit/tests/formatting/EscUrl.php</a></li>
<li><a href="#branches38testsphpunittestsformattingMakeClickablephp">branches/3.8/tests/phpunit/tests/formatting/MakeClickable.php</a></li>
<li><a href="#branches38testsphpunittestsformattingSanitizeTitleWithDashesphp">branches/3.8/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php</a></li>
<li><a href="#branches38testsphpunittestsformattingSanitizeUserphp">branches/3.8/tests/phpunit/tests/formatting/SanitizeUser.php</a></li>
<li><a href="#branches38testsphpunittestsfunctionsdeprecatedphp">branches/3.8/tests/phpunit/tests/functions/deprecated.php</a></li>
<li><a href="#branches38testsphpunittestsfunctionsphp">branches/3.8/tests/phpunit/tests/functions.php</a></li>
<li><a href="#branches38testsphpunittestshttpbasephp">branches/3.8/tests/phpunit/tests/http/base.php</a></li>
<li><a href="#branches38testsphpunittestshttpfunctionsphp">branches/3.8/tests/phpunit/tests/http/functions.php</a></li>
<li><a href="#branches38testsphpunittestsimagebasephp">branches/3.8/tests/phpunit/tests/image/base.php</a></li>
<li><a href="#branches38testsphpunittestsimageeditor_gdphp">branches/3.8/tests/phpunit/tests/image/editor_gd.php</a></li>
<li><a href="#branches38testsphpunittestsimageeditor_imagickphp">branches/3.8/tests/phpunit/tests/image/editor_imagick.php</a></li>
<li><a href="#branches38testsphpunittestsimagefunctionsphp">branches/3.8/tests/phpunit/tests/image/functions.php</a></li>
<li><a href="#branches38testsphpunittestsimageintermediate_sizephp">branches/3.8/tests/phpunit/tests/image/intermediate_size.php</a></li>
<li><a href="#branches38testsphpunittestsimageresizephp">branches/3.8/tests/phpunit/tests/image/resize.php</a></li>
<li><a href="#branches38testsphpunittestsimageresize_gdphp">branches/3.8/tests/phpunit/tests/image/resize_gd.php</a></li>
<li><a href="#branches38testsphpunittestsimageresize_imagickphp">branches/3.8/tests/phpunit/tests/image/resize_imagick.php</a></li>
<li><a href="#branches38testsphpunittestsl10nphp">branches/3.8/tests/phpunit/tests/l10n.php</a></li>
<li><a href="#branches38testsphpunittestslinkphp">branches/3.8/tests/phpunit/tests/link.php</a></li>
<li><a href="#branches38testsphpunittestsmailphp">branches/3.8/tests/phpunit/tests/mail.php</a></li>
<li><a href="#branches38testsphpunittestsmediaphp">branches/3.8/tests/phpunit/tests/media.php</a></li>
<li><a href="#branches38testsphpunittestsoptionblogOptionphp">branches/3.8/tests/phpunit/tests/option/blogOption.php</a></li>
<li><a href="#branches38testsphpunittestspostattachmentsphp">branches/3.8/tests/phpunit/tests/post/attachments.php</a></li>
<li><a href="#branches38testsphpunittestspostfilteringphp">branches/3.8/tests/phpunit/tests/post/filtering.php</a></li>
<li><a href="#branches38testsphpunittestspostrevisionsphp">branches/3.8/tests/phpunit/tests/post/revisions.php</a></li>
<li><a href="#branches38testsphpunittestspostphp">branches/3.8/tests/phpunit/tests/post.php</a></li>
<li><a href="#branches38testsphpunittestsqueryconditionalsphp">branches/3.8/tests/phpunit/tests/query/conditionals.php</a></li>
<li><a href="#branches38testsphpunittestsqueryresultsphp">branches/3.8/tests/phpunit/tests/query/results.php</a></li>
<li><a href="#branches38testsphpunittestsquerytaxQueryphp">branches/3.8/tests/phpunit/tests/query/taxQuery.php</a></li>
<li><a href="#branches38testsphpunittestsqueryverboseRewriteRulesphp">branches/3.8/tests/phpunit/tests/query/verboseRewriteRules.php</a></li>
<li><a href="#branches38testsphpunittestsqueryphp">branches/3.8/tests/phpunit/tests/query.php</a></li>
<li><a href="#branches38testsphpunittestsrewritephp">branches/3.8/tests/phpunit/tests/rewrite.php</a></li>
<li><a href="#branches38testsphpunittestsshortcodephp">branches/3.8/tests/phpunit/tests/shortcode.php</a></li>
<li><a href="#branches38testsphpunitteststaxonomyphp">branches/3.8/tests/phpunit/tests/taxonomy.php</a></li>
<li><a href="#branches38testsphpunitteststermphp">branches/3.8/tests/phpunit/tests/term.php</a></li>
<li><a href="#branches38testsphpunittestsuserphp">branches/3.8/tests/phpunit/tests/user.php</a></li>
<li><a href="#branches38testsphpunittestsxmlrpcwpuploadFilephp">branches/3.8/tests/phpunit/tests/xmlrpc/wp/uploadFile.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branches38testsphpunitdatathemedir1brokenthemenodelete">branches/3.8/tests/phpunit/data/themedir1/broken-theme/.nodelete</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#branches38testsphpunittestscanonicalpermalinkFormatsphp">branches/3.8/tests/phpunit/tests/canonical/permalinkFormats.php</a></li>
<li><a href="#branches38testsphpunittestsexportclasswpexportqueryphp">branches/3.8/tests/phpunit/tests/export/class-wp-export-query.php</a></li>
<li><a href="#branches38testsphpunittestsexportfunctionsexportphp">branches/3.8/tests/phpunit/tests/export/functions.export.php</a></li>
<li><a href="#branches38testsphpunittestsexportwritersphp">branches/3.8/tests/phpunit/tests/export/writers.php</a></li>
<li><a href="#branches38testsphpunittestsiteratorsphp">branches/3.8/tests/phpunit/tests/iterators.php</a></li>
<li><a href="#branches38testsphpunittestspostgalleryphp">branches/3.8/tests/phpunit/tests/post/gallery.php</a></li>
<li><a href="#branches38testsphpunittestsuploadphp">branches/3.8/tests/phpunit/tests/upload.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches38">branches/3.8/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/3.8
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/3.8 2020-02-21 10:46:53 UTC (rev 47337)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/3.8 2020-02-21 13:05:39 UTC (rev 47338)
</ins><a id="branches38"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/3.8</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/4.8:42478
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:42434
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43988,43994,44014,44017,44047
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:26864,26874-26875,26885,26887-26888,26905,26919-26925,26928-26929,26932,26935,26952,26959,26961,26967,26970,26993,26999,27006-27007,27012,27021,27119,27134,27385,27511,27760,27822,27872,27905-27906,27928,27964,27975,27990,28053,28113,28129,29327,29378,29381-29382,29397,29404,29631,29783,30412,30417,30425,30430,30435,30438,30443,30458,30466,33124,33142,36083,36435,37651,38524,39645,39659,39759,39772,39795,39807-39808,39831,39850,39956,40148,40169,40183,40400,40604,40677,40692,40704,40723,40736,41393,41398,41457,41470,41483,41496,41522,41662,42056,42119-42120,42258-42261,42424,42433,42892-42893,44021,44048,44842,45936,45971,45997,46474-46478,46483,46485,46895
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:26864,26871,26874-26875,26885,26887-26888,26905,26909-26910,26919-26925,26928-26929,26932,26935,26940,26952,26959,26961,26967,26970,26993,26999,27006-27007,27012,27021,27086,27119,27134,27168,27385,27511,27760,27822,27872,27905-27906,27928,27964,27975,27990,28053,28113,28129,28799,28873,28943,28961,28964,28966-28967,29120,29251,29327,29378,29381-29382,29397,29404,29503,29631,29783,29860,29869,29954,30001,30160,30282,30285,30289-30291,30412,30417,30425,30430,30435,30438,30443,30458,30466,30513-30514,30516-30521,30524,30526,30529-30530,31253-31254,31257-31259,31622,33124,33142,36083,36435,37651,38524,39645,39659,39759,39772,39795,39807-39808,39831,39850,39956,40148,40169,40183,40241,40255,40257,40259,40269,40271,40400,40446,40449,40457,40538,40604,40677,40692,40704,40723,40736,40833,41082,41303,41306,41393,41398,41457,41470,41483,41496,41522,41662,42056,42119-42120,42258-42261,42424
,42433,42892-42893,44021,44048,44842,44993,45936,45971,45997,46474-46478,46483,46485,46895
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches38travisyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/.travis.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/.travis.yml 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/.travis.yml 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,26 +1,91 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Travis CI Configuration File
+sudo: false
+dist: trusty
</ins><span class="cx" style="display: block; padding: 0 10px"> language: php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+cache:
+ directories:
+ - $HOME/.npm
+ - vendor
+ - $HOME/.composer/cache
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-php:
- - "5.5"
- - "5.2"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Build matrix options
+matrix:
+ include:
+ - php: 5.5
+ env: WP_TRAVISCI=travis:js
+ - php: 5.5
+ env: WP_TRAVISCI=travis:phpunit
+ - php: 5.2
+ env: WP_TRAVISCI=travis:phpunit
+ dist: precise
+ fast_finish: true
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Before install, failures in this section will result in build status 'errored'
+before_install:
+ - WP_CORE_DIR=/tmp/wordpress/
+ - >
+ if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
+ mysql -e "CREATE DATABASE wordpress_tests;" -uroot
+ cp wp-tests-config-sample.php wp-tests-config.php
+ sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
+ sed -i "s/yourusernamehere/travis/" wp-tests-config.php
+ sed -i "s/yourpasswordhere//" wp-tests-config.php
+ svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
+ fi
+
+# Before script, failures in this section will result in build status 'failed'
</ins><span class="cx" style="display: block; padding: 0 10px"> before_script:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- - |
- stable='^[0-9\.]+$';
- if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
- phpenv config-rm xdebug.ini
- fi
- - mysql -e "CREATE DATABASE wordpress_tests;" -uroot
- - cp wp-tests-config-sample.php wp-tests-config.php
- - sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
- - sed -i "s/yourusernamehere/travis/" wp-tests-config.php
- - sed -i "s/yourpasswordhere//" wp-tests-config.php
- - svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
- - npm install -g grunt-cli
- - npm install
- - php --version
-
-script: grunt test
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+- |
+ # Remove Xdebug for a huge performance increase, but not from nightly:
+ stable='^[0-9\.]+$'
+ if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
+ phpenv config-rm xdebug.ini
+ fi
+- |
+ # Export Composer's global bin dir to PATH, but not on PHP 5.2:
+ if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
+ composer config --list --global
+ export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
+ fi
+- |
+ # Install the specified version of PHPUnit depending on the PHP version:
+ if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
+ case "$TRAVIS_PHP_VERSION" in
+ 7.1|7.0|nightly)
+ echo "Using PHPUnit 5.x"
+ composer global require "phpunit/phpunit:^5"
+ ;;
+ 5.6|5.5|5.4|5.3)
+ echo "Using PHPUnit 4.x"
+ composer global require "phpunit/phpunit:^4"
+ ;;
+ 5.2)
+ # Do nothing, use default PHPUnit 3.6.x
+ echo "Using default PHPUnit, hopefully 3.6"
+ ;;
+ *)
+ echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
+ exit 1
+ ;;
+ esac
+ fi
+- npm --version
+- node --version
+- nvm install 0.10.48
+- npm install -g grunt-cli
+- npm install
+- npm prune
+- php --version
+- php -m
+- npm --version
+- node --version
+- which phpunit
+- phpunit --version
+- curl --version
+- grunt --version
+- git --version
+- svn --version
+script: grunt $WP_TRAVISCI
</ins><span class="cx" style="display: block; padding: 0 10px"> notifications:
</span><span class="cx" style="display: block; padding: 0 10px"> slack:
</span><span class="cx" style="display: block; padding: 0 10px"> rooms:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,4 +93,3 @@
</span><span class="cx" style="display: block; padding: 0 10px"> on_start: never
</span><span class="cx" style="display: block; padding: 0 10px"> on_failure: always
</span><span class="cx" style="display: block; padding: 0 10px"> on_success: change
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- on_pull_requests: false
</del></span></pre></div>
<a id="branches38Gruntfilejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/Gruntfile.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/Gruntfile.js 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/Gruntfile.js 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -359,9 +359,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Register tasks.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Copy task.
- grunt.registerTask('copy:all', ['copy:files', 'copy:version']);
-
</del><span class="cx" style="display: block; padding: 0 10px"> // RTL task.
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('rtl', ['cssjanus:core', 'cssjanus:colors']);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -368,6 +365,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Color schemes task.
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('colors', ['sass:colors']);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // JSHint task.
+ grunt.registerTask('jshint:corejs', ['jshint:grunt', 'jshint:tests', 'jshint:themes', 'jshint:core']);
+
+ // Copy task.
+ grunt.registerTask('copy:all', ['copy:files', 'copy:version']);
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Build task.
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'colors', 'rtl', 'cssmin:rtl', 'cssmin:colors',
</span><span class="cx" style="display: block; padding: 0 10px"> 'uglify:core', 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -383,8 +386,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
</span><span class="cx" style="display: block; padding: 0 10px"> ['build', 'copy:qunit', 'qunit']);
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Travis CI tasks.
+ grunt.registerTask('travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]);
+ grunt.registerTask('travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit');
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Default task.
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask('default', ['build']);
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38packagejson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/package.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/package.json 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/package.json 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,16 +11,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "devDependencies": {
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt": "~0.4.1",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-clean": "~0.5.0",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-contrib-compress": "~0.5.2",
+ "grunt-contrib-concat": "~0.3.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-copy": "~0.4.1",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-cssmin": "~0.6.1",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-contrib-jshint": "~0.10.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-qunit": "~0.2.2",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-uglify": "~0.2.2",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-watch": "~0.5.1",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "grunt-contrib-compress": "~0.5.2",
- "grunt-contrib-concat": "~0.3.0",
- "grunt-contrib-jshint": "~0.7.0",
</del><span class="cx" style="display: block; padding: 0 10px"> "grunt-cssjanus": "git://github.com/yoavf/grunt-cssjanus.git#e0158f4087d1c4bb5a8d1648a63ef133338b5879",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "grunt-sass": "~1.0.0",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-sass": "~0.16.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "matchdep": "~0.1.2"
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38phpunitxmldist"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/phpunit.xml.dist</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/phpunit.xml.dist 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/phpunit.xml.dist 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,4 +25,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <logging>
</span><span class="cx" style="display: block; padding: 0 10px"> <log type="junit" target="tests/phpunit/build/logs/junit.xml" logIncompleteSkipped="false"/>
</span><span class="cx" style="display: block; padding: 0 10px"> </logging>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <php>
+ <const name="WP_RUN_CORE_TESTS" value="1" />
+ </php>
</ins><span class="cx" style="display: block; padding: 0 10px"> </phpunit>
</span></span></pre></div>
<a id="branches38testsphpunitdatathemedir1brokenthemenodelete"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/3.8/tests/phpunit/data/themedir1/broken-theme/.nodelete</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">Modified: branches/3.8/tests/phpunit/includes/bootstrap.php
===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/3.8/tests/phpunit/includes/bootstrap.php 2020-02-21 10:46:53 UTC (rev 47337)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/3.8/tests/phpunit/includes/bootstrap.php 2020-02-21 13:05:39 UTC (rev 47338)
</ins><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,8 +95,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * A child class of the PHP test runner.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Not actually used as a runner. Rather, used to access the protected
- * longOptions property, to parse the arguments passed to the script.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Used to access the protected longOptions property, to parse the arguments
+ * passed to the script.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * If it is determined that phpunit was called with a --group that corresponds
</span><span class="cx" style="display: block; padding: 0 10px"> * to an @ticket annotation (such as `phpunit --group 12345` for bugs marked
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,15 +105,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then
</span><span class="cx" style="display: block; padding: 0 10px"> * how you call phpunit has no effect.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
+ protected $longOptions = array(
+ 'exclude-group=',
+ 'group=',
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> function __construct( $argv ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $options = PHPUnit_Util_Getopt::getopt(
- $argv,
- 'd:c:hv',
- array_keys( $this->longOptions )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array_shift( $argv );
+ $options = array();
+ while ( list( $i, $arg ) = each( $argv ) ) {
+ try {
+ if ( strlen( $arg ) > 1 && $arg[0] === '-' && $arg[1] === '-' ) {
+ PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );
+ }
+ }
+ catch ( PHPUnit_Framework_Exception $e ) {
+ // Enforcing recognized arguments or correctly formed arguments is
+ // not really the concern here.
+ continue;
+ }
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $ajax_message = true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $options[0] as $option ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $options as $option ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> switch ( $option[0] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> case '--exclude-group' :
</span><span class="cx" style="display: block; padding: 0 10px"> $ajax_message = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,15 +135,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case '--group' :
</span><span class="cx" style="display: block; padding: 0 10px"> $groups = explode( ',', $option[1] );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $groups as $group ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> WP_UnitTestCase::forceTicket( $group );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $ajax_message = ! in_array( 'ajax', $groups );
</span><span class="cx" style="display: block; padding: 0 10px"> continue 2;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $ajax_message )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $ajax_message ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-new WP_PHPUnit_TextUI_Command( $_SERVER['argv'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
</ins></span></pre></div>
<a id="branches38testsphpunitincludestestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/includes/testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/includes/testcase.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/includes/testcase.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,45 +9,162 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $expected_deprecated = array();
</span><span class="cx" style="display: block; padding: 0 10px"> protected $caught_deprecated = array();
</span><span class="cx" style="display: block; padding: 0 10px"> protected $expected_doing_it_wrong = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $caught_doing_it_wrong = array();
-
- /**
- * @var WP_UnitTest_Factory
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected $caught_doing_it_wrong = array();
+
+ protected static $hooks_saved = array();
+ protected static $ignore_files;
+
+ /**
+ * @var WP_UnitTest_Factory
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected $factory;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function setUp() {
- set_time_limit(0);
-
- global $wpdb;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function setUp() {
+ set_time_limit(0);
+
+ if ( ! self::$ignore_files ) {
+ self::$ignore_files = $this->scan_user_uploads();
+ }
+
+ if ( ! self::$hooks_saved ) {
+ $this->_backup_hooks();
+ }
+
+ global $wpdb;
</ins><span class="cx" style="display: block; padding: 0 10px"> $wpdb->suppress_errors = false;
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->show_errors = true;
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->db_connect();
</span><span class="cx" style="display: block; padding: 0 10px"> ini_set('display_errors', 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->factory = new WP_UnitTest_Factory;
- $this->clean_up_global_scope();
- $this->start_transaction();
- $this->expectDeprecated();
- add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->factory = new WP_UnitTest_Factory;
+ $this->clean_up_global_scope();
+
+ /*
+ * When running core tests, ensure that post types and taxonomies
+ * are reset for each test. We skip this step for non-core tests,
+ * given the large number of plugins that register post types and
+ * taxonomies at 'init'.
+ */
+ if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+ $this->reset_post_types();
+ $this->reset_taxonomies();
+ }
+
+ $this->start_transaction();
+ $this->expectDeprecated();
+ add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
+ }
+
+ /**
+ * Unregister existing post types and register defaults.
+ *
+ * Run before each test in order to clean up the global scope, in case
+ * a test forgets to unregister a post type on its own, or fails before
+ * it has a chance to do so.
+ */
+ protected function reset_post_types() {
+ foreach ( get_post_types() as $pt ) {
+ _unregister_post_type( $pt );
+ }
+ create_initial_post_types();
+ }
+
+ /**
+ * Unregister existing taxonomies and register defaults.
+ *
+ * Run before each test in order to clean up the global scope, in case
+ * a test forgets to unregister a taxonomy on its own, or fails before
+ * it has a chance to do so.
+ */
+ protected function reset_taxonomies() {
+ foreach ( get_taxonomies() as $tax ) {
+ _unregister_taxonomy( $tax );
+ }
+ create_initial_taxonomies();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function tearDown() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->expectedDeprecated();
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->query( 'ROLLBACK' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'dbdelta_create_queries', array( $this, '_create_temporary_tables' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_multisite() ) {
+ while ( ms_is_switched() ) {
+ restore_current_blog();
+ }
+ }
+ remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
+ $this->_restore_hooks();
+ wp_set_current_user( 0 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function clean_up_global_scope() {
</span><span class="cx" style="display: block; padding: 0 10px"> $_GET = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->flush_cache();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function flush_cache() {
- global $wp_object_cache;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+ /**
+ * Allow tests to be skipped on some automated runs
+ *
+ * For test runs on Travis for something other than trunk/master
+ * we want to skip tests that only need to run for master.
+ */
+ public function skipOnAutomatedBranches() {
+ // gentenv can be disabled
+ if ( ! function_exists( 'getenv' ) ) {
+ return false;
+ }
+
+ // https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
+ $travis_branch = getenv( 'TRAVIS_BRANCH' );
+ $travis_pull_request = getenv( 'TRAVIS_PULL_REQUEST' );
+
+ if ( false !== $travis_pull_request && 'master' !== $travis_branch ) {
+ $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
+ }
+ }
+
+ /**
+ * Saves the action and filter-related globals so they can be restored later.
+ *
+ * Stores $merged_filters, $wp_actions, $wp_current_filter, and $wp_filter
+ * on a class variable so they can be restored on tearDown() using _restore_hooks().
+ *
+ * @global array $merged_filters
+ * @global array $wp_actions
+ * @global array $wp_current_filter
+ * @global array $wp_filter
+ * @return void
+ */
+ protected function _backup_hooks() {
+ $globals = array( 'merged_filters', 'wp_actions', 'wp_current_filter', 'wp_filter' );
+ foreach ( $globals as $key ) {
+ self::$hooks_saved[ $key ] = $GLOBALS[ $key ];
+ }
+ }
+
+ /**
+ * Restores the hook-related globals to their state at setUp()
+ * so that future tests aren't affected by hooks set during this last test.
+ *
+ * @global array $merged_filters
+ * @global array $wp_actions
+ * @global array $wp_current_filter
+ * @global array $wp_filter
+ * @return void
+ */
+ protected function _restore_hooks() {
+ $globals = array( 'merged_filters', 'wp_actions', 'wp_current_filter', 'wp_filter' );
+ foreach ( $globals as $key ) {
+ if ( isset( self::$hooks_saved[ $key ] ) ) {
+ $GLOBALS[ $key ] = self::$hooks_saved[ $key ];
+ }
+ }
+ }
+
+ function flush_cache() {
+ global $wp_object_cache;
</ins><span class="cx" style="display: block; padding: 0 10px"> $wp_object_cache->group_ops = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_object_cache->stats = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_object_cache->memcache_debug = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,17 +181,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->query( 'SET autocommit = 0;' );
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->query( 'START TRANSACTION;' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'dbdelta_create_queries', array( $this, '_create_temporary_tables' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'query', array( $this, '_create_temporary_tables' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'query', array( $this, '_drop_temporary_tables' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function _create_temporary_tables( $queries ) {
- return str_replace( 'CREATE TABLE', 'CREATE TEMPORARY TABLE', $queries );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function _create_temporary_tables( $query ) {
+ if ( 'CREATE TABLE' === substr( trim( $query ), 0, 12 ) )
+ return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 );
+ return $query;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function _drop_temporary_tables( $query ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'DROP TABLE' === substr( $query, 0, 10 ) )
- return 'DROP TEMPORARY TABLE ' . substr( $query, 10 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'DROP TABLE' === substr( trim( $query ), 0, 10 ) )
+ return substr_replace( trim( $query ), 'DROP TEMPORARY TABLE', 0, 10 );
</ins><span class="cx" style="display: block; padding: 0 10px"> return $query;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -203,10 +322,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp']->main($parts['query']);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected function checkRequirements() {
- parent::checkRequirements();
- if ( WP_TESTS_FORCE_KNOWN_BUGS )
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function checkRequirements() {
+ parent::checkRequirements();
+
+ // Core tests no longer check against open Trac tickets, but others using WP_UnitTestCase may do so.
+ if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+ return;
+ }
+
+ if ( WP_TESTS_FORCE_KNOWN_BUGS )
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> $tickets = PHPUnit_Util_Test::getTickets( get_class( $this ), $this->getName( false ) );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $tickets as $ticket ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_numeric( $ticket ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -229,7 +354,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function knownWPBug( $ticket_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! TracTickets::isTracTicketClosed( 'http://core.trac.wordpress.org', $ticket_id ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! TracTickets::isTracTicketClosed( 'https://core.trac.wordpress.org', $ticket_id ) )
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( sprintf( 'WordPress Ticket #%d is not fixed', $ticket_id ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -239,7 +364,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function knownUTBug( $ticket_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'UT' . $ticket_id, self::$forced_tickets ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! TracTickets::isTracTicketClosed( 'http://unit-tests.trac.wordpress.org', $ticket_id ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! TracTickets::isTracTicketClosed( 'https://unit-tests.trac.wordpress.org', $ticket_id ) )
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( sprintf( 'Unit Tests Ticket #%d is not fixed', $ticket_id ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,7 +374,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function knownPluginBug( $ticket_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets ) )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! TracTickets::isTracTicketClosed( 'http://plugins.trac.wordpress.org', $ticket_id ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! TracTickets::isTracTicketClosed( 'https://plugins.trac.wordpress.org', $ticket_id ) )
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( sprintf( 'WordPress Plugin Ticket #%d is not fixed', $ticket_id ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -325,6 +450,56 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $message .= implode( $not_true, ', ' ) . ' should be true. ';
</span><span class="cx" style="display: block; padding: 0 10px"> if ( count($not_false) )
</span><span class="cx" style="display: block; padding: 0 10px"> $message .= implode( $not_false, ', ' ) . ' should be false.';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertTrue( $passed, $message );
- }
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertTrue( $passed, $message );
+ }
+
+ function unlink( $file ) {
+ $exists = is_file( $file );
+ if ( $exists && ! in_array( $file, self::$ignore_files ) ) {
+ //error_log( $file );
+ unlink( $file );
+ } elseif ( ! $exists ) {
+ $this->fail( "Trying to delete a file that doesn't exist: $file" );
+ }
+ }
+
+ function rmdir( $path ) {
+ $files = $this->files_in_dir( $path );
+ foreach ( $files as $file ) {
+ if ( ! in_array( $file, self::$ignore_files ) ) {
+ $this->unlink( $file );
+ }
+ }
+ }
+
+ function remove_added_uploads() {
+ // Remove all uploads.
+ $uploads = wp_upload_dir();
+ $this->rmdir( $uploads['basedir'] );
+ }
+
+ function files_in_dir( $dir ) {
+ $files = array();
+
+ $iterator = new RecursiveDirectoryIterator( $dir );
+ $objects = new RecursiveIteratorIterator( $iterator );
+ foreach ( $objects as $name => $object ) {
+ if ( is_file( $name ) ) {
+ $files[] = $name;
+ }
+ }
+
+ return $files;
+ }
+
+ function scan_user_uploads() {
+ static $files = array();
+ if ( ! empty( $files ) ) {
+ return $files;
+ }
+
+ $uploads = wp_upload_dir();
+ $files = $this->files_in_dir( $uploads['basedir'] );
+ return $files;
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunitincludestracphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/includes/trac.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/includes/trac.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/includes/trac.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool|null true if the ticket is resolved, false if not resolved, null on error
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function isTracTicketClosed( $trac_url, $ticket_id ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! extension_loaded( 'openssl' ) ) {
+ $trac_url = preg_replace( "/^https:/", "http:", $trac_url );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( self::$trac_ticket_cache[ $trac_url ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // In case you're running the tests offline, keep track of open tickets.
</span><span class="cx" style="display: block; padding: 0 10px"> $file = DIR_TESTDATA . '/.trac-ticket-cache.' . str_replace( array( 'http://', 'https://', '/' ), array( '', '', '-' ), rtrim( $trac_url, '/' ) );
</span></span></pre></div>
<a id="branches38testsphpunitincludesutilsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/includes/utils.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/includes/utils.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/includes/utils.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,22 +332,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> fclose( $fp );
</span><span class="cx" style="display: block; padding: 0 10px"> return $data;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
-
-function _rmdir( $path ) {
- if ( in_array(basename( $path ), array( '.', '..' ) ) ) {
- return;
- } elseif ( is_file( $path ) ) {
- unlink( $path );
- } elseif ( is_dir( $path ) ) {
- foreach ( scandir( $path ) as $file )
- _rmdir( $path . '/' . $file );
- rmdir( $path );
- }
-}
-
-/**
- * Removes the post type and its taxonomy associations.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
+
+/**
+ * Removes the post type and its taxonomy associations.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _unregister_post_type( $cpt_name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $GLOBALS['wp_post_types'][ $cpt_name ] );
</span></span></pre></div>
<a id="branches38testsphpunitmultisitexml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/multisite.xml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/multisite.xml 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/multisite.xml 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,4 +25,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <group>ajax</group>
</span><span class="cx" style="display: block; padding: 0 10px"> </exclude>
</span><span class="cx" style="display: block; padding: 0 10px"> </groups>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <php>
+ <const name="WP_RUN_CORE_TESTS" value="1" />
+ </php>
</ins><span class="cx" style="display: block; padding: 0 10px"> </phpunit>
</span></span></pre></div>
<a id="branches38testsphpunittestsajaxDeleteCommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/ajax/DeleteComment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/ajax/DeleteComment.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/ajax/DeleteComment.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,7 +26,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px"> parent::setUp();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_id = $this->factory->post->create();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'comment_notification_recipients', '__return_empty_array' );
+ $user_id = $this->factory->user->create();
+ $post_id = $this->factory->post->create( array( 'post_author' => $user_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_comments = array_map( 'get_comment', $this->_comments );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsajaxDimCommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/ajax/DimComment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/ajax/DimComment.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/ajax/DimComment.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,7 +26,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px"> parent::setUp();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_id = $this->factory->post->create();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'comment_notification_recipients', '__return_empty_array' );
+ $user_id = $this->factory->user->create();
+ $post_id = $this->factory->post->create( array( 'post_author' => $user_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_comments = array_map( 'get_comment', $this->_comments );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsajaxMediaEditphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/ajax/MediaEdit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/ajax/MediaEdit.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/ajax/MediaEdit.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,17 +30,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Tear down the test fixture.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function tearDown() {
- // Cleanup
- foreach ($this->_ids as $id){
- wp_delete_attachment($id, true);
- }
-
- $uploads = wp_upload_dir();
- foreach ( scandir( $uploads['basedir'] ) as $file )
- _rmdir( $uploads['basedir'] . '/' . $file );
-
- parent::tearDown();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tearDown() {
+ // Cleanup
+ foreach ( $this->_ids as $id ) {
+ wp_delete_attachment( $id, true );
+ }
+
+ parent::tearDown();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="branches38testsphpunittestsajaxReplytoCommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/ajax/ReplytoComment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/ajax/ReplytoComment.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/ajax/ReplytoComment.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,7 +32,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px"> parent::setUp();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_id = $this->factory->post->create();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'comment_notification_recipients', '__return_empty_array' );
+ $user_id = $this->factory->user->create();
+ $post_id = $this->factory->post->create( array( 'post_author' => $user_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->factory->comment->create_post_comments( $post_id, 5 );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_comment_post = get_post( $post_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunittestsbasicphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/basic.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/basic.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/basic.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,6 +22,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue($this->val);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_license() {
+ // This test is designed to only run on trunk/master
+ $this->skipOnAutomatedBranches();
+
+ $license = file_get_contents( ABSPATH . 'license.txt' );
+ preg_match( '#Copyright 2011-(\d+) by the contributors#', $license, $matches );
+ $this_year = date( 'Y' );
+ $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." );
+ }
+
+ function test_package_json() {
+ $package_json = file_get_contents( dirname( ABSPATH ) . '/package.json' );
+ $package_json = json_decode( $package_json, true );
+ list( $version ) = explode( '-', $GLOBALS['wp_version'] );
+ // package.json uses x.y.z, so fill cleaned $wp_version for .0 releases
+ if ( 1 == substr_count( $version, '.' ) ) {
+ $version .= '.0';
+ }
+ $this->assertEquals( $version, $package_json['version'], "package.json's version needs to be updated to $version." );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
</span><span class="cx" style="display: block; padding: 0 10px"> function test_globals() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $test_foo;
</span></span></pre></div>
<a id="branches38testsphpunittestscanonicalcustomRulesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/canonical/customRules.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/canonical/customRules.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/canonical/customRules.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,9 +27,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> // Custom Rewrite rules leading to Categories
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
- array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
- array( '/ccr/uncategorized/sort/desc/?year=2008', array( 'url' => '/ccr/uncategorized/sort/desc/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc', 'year' => '2008' ) ), 17661 ),
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
+ array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestscanonicalpageOnFrontphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/canonical/pageOnFront.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/canonical/pageOnFront.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/canonical/pageOnFront.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,11 +13,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_rewrite;
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'show_on_front', 'page' );
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
- $wp_rewrite->init();
- flush_rewrite_rules();
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
+ $wp_rewrite->init();
+ $wp_rewrite->flush_rules();
+ }
+
+ function tearDown() {
+ global $wp_rewrite;
+ $wp_rewrite->init();
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function data() {
</span><span class="cx" style="display: block; padding: 0 10px"> /* Format:
</span><span class="cx" style="display: block; padding: 0 10px"> * [0]: $test_url,
</span></span></pre></div>
<a id="branches38testsphpunittestscanonicalpermalinkFormatsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/canonical/permalinkFormats.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/canonical/permalinkFormats.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/canonical/permalinkFormats.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,80 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group canonical
- * @group rewrite
- * @group query
- */
-class Tests_Canonical_PermalinkFormat extends WP_UnitTestCase {
-
- /**
- * @ticket 21167
- */
- public function test_dotted_formats() {
- global $wp_rewrite;
-
- // Create a sample post
- $cat_id = $this->factory->term->create( array(
- 'name' => 'permalink-test',
- 'taxonomy' => 'category'
- ) );
- $user_id = $this->factory->user->create( array(
- 'role' => 'editor',
- 'user_login' => 'permalink_user',
- ) );
- $post_id = $this->factory->post->create( array(
- 'post_title' => 'lorem-ipsum',
- 'post_date' => '2012-08-02 14:15:05',
- 'post_author' => $user_id,
- 'category' => $cat_id
- ) );
- wp_set_post_categories( $post_id, array( $cat_id ) );
-
- // Sample permalinks
- $tests = array(
- '/%postname%.%post_id%/ ' => array(
- 'regex' => '([^/]+)\.([0-9]+)(/[0-9]+)?/?$',
- 'url' => 'index.php?name=$1&p=$2&page=$3'
- ),
- '/%year%.%monthnum%.%postname%/' => array(
- 'regex' => '([0-9]{4})\.([0-9]{1,2})\.([^/]+)(/[0-9]+)?/?$',
- 'url' => 'index.php?year=$1&monthnum=$2&name=$3&page=$4'
- ),
- '/%post_id%.%postname%/' => array(
- 'regex' => '([0-9]+)\.([^/]+)(/[0-9]+)?/?$',
- 'url' => 'index.php?p=$1&name=$2&page=$3'
- ),
- '/%postname%.%year%/' => array(
- 'regex' => '([^/]+)\.([0-9]{4})(/[0-9]+)?/?$',
- 'url' => 'index.php?name=$1&year=$2&page=$3'
- ),
- '/$%postname%$/' => array(
- 'regex' => '\$([^/]+)\$(/[0-9]+)?/?$',
- 'url' => 'index.php?name=$1&page=$2'
- ),
- '%year%.+?%monthnum%.+?%day%.+?%hour%.+?%minute%.+?%second%.+?%post_id%.+?%postname%.+?%category%.+?%author%.+?' => array(
- 'regex' => '([0-9]{4})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]{1,2})\.\+\?([0-9]+)\.\+\?([^/]+)\.\+\?%category%\.\+\?([^/]+)\.\+\?(/[0-9]+)?/?$',
- 'url' => 'index.php?year=$1&monthnum=$2&day=$3&hour=$4&minute=$5&second=$6&p=$7&name=$8&%category%$9&author_name=$10&page=$11'
- ),
- );
-
- // Test permalinks
- foreach ( $tests as $permalink_format => $expected ) {
- update_option( 'permalink_structure', $permalink_format );
-
- // Get the rewrite rules
- $rules = $wp_rewrite->generate_rewrite_rules( get_option( 'permalink_structure' ), EP_PERMALINK, false, false, false, false );
-
- // Filter out only the post rewrite rule
- foreach ( $rules as $regex => $url ) {
- if ( false === strpos( $url, 'attachment=$' ) && false === strpos( $url, 'tb=' ) && false === strpos( $url, 'cpage=$' ) ) {
- break;
- }
- }
-
- // Test that expected === actual
- $this->assertEquals( $regex, $expected['regex'], "Problem with permalink format: $permalink_format" );
- $this->assertEquals( $url, $expected['url'], "Problem with permalink format: $permalink_format" );
- }
- }
-}
</del></span></pre></div>
<a id="branches38testsphpunittestscanonicalphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/canonical.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/canonical.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/canonical.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,20 +17,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var $author_id;
</span><span class="cx" style="display: block; padding: 0 10px"> var $post_ids;
</span><span class="cx" style="display: block; padding: 0 10px"> var $term_ids;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setUp() {
- parent::setUp();
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function setUp() {
+ global $wp_rewrite;
+
+ parent::setUp();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> update_option( 'page_comments', true );
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'comments_per_page', 5 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'posts_per_page', 5 );
-
- update_option( 'permalink_structure', $this->structure );
- create_initial_taxonomies();
- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
-
- $this->old_current_user = get_current_user_id();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ update_option( 'posts_per_page', 5 );
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( $this->structure );
+
+ create_initial_taxonomies();
+
+ $wp_rewrite->flush_rules();
+
+ $this->old_current_user = get_current_user_id();
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->author_id = $this->factory->user->create( array( 'user_login' => 'canonical-author' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( $this->author_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,14 +82,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->factory->term->create( array( 'name' => 'post-formats' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function tearDown() {
+ global $wp_rewrite;
+ wp_set_current_user( $this->old_current_user );
+
+ $wp_rewrite->init();
+ parent::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function tearDown() {
- wp_set_current_user( $this->old_current_user );
-
- $GLOBALS['wp_rewrite']->init();
- parent::tearDown();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> // URL's are relative to the site "front", ie. /category/uncategorized/ instead of http://site.../category..
</span><span class="cx" style="display: block; padding: 0 10px"> // Return url's are full url's with the prepended home.
</span><span class="cx" style="display: block; padding: 0 10px"> function get_canonical($test_url) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -173,32 +178,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array( '?cat=%d', '/category/parent/child-1/child-2/' ), // no children
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/category/uncategorized/', array( 'url' => '/category/uncategorized/', 'qv' => array( 'category_name' => 'uncategorized' ) ) ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/category/uncategorized/page/2/', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
- array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
- array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
- array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
-
- // Categories & Intersections with other vars
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
+ array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
+
+ // Categories & Intersections with other vars
</ins><span class="cx" style="display: block; padding: 0 10px"> array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?category_name=cat-a,cat-b', array( 'url' => '/?category_name=cat-a,cat-b', 'qv' => array( 'category_name' => 'cat-a,cat-b' ) ) ),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Taxonomies with extra Query Vars
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086), // Extra query vars should stay encoded
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Categories with Dates
- array( '/category/uncategorized/?paged=2&year=2008', array( 'url' => '/category/uncategorized/page/2/?year=2008', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2, 'year' => 2008) ), 17661 ),
-// array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
- array( '/2008/04/?cat=1', array( 'url' => '/category/uncategorized/?year=2008&monthnum=04', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
-// array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
- array( '/2008/?category_name=cat-a', array( 'url' => '/category/cat-a/?year=2008', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ), 20386 ),
-// array( '/category/uncategorized/?year=2008', array( 'url' => '/2008/?category_name=uncategorized', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
- array( '/category/uncategorized/?year=2008', array( 'url' => '/category/uncategorized/?year=2008', 'qv' => array('category_name' => 'uncategorized', 'year' => '2008' ) ), 17661 ),
-
- // Pages
- array( '/sample%20page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 17653 ), // Page rules always set 'page'
- array( '/sample------page/', array( 'url' => '/sample-page/', 'qv' => array('pagename' => 'sample-page', 'page' => '' ) ), 14773 ),
- array( '/child-page-1/', '/parent-page/child-page-1/'),
- array( '/?page_id=144', '/parent-page/child-page-1/'),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Categories with Dates
+ array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
+// array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
+
+ // Pages
+ array( '/child-page-1/', '/parent-page/child-page-1/'),
+ array( '/?page_id=144', '/parent-page/child-page-1/'),
</ins><span class="cx" style="display: block; padding: 0 10px"> array( '/abo', '/about/' ),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Posts
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,18 +210,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2008/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/3' ) ) ), // page = /3 ?!
+ array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
+ array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/3' ) ) ), // page = /3 ?!
- array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/', 11694 ), // post with 4 pages
- array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
- array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
-
- // Comments
- array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
- array( '/2008/03/03/comment-test/comment-page-20/', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
- array( '/2008/03/03/comment-test/?cpage=30', '/2008/03/03/comment-test/comment-page-3/', 20388 ), // there's only 3 pages
-
- // Attachments
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Comments
+ array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
+
+ // Attachments
</ins><span class="cx" style="display: block; padding: 0 10px"> array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -244,13 +237,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2012/11/51/', '/2012/11/'),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Authors
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/?author=%d', '/author/canonical-author/' ),
-// array( '/?author=%d&year=2008', '/2008/?author=3'),
- array( '/?author=%d&year=2008', '/author/canonical-author/?year=2008', 17661 ),
-// array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
- array( '/author/canonical-author/?year=2008', '/author/canonical-author/?year=2008', 17661 ),
-
- // Feeds
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( '/?author=%d', '/author/canonical-author/' ),
+// array( '/?author=%d&year=2008', '/2008/?author=3'),
+// array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
+
+ // Feeds
</ins><span class="cx" style="display: block; padding: 0 10px"> array( '/?feed=atom', '/feed/atom/' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?feed=rss2', '/feed/' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?feed=comments-rss2', '/comments/feed/'),
</span></span></pre></div>
<a id="branches38testsphpunittestsdependenciesscriptsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/dependencies/scripts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/dependencies/scripts.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/dependencies/scripts.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,38 +82,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Cleanup
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_scripts->base_url = $base_url_backup;
- }
-
- /**
- * @ticket 22229
- */
- function test_inline_should_not_output_script_tag_with_src() {
- wp_enqueue_script( 'baba-inline-0', 'inline' );
- $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
- }
-
- /**
- * @ticket 22229
- */
- function test_json_encode_should_not_encode_special_literal_values() {
- if ( ! class_exists( 'WP_JS_Literal' ) ) {
- $this->markTestSkipped( "WP_JS_Literal class doesn't exist" );
- }
-
- $literal = new WP_JS_Literal( 'baba()' );
- $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) );
- }
-
- /**
- * @ticket 22229
- */
- function test_json_encode_should_not_encode_special_literal_values_with_dependencies() {
- if ( ! class_exists( 'WP_JS_Literal' ) ) {
- $this->markTestSkipped( "WP_JS_Literal class doesn't exist" );
- }
-
- $literal = new WP_JS_Literal( 'baba()', array( 'dep0', 'dep1' ) );
- $this->assertEquals( '{"x":baba()}', WP_JS_Literal::json_encode( array( 'x' => $literal ), array( $literal ) ) );
- }
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_scripts->base_url = $base_url_backup;
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestsexportclasswpexportqueryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/export/class-wp-export-query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/export/class-wp-export-query.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/export/class-wp-export-query.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,256 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * Test WP_Export_Query class
- *
- * @group export
- * @ticket 22435
- */
-class Test_WP_Export_Query extends WP_UnitTestCase {
- function setUp() {
- if ( ! class_exists( 'WP_Export_Query' ) ) {
- $this->markTestSkipped( "WP_Export_Query class doesn't exist" );
- }
-
- parent::setUp();
- }
-
- function test_WP_Export_Query_should_be_initialized_with_an_array() {
- $export = new WP_Export_Query( array( 'author' => 'all' ) );
- $this->assertTrue( (bool) $export );
- }
-
- function test_WP_Export_Query_should_use_post_ids_if_passed() {
- $export = new WP_Export_Query( array( 'post_ids' => array( 1, 2, 3 ) ) );
- $this->assertEquals( array( 1, 2, 3 ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_all_posts_if_all_arg_is_true() {
- $post_id = $this->factory->post->create();
- $export = new WP_Export_Query();
- $this->assertEquals( array( $post_id ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_all_posts_if_no_args_passed() {
- $post_id = $this->factory->post->create();
- $export = new WP_Export_Query();
- $this->assertEquals( array( $post_id ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_not_export_anything_if_post_type_arg_is_set_to_non_existing_post_type() {
- $post_id = $this->factory->post->create();
- $export = new WP_Export_Query( array( 'post_type' => 'baba' ) );
- $this->assertEquals( array(), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_a_certain_post_type_if_the_post_type_arg_is_set() {
- register_post_type( 'baba' );
- $post_id = $this->factory->post->create( array( 'post_type' => 'baba' ) );
- $_ = $this->factory->post->create( array( 'post_type' => 'dyado' ) );
- $export = new WP_Export_Query( array( 'post_type' => 'baba' ) );
- $this->assertEquals( array( $post_id ), $export->post_ids() );
- _unregister_post_type( 'baba' );
- }
-
- function test_WP_Export_Query_should_not_export_post_types_with_can_export_set_to_false() {
- register_post_type( 'non-exportable', array( 'can_export' => false ) );
- register_post_type( 'exportable', array( 'can_export' => true ) );
- $non_exportable_post_id = $this->factory->post->create( array( 'post_type' => 'non-exportable' ) );
- $exportable_post_id = $this->factory->post->create( array( 'post_type' => 'exportable' ) );
- $export = new WP_Export_Query();
- $this->assertEquals( array( $exportable_post_id ), $export->post_ids() );
- _unregister_post_type( 'non-exportable' );
- _unregister_post_type( 'exportable' );
- }
-
- function test_WP_Export_Query_should_not_export_auto_drafts_by_default() {
- $post_id = $this->factory->post->create( array( 'post_status' => 'auto-draft' ) );
- $export = new WP_Export_Query();
- $this->assertEquals( array(), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_status_if_status_arg_is_set() {
- $post_id_baba = $this->factory->post->create( array( 'post_status' => 'baba' ) );
- $post_id_dudu = $this->factory->post->create( array( 'post_status' => 'dudu' ) );
- $export = new WP_Export_Query( array( 'status' => 'baba' ) );
- $this->assertEquals( array( $post_id_baba ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_author_id_if_status_arg_is_a_number() {
- $user_id = $this->factory->user->create();
- $post_by_user = $this->factory->post->create( array( 'post_author' => $user_id ) );
- $other_post = $this->factory->post->create( array( 'post_author' => $user_id + 1 ) );
- $export = new WP_Export_Query( array( 'author' => $user_id ) );
- $this->assertEquals( array( $post_by_user ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_author_name_if_status_arg_is_a_username() {
- $user = $this->factory->user->create_and_get( array( 'user_login' => 'baba' ) );
- $post_by_user = $this->factory->post->create( array( 'post_author' => $user->ID ) );
- $other_post = $this->factory->post->create( array( 'post_author' => $user->ID + 1 ) );
- $export = new WP_Export_Query( array( 'author' => 'baba' ) );
- $this->assertEquals( array( $post_by_user ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_author_object_if_author_is_an_object_with_ID_member_variable() {
- $user = $this->factory->user->create_and_get();
- $post_by_user = $this->factory->post->create( array( 'post_author' => $user->ID ) );
- $other_post = $this->factory->post->create( array( 'post_author' => $user->ID + 1 ) );
- $export = new WP_Export_Query( array( 'author' => $user ) );
- $this->assertEquals( array( $post_by_user ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_after_certain_start_date_if_start_date_arg_is_passed() {
- $post_before = $this->factory->post->create( array( 'post_date' => '2012-11-10 23:59:59' ) );
- $post_after = $this->factory->post->create( array( 'post_date' => '2012-11-11 00:00:00' ) );
- $export = new WP_Export_Query( array( 'start_date' => '2012-11-11' ) );
- $this->assertEquals( array( $post_after ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_after_certain_end_date_if_end_date_arg_is_passed() {
- $post_before = $this->factory->post->create( array( 'post_date' => '2012-11-10 23:59:59' ) );
- $post_after = $this->factory->post->create( array( 'post_date' => '2012-11-11 00:00:00' ) );
- $export = new WP_Export_Query( array( 'end_date' => '2012-11-10' ) );
- $this->assertEquals( array( $post_before ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_category_if_category_arg_is_passed() {
- $category_id = $this->factory->category->create( array( 'name' => 'baba' ) );
- $post_with_category = $this->factory->post->create( array( 'post_category' => array( $category_id ) ) );
- $post_without = $this->factory->post->create();
- $export = new WP_Export_Query( array( 'post_type' => 'post', 'category' => 'baba' ) );
- $this->assertEquals( array( $post_with_category ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_only_posts_with_certain_category_id_if_category_arg_is_passed() {
- $category_id = $this->factory->category->create( array( 'name' => 'baba' ) );
- $post_with_category = $this->factory->post->create( array( 'post_category' => array( $category_id ) ) );
- $post_without = $this->factory->post->create();
- $export = new WP_Export_Query( array( 'post_type' => 'post', 'category' => $category_id ) );
- $this->assertEquals( array( $post_with_category ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_filter_posts_by_category_only_for_post_post_type() {
- $category_id = $this->factory->category->create( array( 'name' => 'baba' ) );
- $post_with_category = $this->factory->post->create( array( 'post_category' => array( $category_id ) ) );
- $post_without = $this->factory->post->create();
- $different_post_type = $this->factory->post->create( array( 'post_type' => 'page' ) );
- $export = new WP_Export_Query( array( 'category' => $category_id ) );
- $this->assertEqualSets( array( $post_with_category, $post_without, $different_post_type ), $export->post_ids() );
- }
-
- function test_WP_Export_Query_should_include_attachments_of_posts_if_we_are_filtering_only_some_post_types() {
- register_post_type( 'baba' );
- $post_id = $this->factory->post->create( array( 'post_type' => 'baba' ) );
- $attachment_post_id = $this->factory->post->create( array( 'post_type' => 'attachment', 'post_parent' => $post_id ) );
- $export = new WP_Export_Query( array( 'post_type' => 'baba' ) );
- $this->assertEquals( array( $post_id, $attachment_post_id ), $export->post_ids() );
- _unregister_post_type( 'baba' );
- }
-
- function test_authors_should_return_list_of_users_for_each_post_author() {
- $user_id = $this->factory->user->create();
- $this->factory->post->create( array( 'post_author' => $user_id ) );
- $export = new WP_Export_Query();
- $authors = $export->authors();
- $this->assertEquals( 1, count( $authors ) );
- $this->assertEquals( $user_id, $authors[0]->ID );
- }
-
- function test_authors_should_skip_non_existing_authors() {
- $this->factory->post->create( array( 'post_author' => 11 ) );
- $export = new WP_Export_Query();
- $this->assertEquals( array(), $export->authors() );
- }
-
- function test_authors_should_skip_auto_draft_authors() {
- $user_id = $this->factory->user->create();
- $this->factory->post->create( array( 'post_author' => $user_id, 'post_status' => 'auto-draft' ) );
- $export = new WP_Export_Query();
- $this->assertEquals( array(), $export->authors() );
- }
-
- function test_categories_should_return_only_the_category_we_are_filtering_on() {
- $category_id = $this->factory->category->create( array( 'name' => 'baba' ) );
- $other_category_id = $this->factory->category->create( array( 'name' => 'dyado' ) );
- $export = new WP_Export_Query( array( 'post_type' => 'post', 'category' => $category_id ) );
- $this->assertEquals( 1, count( $export->categories() ) );
- }
-
- function test_categories_should_return_no_categories_if_we_are_requesting_only_one_post_type() {
- $category_id = $this->factory->category->create();
- $export = new WP_Export_Query( array( 'post_type' => 'post' ) );
- $this->assertEquals( array(), $export->categories() );
- }
-
- function test_categories_should_return_all_categories_if_we_are_requesting_all_post_types() {
- $category_id = $this->factory->category->create();
- $another_category_id = $this->factory->category->create();
- $export = new WP_Export_Query();
- $this->assertEqualSets( array( 1, $category_id, $another_category_id ), self::get_term_ids( $export->categories() ) );
- }
-
- function test_categories_should_not_return_a_child_before_its_parent_category() {
- $child_category_id = $this->factory->category->create();
- $top_category_id = $this->factory->category->create();
- wp_update_term( $child_category_id, 'category', array( 'parent' => $top_category_id ) );
- $export = new WP_Export_Query();
- $this->assertNoChildBeforeParent( $export->categories() );
- }
-
- function test_tags_should_return_all_tags() {
- $tag_id = $this->factory->tag->create();
- $export = new WP_Export_Query();
- $this->assertEquals( array( $tag_id ), self::get_term_ids( $export->tags() ) );
- }
-
- function test_tags_should_return_no_tags_if_we_are_requesting_only_one_post_type() {
- $category_id = $this->factory->tag->create();
- $export = new WP_Export_Query( array( 'post_type' => 'post' ) );
- $this->assertEquals( array(), $export->tags() );
- }
-
- function test_custom_taxonomies_terms_should_return_all_terms() {
- register_taxonomy( 'taxonomy_all', 'post' );
- $term_id = $this->factory->term->create( array( 'taxonomy' => 'taxonomy_all' ) );
- $export = new WP_Export_Query();
- $this->assertEquals( array( $term_id ), self::get_term_ids( $export->custom_taxonomies_terms() ) );
- _unregister_taxonomy( 'taxonomy_all' );
- }
-
- function test_custom_taxonomes_terms_should_return_no_terms_if_we_are_requesting_only_one_post_type() {
- register_taxonomy( 'taxonomy_one_post_type', 'post' );
- $term_id = $this->factory->term->create( array( 'taxonomy' => 'taxonomy_one_post_type' ) );
- $export = new WP_Export_Query( array( 'post_type' => 'post' ) );
- $this->assertEquals( array(), $export->custom_taxonomies_terms() );
- _unregister_taxonomy( 'taxonomy_one_post_type' );
- }
-
- function test_custom_taxonomies_terms_should_not_return_a_child_before_its_parent_term() {
- register_taxonomy( 'heir', 'post', array( 'hierarchical' => true ) );
- $child_term_id = $this->factory->term->create( array( 'taxonomy' => 'heir' ) );
- $top_term_id = $this->factory->term->create( array( 'taxonomy' => 'heir' ) );
- wp_update_term( $child_term_id, 'heir', array( 'parent' => $top_term_id ) );
- $export = new WP_Export_Query();
- $this->assertNoChildBeforeParent( $export->custom_taxonomies_terms() );
- _unregister_taxonomy( 'heir' );
- }
-
- private function assertNoChildBeforeParent( $terms ) {
- $visited = array();
- foreach( $terms as $term ) {
- $this->assertTrue( isset( $visited[$term->parent] ) || !$term->parent );
- $visited[$term->term_id] = true;
- }
- }
-
- private static function get_term_ids( $terms ) {
- return array_values( array_map( array( __CLASS__, '_get_term_ids_cb' ), $terms ) );
- }
-
- private static function _get_term_ids_cb( $c ) {
- return intval( $c->term_id );
- }
-
-}
-
</del></span></pre></div>
<a id="branches38testsphpunittestsexportfunctionsexportphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/export/functions.export.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/export/functions.export.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/export/functions.export.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,43 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * Test export functions
- *
- * @group export
- * @ticket 22435
- */
-class Test_WP_Export_Functions extends WP_UnitTestCase {
- function setUp() {
- if ( ! function_exists( 'wp_export' ) ) {
- $this->markTestSkipped( "wp_export function doesn't exist" );
- }
-
- parent::setUp();
- }
-
- function test_wp_export_returns_wp_error_if_the_writer_throws_Export_exception() {
- $this->assertTrue( is_wp_error( wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Export_Exception' ) ) ) );
- }
-
- function test_wp_export_passes_the_exception_if_the_writer_throws_other_exception() {
- $this->setExpectedException( 'Exception' );
- wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Other_Exception' ) );
- }
-
-}
-
-class Test_WP_Export_Stub_Writer_Throws_Export_Exception {
- function __construct( $formatter ) {
- }
- function export() {
- throw new WP_Export_Exception( 'baba' );
- }
-}
-
-class Test_WP_Export_Stub_Writer_Throws_Other_Exception {
- function __construct( $formatter ) {
- }
- function export() {
- throw new Exception( 'baba' );
- }
-}
</del></span></pre></div>
<a id="branches38testsphpunittestsexportwritersphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/export/writers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/export/writers.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/export/writers.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,28 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * Test WP_Export_*_Writer classes
- *
- * @group export
- * @ticket 22435
- */
-class Test_WP_Export_Writers extends WP_UnitTestCase {
- function test_export_returner_returns_all_the_return_values() {
- if ( ! class_exists( 'WP_Export_Returner' ) ) {
- $this->markTestSkipped( "WP_Export_Returner class doesn't exist" );
- }
- $returner = new WP_Export_Returner( $this->get_x_formatter() );
- $this->assertEquals( 'xxx' , $returner->export() );
- }
-
- private function get_x_formatter() {
- $methods = array( 'before_posts', 'posts', 'after_posts' );
- $formatter = $this->getMock( 'WP_Export_WXR_Formatter', $methods, array( null ) );
- foreach( $methods as $method ) {
- $return = 'posts' == $method? array( 'x' ) : 'x';
- $formatter->expects( $this->once() )->method( $method )->with()->will( $this->returnValue( $return ) );
- }
- return $formatter;
- }
-}
-
</del></span></pre></div>
<a id="branches38testsphpunittestsfeedrss2php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/feed/rss2.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/feed/rss2.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/feed/rss2.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,16 +108,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // pub date
</span><span class="cx" style="display: block; padding: 0 10px"> $pubdate = xml_find($items[$i]['child'], 'pubDate');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals(strtotime($posts[$i]->post_date), strtotime($pubdate[0]['content']));
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // author
- $creator = xml_find($items[$i]['child'], 'dc:creator');
- $this->assertEquals($this->author->user_nicename, $creator[0]['content']);
-
- // categories (perhaps multiple)
- $categories = xml_find($items[$i]['child'], 'category');
- $cat_ids = wp_get_post_categories($post->ID);
- if (empty($cat_ids)) $cat_ids = array(1);
- // should be the same number of categories
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // author
+ $creator = xml_find( $items[$i]['child'], 'dc:creator' );
+ $user = new WP_User( $posts[$i]->post_author );
+ $this->assertEquals( $user->user_login, $creator[0]['content'] );
+
+ // categories (perhaps multiple)
+ $categories = xml_find($items[$i]['child'], 'category');
+ $cat_ids = wp_get_post_categories($posts[$i]->ID);
+ if (empty($cat_ids)) $cat_ids = array(1);
+ // should be the same number of categories
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals(count($cat_ids), count($categories));
</span><span class="cx" style="display: block; padding: 0 10px"> // ..with the same names
</span><span class="cx" style="display: block; padding: 0 10px"> for ($j=0; $j < count($cat_ids); $j++)
</span></span></pre></div>
<a id="branches38testsphpunittestsfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/filters.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/filters.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -247,24 +247,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function _self_removal($tag) {
</span><span class="cx" style="display: block; padding: 0 10px"> remove_action( $tag, array($this, '_self_removal'), 10, 1 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $tag;
- }
-
- /**
- * @ticket 21169
- */
- function test_filter_removal_during_filter() {
- $tag = rand_str();
- $a = new MockAction();
- $b = new MockAction();
-
- add_action( $tag, array($a, 'filter_append'), 11, 1 );
- add_action( $tag, array($b, 'filter_append'), 12, 1 );
- add_action( $tag, array($this, '_self_removal'), 10, 1 );
-
- $result = apply_filters($tag, $tag);
- $this->assertEquals( 1, $a->get_call_count(), 'priority 11 filters should run after priority 10 empties itself' );
- $this->assertEquals( 1, $b->get_call_count(), 'priority 12 filters should run after priority 10 empties itself and priority 11 runs' );
- $this->assertEquals( $result, $tag . '_append_append', 'priority 11 and 12 filters should run after priority 10 empties itself' );
- }
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $tag;
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestsformattingEscUrlphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/formatting/EscUrl.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/formatting/EscUrl.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/formatting/EscUrl.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,22 +61,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 16859
- */
- function test_square_brackets() {
- $this->assertEquals( 'http://example.com/?foo%5Bbar%5D=baz', esc_url( 'http://example.com/?foo[bar]=baz' ) );
- $this->assertEquals( 'http://example.com/?baz=bar&foo%5Bbar%5D=baz', esc_url( 'http://example.com/?baz=bar&foo[bar]=baz' ) );
- //IPv6 addresses in urls - RFC2732
- $this->assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) );
- $this->assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) );
- $this->assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) );
- }
-
- /**
- * @ticket 21974
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 21974
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_protocol_relative_with_colon() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '//example.com/foo?foo=abc:def', esc_url( '//example.com/foo?foo=abc:def' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsformattingMakeClickablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/formatting/MakeClickable.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/formatting/MakeClickable.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/formatting/MakeClickable.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -363,21 +363,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $out = make_clickable( $in );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $in, $out );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 16859
- */
- function test_square_brackets() {
- $urls_before = array(
- 'http://example.com/?foo[bar]=baz',
- 'http://example.com/?baz=bar&foo[bar]=baz',
- );
- $urls_expected = array(
- '<a href="http://example.com/?foo%5Bbar%5D=baz" rel="nofollow">http://example.com/?foo%5Bbar%5D=baz</a>',
- '<a href="http://example.com/?baz=bar&foo%5Bbar%5D=baz" rel="nofollow">http://example.com/?baz=bar&foo%5Bbar%5D=baz</a>',
- );
- foreach ($urls_before as $key => $url) {
- $this->assertEquals( $urls_expected[$key], make_clickable( $url ) );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsformattingSanitizeTitleWithDashesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,24 +31,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t----"));
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_handles_non_entity_ampersands() {
- $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull"));
- }
-
- /**
- * @ticket 10823
- */
- function test_strips_entities() {
- $this->assertEquals("no-entities-here", sanitize_title_with_dashes("No Entities – Here &"));
- $this->assertEquals("one-two", sanitize_title_with_dashes("One & Two", '', 'save'));
- $this->assertEquals("one-two", sanitize_title_with_dashes("One { Two;", '', 'save'));
- $this->assertEquals("one-two", sanitize_title_with_dashes("One & Two;", '', 'save'));
- $this->assertEquals("one-two", sanitize_title_with_dashes("One Twoâ„¢;", '', 'save'));
- $this->assertEquals("one-two", sanitize_title_with_dashes("One && Two;", '', 'save'));
- $this->assertEquals("onetwo", sanitize_title_with_dashes("One&Two", '', 'save'));
- $this->assertEquals("onetwo-test", sanitize_title_with_dashes("One&Two Test;", '', 'save'));
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_handles_non_entity_ampersands() {
+ $this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull"));
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_replaces_nbsp() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals("dont-break-the-space", sanitize_title_with_dashes("don't break the space", '', 'save'));
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsformattingSanitizeUserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/formatting/SanitizeUser.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/formatting/SanitizeUser.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/formatting/SanitizeUser.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,18 +7,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function test_strips_html() {
</span><span class="cx" style="display: block; padding: 0 10px"> $input = "Captain <strong>Awesome</strong>";
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = is_multisite() ? 'captain awesome' : 'Captain Awesome';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals($expected, sanitize_user($input));
- }
- /**
- * @ticket 10823
- */
- function test_strips_entities() {
- $this->assertEquals("ATT", sanitize_user("AT&T"));
- $this->assertEquals("ATT Test;", sanitize_user("AT&T Test;"));
- $this->assertEquals("AT&T Test;", sanitize_user("AT&T Test;"));
- }
- function test_strips_percent_encoded_octets() {
- $expected = is_multisite() ? 'franois' : 'Franois';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals($expected, sanitize_user($input));
+ }
+ function test_strips_percent_encoded_octets() {
+ $expected = is_multisite() ? 'franois' : 'Franois';
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $expected, sanitize_user( "Fran%c3%a7ois" ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
</span></span></pre></div>
<a id="branches38testsphpunittestsfunctionsdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/functions/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/functions/deprecated.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/functions/deprecated.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,11 +146,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> $file = wp_tempnam();
</span><span class="cx" style="display: block; padding: 0 10px"> $img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_save_image_file( $file, $img, 'image/jpeg', 1 );
- imagedestroy( $img );
- @unlink($file);
-
- // Check if the arg was deprecated
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_save_image_file( $file, $img, 'image/jpeg', 1 );
+ imagedestroy( $img );
+ unlink( $file );
+
+ // Check if the arg was deprecated
</ins><span class="cx" style="display: block; padding: 0 10px"> $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEmpty( $check );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -167,11 +167,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> $file = wp_tempnam();
</span><span class="cx" style="display: block; padding: 0 10px"> $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_save_image_file( $file, $img, 'image/jpeg', 1 );
- unset( $img );
- @unlink($file);
-
- // Check if the arg was deprecated
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_save_image_file( $file, $img, 'image/jpeg', 1 );
+ unset( $img );
+ unlink( $file );
+
+ // Check if the arg was deprecated
</ins><span class="cx" style="display: block; padding: 0 10px"> $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $check );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/functions.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/functions.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -129,22 +129,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\\fg.png' ), 'Tripple slashed not removed' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * @ticket 9930
- */
- function test_is_serialized() {
- $cases = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+ function test_is_serialized() {
+ $cases = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> serialize(null),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(true),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(false),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(-25),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- serialize(25),
- serialize(1.1),
- serialize(2.1E+200),
- serialize('this string will be serialized'),
- serialize("a\nb"),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ serialize(25),
+ serialize(1.1),
+ serialize('this string will be serialized'),
+ serialize("a\nb"),
</ins><span class="cx" style="display: block; padding: 0 10px"> serialize(array()),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(array(1,1,2,3,5,8,13)),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize( (object)array('test' => true, '3', 4) )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -153,11 +149,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_serialized($case), "Serialized data: $case" );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $not_serialized = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'a string',
- 'garbage:a:0:garbage;',
- 'b:4;',
- 's:4:test;'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'a string',
+ 'garbage:a:0:garbage;',
+ 's:4:test;'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $not_serialized as $case )
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_serialized($case), "Test data: $case" );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestshttpbasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/http/base.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/http/base.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/http/base.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -282,8 +282,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( 'This install of PHP does not support SSL' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $res = wp_remote_get( 'https://wordpress.org/' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) );
- }
-
-
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) );
+ }
+
+
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestshttpfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/http/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/http/functions.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/http/functions.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,13 +3,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group http
</span><span class="cx" style="display: block; padding: 0 10px"> * @group external-http
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
-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 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+class Tests_HTTP_Functions extends WP_UnitTestCase {
+ public function setUp() {
+ if ( ! extension_loaded( 'openssl' ) ) {
+ $this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
+ }
+
+ parent::setUp();
+ }
+
+ function test_head_request() {
+ // this url give a direct 200 response
+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+ $response = wp_remote_head( $url );
+ $headers = wp_remote_retrieve_headers( $response );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'array', $headers, "Reply wasn't array." );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'image/jpeg', $headers['content-type'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,25 +25,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_head_redirect() {
+ // this url will 301 redirect
+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+ $response = wp_remote_head( $url );
+ $this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function test_head_404() {
- $url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
- $headers = wp_remote_head( $url );
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function test_head_404() {
+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
+ $headers = wp_remote_head( $url );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'array', $headers, "Reply wasn't array." );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '404', wp_remote_retrieve_response_code( $headers ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function test_get_request() {
- $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
- $file = tempnam('/tmp', 'testfile');
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function test_get_request() {
+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+ $file = tempnam('/tmp', 'testfile');
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http($url, $file);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // should return the same headers as a head request
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,11 +57,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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');
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_get_redirect() {
+ // this will redirect to asdftestblog1.files.wordpress.com
+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+ $file = tempnam('/tmp', 'testfile');
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http($url, $file);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // should return the same headers as a head request
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,11 +75,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_get_redirect_limit_exceeded() {
+ // this will redirect to asdftestblog1.files.wordpress.com
+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+ $file = tempnam('/tmp', 'testfile');
+ // pretend we've already redirected 5 times
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http( $url, $file, 6 );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $headers );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsimagebasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/base.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/base.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/base.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,10 +7,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Set the image editor engine according to the unit test's specification
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
- public function setUp() {
- if ( ! call_user_func( array( $this->editor_engine, 'test' ) ) ) {
- $this->markTestSkipped( sprintf('The image editor engine %s is not supported on this system', $this->editor_engine) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+ public function setUp() {
+ parent::setUp();
+
+ if ( ! call_user_func( array( $this->editor_engine, 'test' ) ) ) {
+ $this->markTestSkipped( sprintf('The image editor engine %s is not supported on this system', $this->editor_engine) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,11 +20,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Undo the image editor override
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
- public function tearDown() {
- remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+ public function tearDown() {
+ parent::tearDown();
+
+ remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Override the image editor engine
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,11 +36,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array( $this->editor_engine );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Helper assertion for testing alpha on images
- *
- * @param string $image_path
- * @param array $point array(x,y)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Helper assertion for testing alpha on images
+ *
+ * @param string $image_path
+ * @param array $point array(x,y)
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param int $alpha
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function assertImageAlphaAtPoint( $image_path, $point, $alpha ) {
</span></span></pre></div>
<a id="branches38testsphpunittestsimageeditor_gdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/editor_gd.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/editor_gd.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/editor_gd.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,18 +4,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Test the WP_Image_Editor_GD class
</span><span class="cx" style="display: block; padding: 0 10px"> * @group image
</span><span class="cx" style="display: block; padding: 0 10px"> * @group media
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group wp-image-editor-gd
- */
-
-class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group wp-image-editor-gd
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px"> public $editor_engine = 'WP_Image_Editor_GD';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function setup() {
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::setUp();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tearDown() {
+ $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
+
+ foreach ( glob( $folder ) as $file ) {
+ unlink( $file );
+ }
+
+ $this->remove_added_uploads();
+
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Check support for GD compatible mime types.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -134,6 +148,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $save_to_file );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -151,8 +166,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->save( $save_to_file );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
+
+ unlink( $save_to_file );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsimageeditor_imagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/editor_imagick.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/editor_imagick.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/editor_imagick.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,11 +4,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Test the WP_Image_Editor_Imagick class
</span><span class="cx" style="display: block; padding: 0 10px"> * @group image
</span><span class="cx" style="display: block; padding: 0 10px"> * @group media
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group wp-image-editor-imagick
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group wp-image-editor-imagick
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
-
</del><span class="cx" style="display: block; padding: 0 10px"> public $editor_engine = 'WP_Image_Editor_Imagick';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function setup() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,6 +24,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> parent::setUp();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tearDown() {
+ $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
+
+ foreach ( glob( $folder ) as $file ) {
+ unlink( $file );
+ }
+
+ $this->remove_added_uploads();
+
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Check support for Image Magick compatible mime types.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,6 +155,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $save_to_file );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -156,10 +170,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $editor = wp_get_image_editor( $file );
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->load();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
-
- $editor->save( $save_to_file );
-
- $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
+
+ $editor->save( $save_to_file );
+
+ $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
+
+ unlink( $save_to_file );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsimagefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/functions.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/functions.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,11 +86,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_is_displayable_image_negative() {
</span><span class="cx" style="display: block; padding: 0 10px"> // these are image files but aren't suitable for web pages because of compatibility or size issues
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $files = array(
- // 'test-image-cmyk.jpg', Allowed in r9727
- 'test-image.bmp',
- // 'test-image-grayscale.jpg', Allowed in r9727
- 'test-image.pct',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $files = array(
+ // 'test-image-cmyk.jpg', Allowed in r9727
+ // 'test-image.bmp', Allowed in r28589
+ // 'test-image-grayscale.jpg', Allowed in r9727
+ 'test-image.pct',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'test-image.tga',
</span><span class="cx" style="display: block; padding: 0 10px"> 'test-image.sgi',
</span><span class="cx" style="display: block; padding: 0 10px"> 'test-image.tiff',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,12 +142,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEmpty( $ret );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotInstanceOf( 'WP_Error', $ret );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Clean up
- @unlink( $file );
- @unlink( $ret['path'] );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Clean up
+ unlink( $file );
+ unlink( $ret['path'] );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Clean up
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $img );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,12 +183,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEmpty( $ret );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotInstanceOf( 'WP_Error', $ret );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Clean up
- @unlink( $file );
- @unlink( $ret['path'] );
- unset( $img );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Clean up
+ unlink( $file );
+ unlink( $ret['path'] );
+ unset( $img );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -229,12 +229,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $file = wp_unique_filename( $temp, uniqid() . ".$ext" );
</span><span class="cx" style="display: block; padding: 0 10px"> $ret = $img->save( trailingslashit( $temp ) . $file );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEmpty( $ret );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertNotInstanceOf( 'WP_Error', $ret );
- $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
- @unlink( $file );
- @unlink( $ret['path'] );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertNotInstanceOf( 'WP_Error', $ret );
+ $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+ unlink( $ret['path'] );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Clean up
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $img );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -289,11 +288,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_wp_crop_image_url() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !function_exists( 'imagejpeg' ) )
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->markTestSkipped( 'jpeg support unavailable' );
-
- $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
- 0, 0, 100, 100, 100, 100, false,
- DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->markTestSkipped( 'jpeg support unavailable' );
+
+ if ( ! extension_loaded( 'openssl' ) ) {
+ $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' );
+ }
+
+ $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
+ 0, 0, 100, 100, 100, 100, false,
+ DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotInstanceOf( 'WP_Error', $file );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFileExists( $file );
</span><span class="cx" style="display: block; padding: 0 10px"> $image = wp_get_image_editor( $file );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -309,11 +312,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 0, 0, 100, 100, 100, 100 );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInstanceOf( 'WP_Error', $file );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- public function test_wp_crop_image_url_not_exist() {
- $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
- 0, 0, 100, 100, 100, 100 );
- $this->assertInstanceOf( 'WP_Error', $file );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ public function test_wp_crop_image_url_not_exist() {
+ if ( ! extension_loaded( 'openssl' ) ) {
+ $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' );
+ }
+
+ $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
+ 0, 0, 100, 100, 100, 100 );
+ $this->assertInstanceOf( 'WP_Error', $file );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function mock_image_editor( $editors ) {
</span></span></pre></div>
<a id="branches38testsphpunittestsimageintermediate_sizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/intermediate_size.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/intermediate_size.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/intermediate_size.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,13 +1,17 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group image
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @group image
</ins><span class="cx" style="display: block; padding: 0 10px"> * @group media
</span><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
-class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
- function test_make_intermediate_size_no_size() {
- $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
+ function tearDown() {
+ $this->remove_added_uploads();
+ parent::tearDown();
+ }
+
+ function test_make_intermediate_size_no_size() {
+ $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( $image );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches38testsphpunittestsimageresizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/resize.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/resize.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/resize.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,11 +2,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group image
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group media
- * @group upload
- */
-abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase {
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_resize_jpg() {
</span><span class="cx" style="display: block; padding: 0 10px"> $image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -106,11 +109,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> list($w, $h, $type) = getimagesize($image);
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 150, $w );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 100, $h );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( IMAGETYPE_JPEG, $type );
-
- unlink($image);
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( IMAGETYPE_JPEG, $type );
+
+ unlink( $image );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_resize_thumb_50x150_crop() {
</span><span class="cx" style="display: block; padding: 0 10px"> $image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 50, 150, true );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,21 +136,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInstanceOf( 'WP_Error', $image );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'error_loading_image', $image->get_error_code() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Try resizing a php file (bad image)
- * @ticket 6821
- */
- public function test_resize_bad_image() {
- $image = $this->resize_helper( DIR_TESTDATA.'/export/crazy-cdata.xml', 25, 25 );
- $this->assertInstanceOf( 'WP_Error', $image );
- $this->assertEquals( 'invalid_image', $image->get_error_code() );
- }
-
-
- /**
- * Function to help out the tests
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Function to help out the tests
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> protected function resize_helper( $file, $width, $height, $crop = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $editor = wp_get_image_editor( $file );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunittestsimageresize_gdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/resize_gd.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/resize_gd.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/resize_gd.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,14 +2,36 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group image
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group media
- * @group upload
- */
-class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/resize.php' );
+
+class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Use the GD image editor engine
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
- public $editor_engine = 'WP_Image_Editor_GD';
-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+ public $editor_engine = 'WP_Image_Editor_GD';
+
+ public function setUp() {
+ require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+ require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
+
+ parent::setUp();
+ }
+
+ /**
+ * Try resizing a php file (bad image)
+ * @ticket 6821
+ */
+ public function test_resize_bad_image() {
+
+ $image = $this->resize_helper( DIR_TESTDATA.'/export/crazy-cdata.xml', 25, 25 );
+ $this->assertInstanceOf( 'WP_Error', $image );
+ $this->assertEquals( 'invalid_image', $image->get_error_code() );
+ }
+
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestsimageresize_imagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/image/resize_imagick.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/image/resize_imagick.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/image/resize_imagick.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,14 +2,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group image
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @group media
- * @group upload
- */
-class Test_Image_Resize_Imagick extends WP_Tests_Image_Resize_UnitTestCase {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/resize.php' );
+
+class Test_Image_Resize_Imagick extends WP_Tests_Image_Resize_UnitTestCase {
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Use the Imagick image editor engine
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
- public $editor_engine = 'WP_Image_Editor_Imagick';
-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+ public $editor_engine = 'WP_Image_Editor_Imagick';
+
+ public function setUp() {
+ require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+ require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' );
+
+ parent::setUp();
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestsiteratorsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/iterators.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/iterators.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/iterators.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,53 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @ticket 22435
- */
-class Test_WP_Post_IDs_Iterator extends WP_UnitTestCase {
- function setUp() {
- if ( ! class_exists( 'WP_Post_IDs_Iterator' ) ) {
- $this->markTestSkipped( "WP_Post_IDs_Iterator class doesn't exist" );
- }
-
- parent::setUp();
- }
-
- function test_create() {
- new WP_Post_IDs_Iterator( array( 1, 2, 3 ) );
- }
-
- function test_no_posts() {
- $this->assertIteratorReturnsSamePostIDs( array() );
- }
-
- function test_less_ids_than_limit() {
- $post_id_0 = $this->factory->post->create();
- $post_id_1 = $this->factory->post->create();
- $this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1 ), 10 );
- }
-
- function test_ids_exactly_as_limit() {
- $post_id_0 = $this->factory->post->create();
- $post_id_1 = $this->factory->post->create();
- $this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1 ), 2 );
- }
-
- function test_more_ids_than_limit() {
- $post_id_0 = $this->factory->post->create();
- $post_id_1 = $this->factory->post->create();
- $post_id_2 = $this->factory->post->create();
- $this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1, $post_id_2 ), 2 );
- }
-
- function test_ids_exactly_twice_more_than_limit() {
- $post_id_0 = $this->factory->post->create();
- $post_id_1 = $this->factory->post->create();
- $post_id_2 = $this->factory->post->create();
- $post_id_3 = $this->factory->post->create();
- $this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1, $post_id_2, $post_id_3 ), 2 );
- }
-
- private function assertIteratorReturnsSamePostIDs( $post_ids, $limit = 2 ) {
- $this->assertEquals( $post_ids, wp_list_pluck( iterator_to_array( new WP_Post_IDs_Iterator( $post_ids, $limit ) ), 'ID' ) );
- }
-}
</del></span></pre></div>
<a id="branches38testsphpunittestsl10nphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/l10n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/l10n.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/l10n.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,18 +14,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( load_textdomain( 'wp-tests-domain', $file ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_textdomain_loaded( 'wp-tests-domain' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( unload_textdomain( 'wp-tests-domain' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
- }
-
- /**
- * @ticket 21319
- */
- function test_is_textdomain_loaded_for_no_translations() {
- $this->assertFalse( load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/non-existent-file' ) );
- $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
- $this->assertInstanceOf( 'NOOP_Translations', get_translations_for_domain( 'wp-tests-domain' ) );
- // Ensure that we don't confuse NOOP_Translations to be a loaded text domain.
- $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
- $this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
- }
-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestslinkphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/link.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/link.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/link.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,10 +1,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group link
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
-class Tests_Link extends WP_UnitTestCase {
-
- function _get_pagenum_link_cb( $url ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ */
+class Tests_Link extends WP_UnitTestCase {
+
+ function tearDown() {
+ global $wp_rewrite;
+ $wp_rewrite->init();
+ parent::tearDown();
+ }
+
+ function _get_pagenum_link_cb( $url ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $url . '/WooHoo';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,12 +33,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $_SERVER['REQUEST_URI'] = $old_req_uri;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function test_wp_get_shortlink() {
- $post_id = $this->factory->post->create();
- $post_id2 = $this->factory->post->create();
-
- // Basic case
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function test_wp_get_shortlink() {
+ global $wp_rewrite;
+
+ $post_id = $this->factory->post->create();
+ $post_id2 = $this->factory->post->create();
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '' );
+ $wp_rewrite->flush_rules();
+
+ // Basic case
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $GLOBALS['post'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -57,13 +69,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Global post is not set, once again
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '', wp_get_shortlink( 0 ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( '', wp_get_shortlink() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( '', wp_get_shortlink() );
+
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+ $wp_rewrite->flush_rules();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $wp_rewrite;
- $wp_rewrite->permalink_structure = '';
- $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
- $wp_rewrite->flush_rules();
-
</del><span class="cx" style="display: block; padding: 0 10px"> // With a permalink structure set, get_permalink() will no longer match.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,13 +81,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Global post and permalink structure are set
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['post'] = get_post( $post_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
-
- $wp_rewrite->set_permalink_structure( '' );
- $wp_rewrite->flush_rules();
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
+ $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_wp_get_shortlink_with_page() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,18 +91,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Basic case
</span><span class="cx" style="display: block; padding: 0 10px"> // Don't test against get_permalink() since it uses ?page_id= for pages.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- global $wp_rewrite;
- $wp_rewrite->permalink_structure = '';
- $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
- $wp_rewrite->flush_rules();
-
- $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
-
- $wp_rewrite->set_permalink_structure( '' );
- $wp_rewrite->flush_rules();
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ global $wp_rewrite;
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+ $wp_rewrite->flush_rules();
+
+ $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 17807
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches38testsphpunittestsmailphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/mail.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/mail.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/mail.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,45 +67,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // We need some better assertions here but these catch the failure for now.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals($body, $GLOBALS['phpmailer']->mock_sent[0]['body']);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'boundary="----=_Part_4892_25692638.1192452070893"') > 0);
- $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'charset=') > 0);
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'boundary="----=_Part_4892_25692638.1192452070893"') > 0);
+ $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'charset=') > 0);
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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' => 'Here is some plain text.',
- 'text/html' =>'<html><head></head><body>Here is the HTML ;-)<body></html>' );
-
- wp_mail( $to, $subject, $messages );
-
- preg_match( '/boundary="(.*)"/', $GLOBALS['phpmailer']->mock_sent[0]['header'], $matches);
- $boundry = $matches[1];
- $body = '--' . $boundry . '
-Content-Type: text/plain; charset = "UTF-8"
-Content-Transfer-Encoding: 8bit
-
-Here is some plain text.
-
-
---' . $boundry . '
-Content-Type: text/html; charset = "UTF-8"
-Content-Transfer-Encoding: 8bit
-
-<html><head></head><body>Here is the HTML ;-)<body></html>
-
-
-
---' . $boundry . '--
-';
- // We need some better assertions here but these test the behaviour for now.
- $this->assertEquals($body, $GLOBALS['phpmailer']->mock_sent[0]['body']);
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 17305
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_mail_rfc2822_addresses() {
</span></span></pre></div>
<a id="branches38testsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/media.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/media.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -364,20 +364,46 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'image/jpeg',
</span><span class="cx" style="display: block; padding: 0 10px"> 'error' => 0,
</span><span class="cx" style="display: block; padding: 0 10px"> 'size' => filesize( $test_file ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ );
+
+ $post_id = media_handle_upload(
+ 'upload',
+ 0,
+ array(),
+ array(
+ 'action' => 'test_upload_titles',
+ 'test_form' => false,
+ /*
+ * This test previously failed on WP < 4.0 due to is_uploaded_file()
+ * and move_uploaded_file() usage in wp_handle_upload().
+ *
+ * Since successful upload is irrelevant for the purpose of this test,
+ * discarding upload errors allows the test to proceed.
+ */
+ 'upload_error_handler' => array( $this, '_discard_upload_errors' ),
+ )
+ );
+
+ unset( $_FILES['upload'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_id = media_handle_upload( 'upload', 0, array(), array( 'action' => 'test_upload_titles', 'test_form' => false ) );
-
- unset( $_FILES['upload'] );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $post = get_post( $post_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Clean up.
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_attachment( $post_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $this->assertEquals( 'This is a test', $post->post_title );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $this->assertEquals( 'This is a test', $post->post_title );
+ }
+
+ function _discard_upload_errors( &$file, $message ) {
+ $uploads = wp_upload_dir();
+ $filename = wp_unique_filename( $uploads['path'], $file['name'] );
+
+ $new_file = $uploads['path'] . "/$filename";
+ $url = $uploads['url'] . "/$filename";
+
+ return array( 'file' => $new_file, 'url' => $url, 'type' => $file['type'] );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 33016
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches38testsphpunittestsoptionblogOptionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/option/blogOption.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/option/blogOption.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/option/blogOption.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -17,83 +17,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function tearDown() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parent::tearDown();
- $wpdb->suppress_errors( $this->suppress );
- }
-
- function test_from_same_site() {
- $key = rand_str();
- $key2 = rand_str();
- $value = rand_str();
- $value2 = rand_str();
-
- $this->assertFalse( get_blog_option( 1, 'doesnotexist' ) );
- $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
-
- $this->assertTrue( add_blog_option( 1, $key, $value ) );
- // Assert all values of $blog_id that means the current or main blog (the same here).
- $this->assertEquals( $value, get_blog_option( 1, $key ) );
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_blog_option( '1', $key ) );
- $this->assertEquals( $value, get_option( $key ) ); // check get_option()
-
- $this->assertFalse( add_blog_option( 1, $key, $value ) ); // Already exists
- $this->assertFalse( update_blog_option( 1, $key, $value ) ); // Value is the same
- $this->assertTrue( update_blog_option( 1, $key, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
- $this->assertFalse( add_blog_option( 1, $key, $value ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
-
- $this->assertTrue( delete_blog_option( 1, $key ) );
- $this->assertFalse( get_blog_option( 1, $key ) );
- $this->assertFalse( get_option( $key ) ); // check get_option()
- $this->assertFalse( delete_blog_option( 1, $key ) );
- $this->assertTrue( update_blog_option( 1, $key2, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( 1, $key2 ) );
- $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
- $this->assertTrue( delete_blog_option( 1, $key2 ) );
- $this->assertFalse( get_blog_option( 1, $key2 ) );
- $this->assertFalse( get_option( $key2 ) ); // check get_option()
- }
-
- function test_from_same_site_with_null_blog_id() {
- $key = rand_str();
- $key2 = rand_str();
- $value = rand_str();
- $value2 = rand_str();
-
- $this->assertFalse( get_blog_option( null, 'doesnotexist' ) );
- $this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
-
- $this->assertTrue( add_blog_option( null, $key, $value ) );
- // Assert all values of $blog_id that means the current or main blog (the same here).
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_blog_option( null, $key ) );
- $this->assertEquals( $value, get_option( $key ) ); // check get_option()
-
- $this->assertFalse( add_blog_option( null, $key, $value ) ); // Already exists
- $this->assertFalse( update_blog_option( null, $key, $value ) ); // Value is the same
- $this->assertTrue( update_blog_option( null, $key, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( null, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
- $this->assertFalse( add_blog_option( null, $key, $value ) );
- $this->assertEquals( $value2, get_blog_option( null, $key ) );
- $this->assertEquals( $value2, get_option( $key ) ); // check get_option()
-
- $this->assertTrue( delete_blog_option( null, $key ) );
- $this->assertFalse( get_blog_option( null, $key ) );
- $this->assertFalse( get_option( $key ) ); // check get_option()
- $this->assertFalse( delete_blog_option( null, $key ) );
- $this->assertTrue( update_blog_option( null, $key2, $value2 ) );
- $this->assertEquals( $value2, get_blog_option( null, $key2 ) );
- $this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
- $this->assertTrue( delete_blog_option( null, $key2 ) );
- $this->assertFalse( get_blog_option( null, $key2 ) );
- $this->assertFalse( get_option( $key2 ) ); // check get_option()
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent::tearDown();
+ $wpdb->suppress_errors( $this->suppress );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_with_another_site() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $current_site, $base;
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunittestspostattachmentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/post/attachments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/post/attachments.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/post/attachments.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,15 +7,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Post_Attachments extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function tearDown() {
- // Remove all uploads.
- $uploads = wp_upload_dir();
- foreach ( scandir( $uploads['basedir'] ) as $file )
- _rmdir( $uploads['basedir'] . '/' . $file );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function tearDown() {
+ // Remove all uploads.
+ $this->remove_added_uploads();
+ parent::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parent::tearDown();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> function _make_attachment( $upload, $parent_post_id = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $type = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -209,26 +206,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($thumb['path']) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($medium['path']) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($original) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * GUID should never be empty
- * @ticket 18310
- * @ticket 21963
- */
- function test_insert_image_without_guid() {
- // 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->assertTrue( empty($upload['error']) );
-
- $upload['url'] = '';
- $id = $this->_make_attachment( $upload );
-
- $guid = get_the_guid( $id );
- $this->assertFalse( empty( $guid ) );
- }
-
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestspostfilteringphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/post/filtering.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/post/filtering.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/post/filtering.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,111 +88,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post($id);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $expected, $post->post_content );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+ // make sure unbalanced tags are untouched when the balance option is off
+ function test_post_content_nobalance_nextpage_more() {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * make sure unbalanced tags are fixed when they span a --more-- tag
- * @ticket 6297
- */
- function test_post_content_unbalanced_more() {
- $content = <<<EOF
-<em>some text<!--more-->
-that's continued after the jump</em>
-EOF;
-
- $expected = <<<EOF
-<em>some text</em><!--more-->
-that's continued after the jump
-EOF;
-
- $id = $this->factory->post->create( array( 'post_content' => $content ) );
- $post = get_post($id);
-
- $this->assertEquals( $expected, $post->post_content );
- }
-
- /**
- * make sure unbalanced tags are fixed when they span a --nextpage-- tag
- * @ticket 6297
- */
- function test_post_content_unbalanced_nextpage() {
- $content = <<<EOF
-<em>some text<!--nextpage-->
-that's continued after the jump</em>
-EOF;
-
- $expected = <<<EOF
-<em>some text</em><!--nextpage-->
-that's continued after the jump
-EOF;
-
- $id = $this->factory->post->create( array( 'post_content' => $content ) );
- $post = get_post($id);
-
- $this->assertEquals( $expected, $post->post_content );
- }
-
- /**
- * make sure unbalanced tags are fixed when they span both --more-- and --nextpage-- tags (in that order)
- * @ticket 6297
- */
- function test_post_content_unbalanced_more_nextpage() {
- $content = <<<EOF
-<em>some text<!--more-->
-that's continued after the jump</em>
-<!--nextpage-->
-<p>and the next page
-<!--nextpage-->
-breaks the graf</p>
-EOF;
-
- $expected = <<<EOF
-<em>some text</em><!--more-->
-that's continued after the jump
-<!--nextpage-->
-<p>and the next page
-</p><!--nextpage-->
-breaks the graf
-EOF;
-
- $id = $this->factory->post->create( array( 'post_content' => $content ) );
- $post = get_post($id);
-
- $this->assertEquals( $expected, $post->post_content );
- }
-
- /**
- * make sure unbalanced tags are fixed when they span both --nextpage-- and --more-- tags (in that order)
- * @ticket 6297
- */
- function test_post_content_unbalanced_nextpage_more() {
- $content = <<<EOF
-<em>some text<!--nextpage-->
-that's continued after the jump</em>
-<!--more-->
-<p>and the next page
-<!--nextpage-->
-breaks the graf</p>
-EOF;
-
- $expected = <<<EOF
-<em>some text</em><!--nextpage-->
-that's continued after the jump
-<!--more-->
-<p>and the next page
-</p><!--nextpage-->
-breaks the graf
-EOF;
-
- $id = $this->factory->post->create( array( 'post_content' => $content ) );
- $post = get_post($id);
-
- $this->assertEquals( $expected, $post->post_content );
- }
-
- // make sure unbalanced tags are untouched when the balance option is off
- function test_post_content_nobalance_nextpage_more() {
-
</del><span class="cx" style="display: block; padding: 0 10px"> update_option('use_balanceTags', 0);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $content = <<<EOF
</span></span></pre></div>
<a id="branches38testsphpunittestspostgalleryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/post/gallery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/post/gallery.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/post/gallery.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,156 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group media
- * @group gallery
- * @ticket UT30
- */
-class Tests_Post_Gallery extends WP_UnitTestCase { // _WPDataset1
- function setUp() {
- parent::setUp();
- global $wp_rewrite;
- $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
- $wp_rewrite->flush_rules();
- }
-
- function test_the_content() {
- // permalink page
- $link = '/2008/04/01/simple-gallery-test/';
- $this->go_to('/2008/04/01/simple-gallery-test/');
- the_post();
- // filtered output
- $out = get_echo('the_content');
- $this->assertNotEmpty($out, "Could not get the_content for $link.");
-
- $expected = <<<EOF
-<p>There are ten images attached to this post. Â Here’s a gallery:</p>
-
- <style type='text/css'>
- .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;
- }
- </style>
- <!-- see gallery_shortcode() in wp-includes/media.php -->
- <div class='gallery'><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20040724_152504_53/' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/canola/' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050315_145007_13/' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050604_133440_34/' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050831_165238_33/' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050901_105100_21/' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050813_115856_5/' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050720_123726_27/' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050727_091048_22/' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/2008/04/01/simple-gallery-test/dsc20050726_083116_18/' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-thumbnail" alt="" /></a>
- </dt></dl>
- <br style='clear: both;' />
- </div>
-
-<p>It’s the simplest form of the gallery tag. Â All images are from the public domain site burningwell.org.</p>
-<p>The images have various combinations of titles, captions and descriptions.</p>
-EOF;
- $this->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->assertNotNull($post, "get_post($id) could not find the post.");
- $post->post_content = '[gallery columns="1" size="medium"]';
- wp_update_post($post);
-
- // permalink page
- $this->go_to('/2008/04/01/simple-gallery-test/');
- the_post();
- // filtered output
- $out = get_echo('the_content');
-
- $expected = <<<EOF
- <style type='text/css'>
- .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;
- }
- </style>
- <!-- see gallery_shortcode() in wp-includes/media.php -->
- <div class='gallery'><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=565' title='dsc20040724_152504_53'><img src="http://example.com/wp-content/uploads/2008/04/dsc20040724_152504_537.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=566' title='canola'><img src="http://example.com/wp-content/uploads/2008/04/canola3.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=567' title='dsc20050315_145007_13'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050315_145007_134.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=568' title='dsc20050604_133440_34'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050604_133440_343.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=569' title='dsc20050831_165238_33'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050831_165238_333.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=570' title='dsc20050901_105100_21'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050901_105100_213.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=571' title='dsc20050813_115856_5'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050813_115856_54.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=572' title='dsc20050720_123726_27'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050720_123726_274.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=573' title='Title: Seedlings'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050727_091048_224.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" /><dl class='gallery-item'>
- <dt class='gallery-icon'>
- <a href='http://example.com/?attachment_id=574' title='dsc20050726_083116_18'><img src="http://example.com/wp-content/uploads/2008/04/dsc20050726_083116_184.jpg" class="attachment-medium" alt="" /></a>
- </dt></dl><br style="clear: both" />
- <br style='clear: both;' />
- </div>
-
-EOF;
- $this->assertEquals(strip_ws($expected), strip_ws($out));
- }
-
-}
</del></span></pre></div>
<a id="branches38testsphpunittestspostrevisionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/post/revisions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/post/revisions.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/post/revisions.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,50 +51,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> //is post_meta correctly set to revision author
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $admin_user_id, get_post_meta( $post_id, '_edit_last', true ) ); //after restoring user
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- wp_set_current_user( 0 );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ wp_set_current_user( 0 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 7392
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 9843
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_revision_dont_save_revision_if_unchanged() {
- $post = get_default_post_to_edit( 'post', true );
- $post_id = $post->ID;
-
- $this->assertCount( 0, wp_get_post_revisions( $post_id ) ); // No revisions on auto-draft creation.
-
- wp_update_post( array( 'post_status' => 'draft', 'post_title' => 'some-post', 'post_content' => 'some_content', 'ID' => $post_id ) );
-
- $this->assertCount( 1, wp_get_post_revisions( $post_id ) ); // Just the initial revision
-
- // First update
- wp_update_post( array( 'post_content' => 'some updated content', 'ID' => $post_id ) );
-
- $this->assertCount( 2, wp_get_post_revisions( $post_id ) ); // should be 2 revisions so far
-
- //update the post
- wp_update_post( array( 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //2nd revision
- $this->assertCount( 3, wp_get_post_revisions( $post_id ) ); // should be 3 revision so far
-
- //next try to save another identical update, tests for patch that prevents storing duplicates
- wp_update_post( array( 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //content unchanged, shouldn't save
- $this->assertCount( 3, wp_get_post_revisions( $post_id ) ); //should still be 3 revision
-
- //next try to save another update, same content, but new ttile, should save revision
- wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content' => 'new update for some updated content', 'ID' => $post_id ) );
- $this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should be 4 revision
-
- //next try to save another identical update
- wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content' => 'new update for some updated content', 'ID' => $post_id ) ); //content unchanged, shouldn't save
- $this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should still be 4 revision
- }
-
- /**
- * @ticket 7392
- * @ticket 9843
- */
</del><span class="cx" style="display: block; padding: 0 10px"> function test_revision_force_save_revision_even_if_unchanged() {
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'wp_save_post_revision_check_for_changes', '__return_false' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunittestspostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/post.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/post.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -444,11 +444,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function test_permalink_without_title() {
</span><span class="cx" style="display: block; padding: 0 10px"> // bug: permalink doesn't work if post title is empty
</span><span class="cx" style="display: block; padding: 0 10px"> // might only fail if the post ID is greater than four characters
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- global $wp_rewrite;
- $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
-
- $post = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ global $wp_rewrite;
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+ $wp_rewrite->flush_rules();
+
+ $post = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'post_author' => $this->author_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_status' => 'publish',
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_content' => rand_str(),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -733,66 +735,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( ( is_int($insert_post_id) && $insert_post_id > 0 ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post( $insert_post_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( $post->post_author, $this->author_id );
- $this->assertEquals( $post->post_title, $title );
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( $post->post_author, $this->author_id );
+ $this->assertEquals( $post->post_title, $title );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @ticket 19373
- */
- function test_insert_programmatic_without_current_user_success() {
- $this->_unset_current_user();
-
- register_taxonomy( 'test_tax', 'post' );
-
- $title = rand_str();
- $post_data = array(
- 'post_author' => $this->author_id,
- 'post_status' => 'public',
- 'post_content' => rand_str(),
- 'post_title' => $title,
- 'tax_input' => array(
- 'test_tax' => array( 'term', 'term2', 'term3' )
- )
- );
- // with sanitize set to false
- $insert_post_id = wp_insert_post( $post_data, true, false );
-
- $post = get_post( $insert_post_id );
- $this->assertEquals( $post->post_author, $this->author_id );
- $this->assertEquals( $post->post_title, $title );
-
- $terms = wp_get_object_terms( $insert_post_id, 'test_tax' );
- $this->assertTrue( ( is_array( $terms ) && count( $terms ) == 3 ) );
- }
-
- /**
- * @ticket 19373
- */
- function test_insert_programmatic_without_current_user_fail() {
- $this->_unset_current_user();
-
- register_taxonomy( 'test_tax', 'post' );
-
- $title = rand_str();
- $post_data = array(
- // post_author not set
- 'post_status' => 'public',
- 'post_content' => rand_str(),
- 'post_title' => $title,
- 'tax_input' => array(
- 'test_tax' => array( 'term', 'term2', 'term3' )
- )
- );
- // with sanitize set to false
- $insert_post_id = wp_insert_post( $post_data, true, false );
-
- // should error because no default user exists and no post author is passed in
- $this->assertInstanceOf( 'WP_Error', $insert_post_id );
- $this->assertEquals( 'empty_author', $insert_post_id->get_error_code() );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 24803
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_count_posts() {
</span></span></pre></div>
<a id="branches38testsphpunittestsqueryconditionalsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/query/conditionals.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/query/conditionals.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/query/conditionals.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,19 +21,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'comments_per_page', 5 );
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'posts_per_page', 5 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ global $wp_rewrite;
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+ create_initial_taxonomies();
+
+ $wp_rewrite->flush_rules();
+ }
+
+ function tearDown() {
+ global $wp_rewrite;
+ $wp_rewrite->init();
+
+ parent::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $wp_rewrite;
- update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
- create_initial_taxonomies();
- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
- }
-
- function tearDown() {
- $GLOBALS['wp_rewrite']->init();
- parent::tearDown();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> function test_home() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->go_to('/');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertQueryTrue('is_home');
</span></span></pre></div>
<a id="branches38testsphpunittestsqueryresultsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/query/results.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/query/results.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/query/results.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -277,34 +277,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( $this->q->is_paged() );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 18897
- */
- function test_query_offset_and_paged() {
- $posts = $this->q->query('paged=2&offset=3');
-
- $expected = array (
- 0 => 'many-trackbacks',
- 1 => 'one-trackback',
- 2 => 'comment-test',
- 3 => 'lorem-ipsum',
- 4 => 'cat-c',
- 5 => 'cat-b',
- 6 => 'cat-a',
- 7 => 'cats-a-and-c',
- 8 => 'cats-b-and-c',
- 9 => 'cats-a-and-b',
- );
-
- $this->assertCount( 10, $posts );
- $this->assertTrue( $this->q->is_paged() );
- $this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
- }
-
- /**
- * @ticket 11056
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 11056
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_query_post_parent__in() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Query for first parent's children
</span><span class="cx" style="display: block; padding: 0 10px"> $posts = $this->q->query( array(
</span></span></pre></div>
<a id="branches38testsphpunittestsquerytaxQueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/query/taxQuery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/query/taxQuery.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/query/taxQuery.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,24 +20,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $uncat;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $tag;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $tax;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setUp() {
- parent::setUp();
-
- set_current_screen( 'front' );
-
- update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
-
- $GLOBALS['wp_the_query'] = new WP_Query();
- $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
-
- create_initial_taxonomies();
- register_taxonomy( 'testtax', 'post', array( 'public' => true ) );
-
- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
-
- $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function setUp() {
+ global $wp_rewrite;
+ parent::setUp();
+
+ set_current_screen( 'front' );
+
+ $GLOBALS['wp_the_query'] = new WP_Query();
+ $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+ create_initial_taxonomies();
+ register_taxonomy( 'testtax', 'post', array( 'public' => true ) );
+
+ $wp_rewrite->flush_rules();
+
+ $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->cat_id = $this->factory->category->create( array( 'slug' => 'cat-slug' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->tax_id = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->tax_id2 = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,13 +55,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function tearDown() {
- parent::tearDown();
-
- _unregister_taxonomy( 'testtax' );
-
- remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function tearDown() {
+ global $wp_rewrite;
+ parent::tearDown();
+
+ _unregister_taxonomy( 'testtax' );
+
+ $wp_rewrite->init();
+
+ remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_tag_action_tax() {
</span></span></pre></div>
<a id="branches38testsphpunittestsqueryverboseRewriteRulesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/query/verboseRewriteRules.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/query/verboseRewriteRules.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/query/verboseRewriteRules.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,13 +6,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group query
</span><span class="cx" style="display: block; padding: 0 10px"> * @group rewrite
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
- function setUp() {
- parent::setUp();
- global $wp_rewrite;
- update_option( 'permalink_structure', '/%category%/%year%/%postname%/' );
- create_initial_taxonomies();
- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
- }
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
+ function setUp() {
+ global $wp_rewrite;
+
+ parent::setUp();
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%category%/%year%/%postname%/' );
+
+ create_initial_taxonomies();
+
+ $wp_rewrite->flush_rules();
+ }
+}
</ins></span></pre></div>
<a id="branches38testsphpunittestsqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/query.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/query.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,8 +1,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-class Tests_Query extends WP_UnitTestCase {
-
- /**
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+class Tests_Query extends WP_UnitTestCase {
+
+ function setUp() {
+ global $wp_rewrite;
+ parent::setUp();
+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+ create_initial_taxonomies();
+
+ $wp_rewrite->flush_rules();
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 16746
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_nextpage_at_start_of_content() {
</span></span></pre></div>
<a id="branches38testsphpunittestsrewritephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/rewrite.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/rewrite.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/rewrite.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,23 +6,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group rewrite
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Rewrite extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ function setUp() {
+ global $wp_rewrite;
+ parent::setUp();
+
+ // Need rewrite rules in place to use url_to_postid
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+ create_initial_taxonomies();
+
+ $wp_rewrite->flush_rules();
+ }
+
+ function tearDown() {
+ global $wp_rewrite;
+ $wp_rewrite->init();
+
+ parent::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function setUp() {
- parent::setUp();
-
- // Need rewrite rules in place to use url_to_postid
- global $wp_rewrite;
- update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
- create_initial_taxonomies();
- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
- }
-
- function tearDown() {
- $GLOBALS['wp_rewrite']->init();
- parent::tearDown();
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> function test_url_to_postid() {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $id = $this->factory->post->create();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,20 +36,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_url_to_postid_custom_post_type() {
- delete_option( 'rewrite_rules' );
-
- $post_type = rand_str( 12 );
- register_post_type( $post_type, array( 'public' => true ) );
-
- $id = $this->factory->post->create( array( 'post_type' => $post_type ) );
- $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
-
- _unregister_post_type( $post_type );
- }
-
- function test_url_to_postid_hierarchical() {
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_url_to_postid_custom_post_type() {
+ delete_option( 'rewrite_rules' );
+
+ $post_type = rand_str( 12 );
+ register_post_type( $post_type, array( 'public' => true ) );
+
+ $id = $this->factory->post->create( array( 'post_type' => $post_type ) );
+ $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+ _unregister_post_type( $post_type );
+ }
+
+ function test_url_to_postid_hierarchical() {
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $parent_id = $this->factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $child_id = $this->factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunittestsshortcodephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/shortcode.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/shortcode.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/shortcode.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -306,20 +306,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $test_string = "[footag]\n";
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 14050
- */
- function test_multiple_shortcode_unautop() {
- // a blank line is added at the end, so test with it already there
- $test_string = "[footag]\n[footag]\n";
- $actual = shortcode_unautop( wpautop( $test_string ) );
- $this->assertEquals( $test_string, $actual );
- }
-
- /**
- * @ticket 10326
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 10326
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_strip_shortcodes() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals('before', strip_shortcodes('before[gallery]'));
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals('after', strip_shortcodes('[gallery]after'));
</span></span></pre></div>
<a id="branches38testsphpunitteststaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/taxonomy.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/taxonomy.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -103,58 +103,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function test_register_long_taxonomy() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 11058
- */
- function test_registering_taxonomies_to_object_types() {
- // Create a taxonomy to test with
- $tax = 'test_tax';
- $this->assertFalse( taxonomy_exists($tax) );
- register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
-
- // Create a post type to test with
- $post_type = 'test_cpt';
- $this->assertFalse( get_post_type( $post_type ) );
- $this->assertObjectHasAttribute( 'name', register_post_type( $post_type ) );
-
- // Core taxonomy, core post type
- $this->assertTrue( unregister_taxonomy_for_object_type( 'category', 'post' ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'post' ) );
- $this->assertTrue( register_taxonomy_for_object_type( 'category', 'post' ) );
-
- // Core taxonomy, non-core post type
- $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
- $this->assertTrue( unregister_taxonomy_for_object_type( 'category', $post_type ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( 'category', $post_type ) );
- $this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
-
- // Core taxonomies, non-post object types
- $this->assertFalse( register_taxonomy_for_object_type( 'category', 'user' ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'user' ) );
-
- // Non-core taxonomy, core post type
- $this->assertTrue( unregister_taxonomy_for_object_type( $tax, 'post' ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'post' ) );
- $this->assertTrue( register_taxonomy_for_object_type( $tax, 'post' ) );
-
- // Non-core taxonomy, non-core post type
- $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
- $this->assertTrue( unregister_taxonomy_for_object_type( $tax, $post_type ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( $tax, $post_type ) );
- $this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
-
- // Non-core taxonomies, non-post object types
- $this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) );
- $this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );
-
- unset($GLOBALS['wp_taxonomies'][$tax]);
- _unregister_post_type( $post_type );
-
- }
- /**
- * @ticket 25706
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 25706
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_in_category() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post = $this->factory->post->create_and_get();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches38testsphpunitteststermphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/term.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/term.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/term.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -410,56 +410,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( array( $a, $b, $c, $d, $e, $f ) as $t )
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( wp_delete_term( $t['term_id'], $this->taxonomy ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 5809
- */
- function test_update_shared_term() {
- $random_tax = __FUNCTION__;
-
- register_taxonomy( $random_tax, 'post' );
-
- $post_id = $this->factory->post->create();
-
- $old_name = 'Initial';
-
- $t1 = wp_insert_term( $old_name, 'category' );
- $t2 = wp_insert_term( $old_name, 'post_tag' );
-
- $this->assertEquals( $t1['term_id'], $t2['term_id'] );
-
- wp_set_post_categories( $post_id, array( $t1['term_id'] ) );
- wp_set_post_tags( $post_id, array( (int) $t2['term_id'] ) );
-
- $new_name = 'Updated';
-
- // create the term in a third taxonomy, just to keep things interesting
- $t3 = wp_insert_term( $old_name, $random_tax );
- wp_set_post_terms( $post_id, array( (int) $t3['term_id'] ), $random_tax );
- $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
-
- $t2_updated = wp_update_term( $t2['term_id'], 'post_tag', array(
- 'name' => $new_name
- ) );
-
- $this->assertNotEquals( $t2_updated['term_id'], $t3['term_id'] );
-
- // make sure the terms have split
- $this->assertEquals( $old_name, get_term_field( 'name', $t1['term_id'], 'category' ) );
- $this->assertEquals( $new_name, get_term_field( 'name', $t2_updated['term_id'], 'post_tag' ) );
-
- // and that they are still assigned to the correct post
- $this->assertPostHasTerms( $post_id, array( $t1['term_id'] ), 'category' );
- $this->assertPostHasTerms( $post_id, array( $t2_updated['term_id'] ), 'post_tag' );
- $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
-
- // clean up
- unset( $GLOBALS['wp_taxonomies'][ $random_tax ] );
- }
-
- /**
- * @ticket 17646
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 17646
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_get_object_terms_types() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = $this->factory->post->create();
</span><span class="cx" style="display: block; padding: 0 10px"> $term = wp_insert_term( 'one', $this->taxonomy );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -496,32 +450,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $expected_term_ids, $assigned_term_ids );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * @ticket 24189
- */
- function test_object_term_cache_when_term_changes() {
- $post_id = $this->factory->post->create();
- $tag_id = $this->factory->tag->create( array( 'description' => 'My Amazing Tag' ) );
-
- $tt_1 = wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
-
- $terms = get_the_terms( $post_id, 'post_tag' );
- $this->assertEquals( $tag_id, $terms[0]->term_id );
- $this->assertEquals( 'My Amazing Tag', $terms[0]->description );
-
- $_updated = wp_update_term( $tag_id, 'post_tag', array(
- 'description' => 'This description is even more amazing!'
- ) );
-
- $_new_term = get_term( $tag_id, 'post_tag' );
- $this->assertEquals( $tag_id, $_new_term->term_id );
- $this->assertEquals( 'This description is even more amazing!', $_new_term->description );
-
- $terms = get_the_terms( $post_id, 'post_tag' );
- $this->assertEquals( $tag_id, $terms[0]->term_id );
- $this->assertEquals( 'This description is even more amazing!', $terms[0]->description );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> function test_wp_set_post_categories() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_id = $this->factory->post->create();
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post( $post_id );
</span></span></pre></div>
<a id="branches38testsphpunittestsuploadphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.8/tests/phpunit/tests/upload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/upload.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/upload.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,97 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-
-/**
- * @group upload
- * @group media
- */
-class Tests_Upload extends WP_UnitTestCase {
-
- var $siteurl;
-
- function setUp() {
- if ( is_multisite() )
- $this->knownUTBug( 35 );
-
- parent::setUp();
- return;
- // system defaults
- update_option( 'upload_path', 'wp-content/uploads' );
- update_option( 'upload_url_path', '' );
- update_option( 'uploads_use_yearmonth_folders', 1 );
- }
-
- function tearDown() {
- parent::tearDown();
-
- // Remove year/month folders created by wp_upload_dir().
- $uploads = wp_upload_dir();
- foreach ( scandir( $uploads['basedir'] ) as $file )
- _rmdir( $uploads['basedir'] . '/' . $file );
- _rmdir( ABSPATH . 'foo/' );
- }
-
- function test_upload_dir_default() {
- // wp_upload_dir() with default parameters
- $info = wp_upload_dir();
- $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
- $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
- function test_upload_dir_relative() {
- // wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'
- update_option( 'upload_path', 'foo/bar' );
- $info = wp_upload_dir();
- $this->assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
- $this->assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
- $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
- /**
- * @ticket 5953
- */
- function test_upload_dir_absolute() {
- $path = '/tmp/wp-unit-test';
- // wp_upload_dir() with an absolute upload path
- update_option( 'upload_path', $path );
- // doesn't make sense to use an absolute file path without setting the url path
- update_option( 'upload_url_path', '/baz' );
- $info = wp_upload_dir();
- $this->assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
- $this->assertEquals( "$path/" . gmstrftime('%Y/%m'), $info['path'] );
- $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
- function test_upload_dir_no_yearnum() {
- update_option( 'uploads_use_yearmonth_folders', 0 );
- $info = wp_upload_dir();
- $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
- $this->assertEquals( '', $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
- function test_upload_path_absolute() {
- update_option( 'upload_url_path', 'http://example.org/asdf' );
- $info = wp_upload_dir();
- $this->assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
- $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
- function test_upload_dir_empty() {
- // upload path setting is empty - it should default to 'wp-content/uploads'
- update_option('upload_path', '');
- $info = wp_upload_dir();
- $this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
- $this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
- $this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
- $this->assertEquals( '', $info['error'] );
- }
-
-}
</del></span></pre></div>
<a id="branches38testsphpunittestsuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/user.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/user.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -143,50 +143,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $user as $key => $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $value, $user->$key );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * Test the magic __unset method
- *
- * @ticket 20043
- */
- public function test_user_unset() {
- // New user
- $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
- $user = new WP_User( $user_id );
-
- // Test custom fields
- $user->customField = 123;
- $this->assertEquals( $user->customField, 123 );
- unset( $user->customField );
- $this->assertFalse( isset( $user->customField ) );
- return $user;
- }
-
- /**
- * @depends test_user_unset
- * @expectedDeprecated WP_User->id
- * @ticket 20043
- */
- function test_user_unset_lowercase_id( $user ) {
- // Test 'id' (lowercase)
- unset( $user->id );
- return $user;
- }
-
- /**
- * @depends test_user_unset_lowercase_id
- * @ticket 20043
- */
- function test_user_unset_uppercase_id( $user ) {
- // Test 'ID'
- $this->assertNotEmpty( $user->ID );
- unset( $user->ID );
- $this->assertEmpty( $user->ID );
- }
-
- // Test meta property magic functions for property get/set/isset.
- function test_user_meta_properties() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+ // Test meta property magic functions for property get/set/isset.
+ function test_user_meta_properties() {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
</span></span></pre></div>
<a id="branches38testsphpunittestsxmlrpcwpuploadFilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.8/tests/phpunit/tests/xmlrpc/wp/uploadFile.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.8/tests/phpunit/tests/xmlrpc/wp/uploadFile.php 2020-02-21 10:46:53 UTC (rev 47337)
+++ branches/3.8/tests/phpunit/tests/xmlrpc/wp/uploadFile.php 2020-02-21 13:05:39 UTC (rev 47338)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,53 +27,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'string', $result['file'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'string', $result['url'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'string', $result['type'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * @ticket 21292
- */
- function test_network_limit() {
- $this->make_user_by_role( 'editor' );
-
- update_option( 'blog_upload_space', 0.1 );
-
- // create attachment
- $filename = ( DIR_TESTDATA . '/images/canola.jpg' );
- $contents = file_get_contents( $filename );
- $data = array(
- 'name' => 'canola.jpg',
- 'type' => 'image/jpeg',
- 'bits' => $contents
- );
-
- $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
-
- // Only multisite should have a limit
- if ( is_multisite() )
- $this->assertInstanceOf( 'IXR_Error', $result );
- else
- $this->assertNotInstanceOf( 'IXR_Error', $result );
- }
-
- /**
- * @ticket 11946
- */
- function test_valid_mime() {
- $this->make_user_by_role( 'editor' );
-
- // create attachment
- $filename = ( DIR_TESTDATA . '/images/test-image-mime-jpg.png' );
- $contents = file_get_contents( $filename );
- $data = array(
- 'name' => 'test-image-mime-jpg.png',
- 'type' => 'image/png',
- 'bits' => $contents
- );
-
- $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
-
- $this->assertNotInstanceOf( 'IXR_Error', $result );
-
- $this->assertEquals( 'image/jpeg', $result['type'] );
- }
-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+
+}
</ins></span></pre>
</div>
</div>
</body>
</html>