<!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>[47329] branches/3.9: Build/Test Tools: Fix the Travis CI build for the 3.9 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/47329">47329</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/47329","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-20 17:04:42 +0000 (Thu, 20 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.9 branch.
Among other fixes, this backports <a href="https://core.trac.wordpress.org/changeset/28943">[28943]</a>, <a href="https://core.trac.wordpress.org/changeset/28961">[28961]</a>, [28964-28968], <a href="https://core.trac.wordpress.org/changeset/28988">[28988]</a>, <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="https://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-3051
4], [30516-30521], [30523-30524], <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/33374">[33374]</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="#branches39travisyml">branches/3.9/.travis.yml</a></li>
<li><a href="#branches39packagejson">branches/3.9/package.json</a></li>
<li><a href="#branches39phpunitxmldist">branches/3.9/phpunit.xml.dist</a></li>
<li><a href="#branches39testsphpunitincludestestcasephp">branches/3.9/tests/phpunit/includes/testcase.php</a></li>
<li><a href="#branches39testsphpunitincludesutilsphp">branches/3.9/tests/phpunit/includes/utils.php</a></li>
<li><a href="#branches39testsphpunitmultisitexml">branches/3.9/tests/phpunit/multisite.xml</a></li>
<li><a href="#branches39testsphpunittestsajaxMediaEditphp">branches/3.9/tests/phpunit/tests/ajax/MediaEdit.php</a></li>
<li><a href="#branches39testsphpunittestscanonicalcustomRulesphp">branches/3.9/tests/phpunit/tests/canonical/customRules.php</a></li>
<li><a href="#branches39testsphpunittestscanonicalpageOnFrontphp">branches/3.9/tests/phpunit/tests/canonical/pageOnFront.php</a></li>
<li><a href="#branches39testsphpunittestscanonicalphp">branches/3.9/tests/phpunit/tests/canonical.php</a></li>
<li><a href="#branches39testsphpunittestsdependenciesscriptsphp">branches/3.9/tests/phpunit/tests/dependencies/scripts.php</a></li>
<li><a href="#branches39testsphpunittestsfeedrss2php">branches/3.9/tests/phpunit/tests/feed/rss2.php</a></li>
<li><a href="#branches39testsphpunittestsfiltersphp">branches/3.9/tests/phpunit/tests/filters.php</a></li>
<li><a href="#branches39testsphpunittestsformattingEscUrlphp">branches/3.9/tests/phpunit/tests/formatting/EscUrl.php</a></li>
<li><a href="#branches39testsphpunittestsformattingMakeClickablephp">branches/3.9/tests/phpunit/tests/formatting/MakeClickable.php</a></li>
<li><a href="#branches39testsphpunittestsformattingSanitizeTitleWithDashesphp">branches/3.9/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php</a></li>
<li><a href="#branches39testsphpunittestsformattingSanitizeUserphp">branches/3.9/tests/phpunit/tests/formatting/SanitizeUser.php</a></li>
<li><a href="#branches39testsphpunittestsfunctionsdeprecatedphp">branches/3.9/tests/phpunit/tests/functions/deprecated.php</a></li>
<li><a href="#branches39testsphpunittestsfunctionsphp">branches/3.9/tests/phpunit/tests/functions.php</a></li>
<li><a href="#branches39testsphpunittestshttpbasephp">branches/3.9/tests/phpunit/tests/http/base.php</a></li>
<li><a href="#branches39testsphpunittestshttpfunctionsphp">branches/3.9/tests/phpunit/tests/http/functions.php</a></li>
<li><a href="#branches39testsphpunittestsimagebasephp">branches/3.9/tests/phpunit/tests/image/base.php</a></li>
<li><a href="#branches39testsphpunittestsimageeditor_gdphp">branches/3.9/tests/phpunit/tests/image/editor_gd.php</a></li>
<li><a href="#branches39testsphpunittestsimageeditor_imagickphp">branches/3.9/tests/phpunit/tests/image/editor_imagick.php</a></li>
<li><a href="#branches39testsphpunittestsimagefunctionsphp">branches/3.9/tests/phpunit/tests/image/functions.php</a></li>
<li><a href="#branches39testsphpunittestsimageintermediate_sizephp">branches/3.9/tests/phpunit/tests/image/intermediate_size.php</a></li>
<li><a href="#branches39testsphpunittestsimageresizephp">branches/3.9/tests/phpunit/tests/image/resize.php</a></li>
<li><a href="#branches39testsphpunittestsimageresize_gdphp">branches/3.9/tests/phpunit/tests/image/resize_gd.php</a></li>
<li><a href="#branches39testsphpunittestsimageresize_imagickphp">branches/3.9/tests/phpunit/tests/image/resize_imagick.php</a></li>
<li><a href="#branches39testsphpunittestsl10nphp">branches/3.9/tests/phpunit/tests/l10n.php</a></li>
<li><a href="#branches39testsphpunittestslinkphp">branches/3.9/tests/phpunit/tests/link.php</a></li>
<li><a href="#branches39testsphpunittestsmailphp">branches/3.9/tests/phpunit/tests/mail.php</a></li>
<li><a href="#branches39testsphpunittestsmediaphp">branches/3.9/tests/phpunit/tests/media.php</a></li>
<li><a href="#branches39testsphpunittestsoptionblogOptionphp">branches/3.9/tests/phpunit/tests/option/blogOption.php</a></li>
<li><a href="#branches39testsphpunittestsoptiontransientphp">branches/3.9/tests/phpunit/tests/option/transient.php</a></li>
<li><a href="#branches39testsphpunittestspostattachmentsphp">branches/3.9/tests/phpunit/tests/post/attachments.php</a></li>
<li><a href="#branches39testsphpunittestspostfilteringphp">branches/3.9/tests/phpunit/tests/post/filtering.php</a></li>
<li><a href="#branches39testsphpunittestspostrevisionsphp">branches/3.9/tests/phpunit/tests/post/revisions.php</a></li>
<li><a href="#branches39testsphpunittestspostphp">branches/3.9/tests/phpunit/tests/post.php</a></li>
<li><a href="#branches39testsphpunittestsqueryconditionalsphp">branches/3.9/tests/phpunit/tests/query/conditionals.php</a></li>
<li><a href="#branches39testsphpunittestsqueryresultsphp">branches/3.9/tests/phpunit/tests/query/results.php</a></li>
<li><a href="#branches39testsphpunittestsquerytaxQueryphp">branches/3.9/tests/phpunit/tests/query/taxQuery.php</a></li>
<li><a href="#branches39testsphpunittestsqueryverboseRewriteRulesphp">branches/3.9/tests/phpunit/tests/query/verboseRewriteRules.php</a></li>
<li><a href="#branches39testsphpunittestsqueryphp">branches/3.9/tests/phpunit/tests/query.php</a></li>
<li><a href="#branches39testsphpunittestsrewritephp">branches/3.9/tests/phpunit/tests/rewrite.php</a></li>
<li><a href="#branches39testsphpunittestsshortcodephp">branches/3.9/tests/phpunit/tests/shortcode.php</a></li>
<li><a href="#branches39testsphpunitteststaxonomyphp">branches/3.9/tests/phpunit/tests/taxonomy.php</a></li>
<li><a href="#branches39testsphpunitteststermphp">branches/3.9/tests/phpunit/tests/term.php</a></li>
<li><a href="#branches39testsphpunittestsuserlistAuthorsphp">branches/3.9/tests/phpunit/tests/user/listAuthors.php</a></li>
<li><a href="#branches39testsphpunittestsuserphp">branches/3.9/tests/phpunit/tests/user.php</a></li>
<li><a href="#branches39testsphpunittestsxmlrpcwpuploadFilephp">branches/3.9/tests/phpunit/tests/xmlrpc/wp/uploadFile.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#branches39testsphpunittestscanonicalpermalinkFormatsphp">branches/3.9/tests/phpunit/tests/canonical/permalinkFormats.php</a></li>
<li><a href="#branches39testsphpunittestsexportclasswpexportqueryphp">branches/3.9/tests/phpunit/tests/export/class-wp-export-query.php</a></li>
<li><a href="#branches39testsphpunittestsexportfunctionsexportphp">branches/3.9/tests/phpunit/tests/export/functions.export.php</a></li>
<li><a href="#branches39testsphpunittestsexportwritersphp">branches/3.9/tests/phpunit/tests/export/writers.php</a></li>
<li><a href="#branches39testsphpunittestsiteratorsphp">branches/3.9/tests/phpunit/tests/iterators.php</a></li>
<li><a href="#branches39testsphpunittestspostgalleryphp">branches/3.9/tests/phpunit/tests/post/gallery.php</a></li>
<li><a href="#branches39testsphpunittestsuploadphp">branches/3.9/tests/phpunit/tests/upload.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches39">branches/3.9/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/3.9
</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.9 2020-02-20 16:56:17 UTC (rev 47328)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/3.9 2020-02-20 17:04:42 UTC (rev 47329)
</ins><a id="branches39"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/3.9</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:28158,28161,28163,28165-28166,28168-28169,28171-28174,28176-28187,28189-28191,28193-28195,28203,28219,28223,28266,28269,28275-28276,28280,28284,29327,29377-29378,29381-29382,29397,29404,29631,29783,30412,30417,30422,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,40241,40400,40604,40677,40692,40704,40723,40736,41072,41393,41398,41457,41470,41483,41496,41522,41662,42056,42119-42120,42258-42261,42424,42433,42892-42893,44048,44842,45936,45971,45997,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:28158,28161,28163,28165-28166,28168-28169,28171-28174,28176-28187,28189-28191,28193-28195,28203,28219,28223,28266,28269,28275-28276,28280,28284,28943,28961,28964-28968,28988,29120,29251,29327,29377-29378,29381-29382,29397,29404,29503,29631,29783,29860,29869,29954,30001,30160,30282,30285,30289-30291,30412,30417,30422,30425,30430,30435,30438,30443,30458,30466,30513-30514,30516-30521,30524,30526,30529-30530,31253-31254,31257-31259,31622,33124,33142,33374,36083,36435,37651,38524,39645,39659,39759,39772,39795,39807-39808,39831,39850,39956,40148,40169,40183,40241,40255,40257,40259,40269,40271,40400,40538,40604,40677,40692,40704,40723,40736,41072,41393,41398,41457,41470,41483,41496,41522,41662,42056,42119-42120,42258-42261,42424,42433,42892-42893,44048,44842,44993,45936,45971,45997,46895
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches39travisyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/.travis.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/.travis.yml 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/.travis.yml 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,30 +1,91 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Travis CI Configuration File
+sudo: false
</ins><span class="cx" style="display: block; padding: 0 10px"> dist: trusty
</span><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><span class="cx" style="display: block; padding: 0 10px"> # Build matrix options
</span><span class="cx" style="display: block; padding: 0 10px"> matrix:
</span><span class="cx" style="display: block; padding: 0 10px"> include:
</span><span class="cx" style="display: block; padding: 0 10px"> - php: 5.5
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ env: WP_TRAVISCI=travis:js
+ - php: 5.5
+ env: WP_TRAVISCI=travis:phpunit
</ins><span class="cx" style="display: block; padding: 0 10px"> - php: 5.2
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ env: WP_TRAVISCI=travis:phpunit
</ins><span class="cx" style="display: block; padding: 0 10px"> dist: precise
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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 travis
</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">@@ -32,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="branches39packagejson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/package.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/package.json 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/package.json 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,21 +10,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "license": "GPLv2 or later",
</span><span class="cx" style="display: block; padding: 0 10px"> "devDependencies": {
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt": "~0.4.2",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-autoprefixer": "~0.7.1",
</ins><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.6.0",
+ "grunt-contrib-concat": "~0.3.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-copy": "~0.5.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-cssmin": "~0.7.0",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-contrib-imagemin": "~0.4.1",
+ "grunt-contrib-jshint": "~0.10.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-qunit": "~0.4.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-uglify": "~0.3.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-contrib-watch": "~0.5.3",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "grunt-contrib-compress": "~0.6.0",
- "grunt-contrib-concat": "~0.3.0",
- "grunt-contrib-jshint": "~0.8.0",
</del><span class="cx" style="display: block; padding: 0 10px"> "grunt-cssjanus": "~0.2.2",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "grunt-sass": "~1.0.0",
- "grunt-autoprefixer": "~0.7.1",
</del><span class="cx" style="display: block; padding: 0 10px"> "grunt-jsvalidate": "~0.2.2",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "grunt-contrib-imagemin" : "~0.4.1",
- "grunt-patch-wordpress" : "~0.2.1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "grunt-legacy-util": "^0.2.0",
+ "grunt-patch-wordpress": "~0.2.1",
+ "grunt-sass": "~0.16.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "matchdep": "~0.3.0"
</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="branches39phpunitxmldist"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/phpunit.xml.dist</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/phpunit.xml.dist 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/phpunit.xml.dist 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunitincludestestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/includes/testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/includes/testcase.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/includes/testcase.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,6 +11,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $expected_doing_it_wrong = array();
</span><span class="cx" style="display: block; padding: 0 10px"> protected $caught_doing_it_wrong = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static $hooks_saved = array();
+ protected static $ignore_files;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @var WP_UnitTest_Factory
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,22 +22,75 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><span class="cx" style="display: block; padding: 0 10px"> set_time_limit(0);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! self::$ignore_files ) {
+ self::$ignore_files = $this->scan_user_uploads();
+ }
+
+ if ( ! self::$hooks_saved ) {
+ $this->_backup_hooks();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><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, $wp_query, $post;
</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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_multisite() ) {
+ while ( ms_is_switched() ) {
+ restore_current_blog();
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> $wp_query = new WP_Query();
</span><span class="cx" style="display: block; padding: 0 10px"> $post = null;
</span><span class="cx" style="display: block; padding: 0 10px"> remove_theme_support( 'html5' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,6 +97,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->_restore_hooks();
+ 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">
</span><span class="cx" style="display: block; padding: 0 10px"> function clean_up_global_scope() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -70,6 +128,44 @@
</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">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * 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 ];
+ }
+ }
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function flush_cache() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_object_cache->group_ops = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -231,6 +327,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> protected function checkRequirements() {
</span><span class="cx" style="display: block; padding: 0 10px"> parent::checkRequirements();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // 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;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( WP_TESTS_FORCE_KNOWN_BUGS )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> $tickets = PHPUnit_Util_Test::getTickets( get_class( $this ), $this->getName( false ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -353,4 +455,54 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $message .= implode( $not_false, ', ' ) . ' should be false.';
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( $passed, $message );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</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">+
+ 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 class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="branches39testsphpunitincludesutilsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/includes/utils.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/includes/utils.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/includes/utils.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -334,18 +334,6 @@
</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">
</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 );
- }
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Removes the post type and its taxonomy associations.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches39testsphpunitmultisitexml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/multisite.xml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/multisite.xml 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/multisite.xml 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsajaxMediaEditphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/ajax/MediaEdit.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/ajax/MediaEdit.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/ajax/MediaEdit.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,14 +32,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function tearDown() {
</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">- foreach ($this->_ids as $id){
- wp_delete_attachment($id, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $this->_ids as $id ) {
+ wp_delete_attachment( $id, true );
</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">- $uploads = wp_upload_dir();
- foreach ( scandir( $uploads['basedir'] ) as $file )
- _rmdir( $uploads['basedir'] . '/' . $file );
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</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="branches39testsphpunittestscanonicalcustomRulesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/canonical/customRules.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/canonical/customRules.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/canonical/customRules.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,7 +29,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Custom Rewrite rules leading to Categories
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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><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="branches39testsphpunittestscanonicalpageOnFrontphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/canonical/pageOnFront.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/canonical/pageOnFront.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/canonical/pageOnFront.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,9 +15,15 @@
</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><span class="cx" style="display: block; padding: 0 10px"> update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->init();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- flush_rewrite_rules();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->flush_rules();
</ins><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 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="branches39testsphpunittestscanonicalpermalinkFormatsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/tests/phpunit/tests/canonical/permalinkFormats.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/canonical/permalinkFormats.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/canonical/permalinkFormats.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestscanonicalphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/canonical.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/canonical.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/canonical.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,6 +19,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var $term_ids;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
+
</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"> update_option( 'page_comments', true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,11 +27,13 @@
</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><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'permalink_structure', $this->structure );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( $this->structure );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> create_initial_taxonomies();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->flush_rules();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->old_current_user = get_current_user_id();
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,9 +84,10 @@
</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"> function tearDown() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_set_current_user( $this->old_current_user );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</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">@@ -175,8 +180,6 @@
</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><span class="cx" style="display: block; padding: 0 10px"> array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/category/child-1/', '/category/parent/child-1/', 18734 ),
- array( '/category/foo/child-1/', '/category/parent/child-1/', 18734 ),
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Categories & Intersections with other vars
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -186,17 +189,10 @@
</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><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Categories with Dates
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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 ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
</ins><span class="cx" style="display: block; padding: 0 10px"> // array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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 ),
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Pages
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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 ),
</del><span class="cx" style="display: block; padding: 0 10px"> array( '/child-page-1/', '/parent-page/child-page-1/'),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?page_id=144', '/parent-page/child-page-1/'),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/abo', '/about/' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,14 +212,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="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 ?!
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/2008/09/03/images-test/8/', '/2008/09/03/images-test/4/', 11694 ), // post with 4 pages
</del><span class="cx" style="display: block; padding: 0 10px"> array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Comments
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Attachments
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -246,9 +239,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Authors
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?author=%d', '/author/canonical-author/' ),
</span><span class="cx" style="display: block; padding: 0 10px"> // array( '/?author=%d&year=2008', '/2008/?author=3'),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/?author=%d&year=2008', '/author/canonical-author/?year=2008', 17661 ),
</del><span class="cx" style="display: block; padding: 0 10px"> // array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- array( '/author/canonical-author/?year=2008', '/author/canonical-author/?year=2008', 17661 ),
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Feeds
</span><span class="cx" style="display: block; padding: 0 10px"> array( '/?feed=atom', '/feed/atom/' ),
</span></span></pre></div>
<a id="branches39testsphpunittestsdependenciesscriptsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/dependencies/scripts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/dependencies/scripts.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/dependencies/scripts.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,36 +84,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Cleanup
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_scripts->base_url = $base_url_backup;
</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 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><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches39testsphpunittestsexportclasswpexportqueryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/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.9/tests/phpunit/tests/export/class-wp-export-query.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/export/class-wp-export-query.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsexportfunctionsexportphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/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.9/tests/phpunit/tests/export/functions.export.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/export/functions.export.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsexportwritersphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/tests/phpunit/tests/export/writers.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/export/writers.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/export/writers.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsfeedrss2php"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/feed/rss2.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/feed/rss2.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/feed/rss2.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -110,12 +110,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals(strtotime($posts[$i]->post_date), strtotime($pubdate[0]['content']));
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // author
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $creator = xml_find($items[$i]['child'], 'dc:creator');
- $this->assertEquals($this->author->user_nicename, $creator[0]['content']);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $creator = xml_find( $items[$i]['child'], 'dc:creator' );
+ $user = new WP_User( $posts[$i]->post_author );
+ $this->assertEquals( $user->user_login, $creator[0]['content'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // categories (perhaps multiple)
</span><span class="cx" style="display: block; padding: 0 10px"> $categories = xml_find($items[$i]['child'], 'category');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $cat_ids = wp_get_post_categories($post->ID);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $cat_ids = wp_get_post_categories($posts[$i]->ID);
</ins><span class="cx" style="display: block; padding: 0 10px"> if (empty($cat_ids)) $cat_ids = array(1);
</span><span class="cx" style="display: block; padding: 0 10px"> // should be the same number of categories
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals(count($cat_ids), count($categories));
</span></span></pre></div>
<a id="branches39testsphpunittestsfiltersphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/filters.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/filters.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/filters.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,22 +249,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> remove_action( $tag, array($this, '_self_removal'), 10, 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> return $tag;
</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 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><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches39testsphpunittestsformattingEscUrlphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/formatting/EscUrl.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/formatting/EscUrl.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/formatting/EscUrl.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,18 +63,6 @@
</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"> /**
</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]' ) );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 21974
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_protocol_relative_with_colon() {
</span></span></pre></div>
<a id="branches39testsphpunittestsformattingMakeClickablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/formatting/MakeClickable.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/formatting/MakeClickable.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/formatting/MakeClickable.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -365,23 +365,6 @@
</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"> /**
</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"> * @ticket 19028
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_line_break_in_existing_clickable_link() {
</span></span></pre></div>
<a id="branches39testsphpunittestsformattingSanitizeTitleWithDashesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsformattingSanitizeUserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/formatting/SanitizeUser.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/formatting/SanitizeUser.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/formatting/SanitizeUser.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsfunctionsdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/functions/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/functions/deprecated.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/functions/deprecated.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,7 +148,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_save_image_file( $file, $img, 'image/jpeg', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> imagedestroy( $img );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- @unlink($file);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $file );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if the arg was deprecated
</span><span class="cx" style="display: block; padding: 0 10px"> $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -169,7 +169,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_save_image_file( $file, $img, 'image/jpeg', 1 );
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $img );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- @unlink($file);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $file );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check if the arg was deprecated
</span><span class="cx" style="display: block; padding: 0 10px"> $check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
</span></span></pre></div>
<a id="branches39testsphpunittestsfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/functions.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/functions.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -131,9 +131,6 @@
</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><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 9930
- */
</del><span class="cx" style="display: block; padding: 0 10px"> function test_is_serialized() {
</span><span class="cx" style="display: block; padding: 0 10px"> $cases = array(
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(null),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -142,7 +139,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(-25),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(25),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(1.1),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- serialize(2.1E+200),
</del><span class="cx" style="display: block; padding: 0 10px"> serialize('this string will be serialized'),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize("a\nb"),
</span><span class="cx" style="display: block; padding: 0 10px"> serialize(array()),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -155,7 +151,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $not_serialized = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'a string',
</span><span class="cx" style="display: block; padding: 0 10px"> 'garbage:a:0:garbage;',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'b:4;',
</del><span class="cx" style="display: block; padding: 0 10px"> 's:4:test;'
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $not_serialized as $case )
</span></span></pre></div>
<a id="branches39testsphpunittestshttpbasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/http/base.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/http/base.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/http/base.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -284,6 +284,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $res = wp_remote_get( 'https://wordpress.org/' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</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">+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches39testsphpunittestshttpfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/http/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/http/functions.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/http/functions.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,9 +5,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group external-http
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_HTTP_Functions extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function setUp() {
+ if ( ! extension_loaded( 'openssl' ) ) {
+ $this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
+ }
+
+ parent::setUp();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_head_request() {
</span><span class="cx" style="display: block; padding: 0 10px"> // this url give a direct 200 response
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $response = wp_remote_head( $url );
</span><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_remote_retrieve_headers( $response );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,13 +27,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_head_redirect() {
</span><span class="cx" style="display: block; padding: 0 10px"> // this url will 301 redirect
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $response = wp_remote_head( $url );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '301', 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><span class="cx" style="display: block; padding: 0 10px"> function test_head_404() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_remote_head( $url );
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,7 +41,7 @@
</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"> function test_get_request() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = tempnam('/tmp', 'testfile');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http($url, $file);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,7 +59,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_get_redirect() {
</span><span class="cx" style="display: block; padding: 0 10px"> // this will redirect to asdftestblog1.files.wordpress.com
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = tempnam('/tmp', 'testfile');
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http($url, $file);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -69,7 +77,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_get_redirect_limit_exceeded() {
</span><span class="cx" style="display: block; padding: 0 10px"> // this will redirect to asdftestblog1.files.wordpress.com
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
</ins><span class="cx" style="display: block; padding: 0 10px"> $file = tempnam('/tmp', 'testfile');
</span><span class="cx" style="display: block; padding: 0 10px"> // pretend we've already redirected 5 times
</span><span class="cx" style="display: block; padding: 0 10px"> $headers = wp_get_http( $url, $file, 6 );
</span></span></pre></div>
<a id="branches39testsphpunittestsimagebasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/image/base.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/image/base.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/base.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,6 +9,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Set the image editor engine according to the unit test's specification
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setUp() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent::setUp();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! call_user_func( array( $this->editor_engine, 'test' ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( sprintf('The image editor engine %s is not supported on this system', $this->editor_engine) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,7 +22,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Undo the image editor override
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function tearDown() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent::tearDown();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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 class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,7 +38,7 @@
</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"> * Helper assertion for testing alpha on images
</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">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $image_path
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $point array(x,y)
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $alpha
</span></span></pre></div>
<a id="branches39testsphpunittestsimageeditor_gdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/image/editor_gd.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/editor_gd.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +6,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group media
</span><span class="cx" style="display: block; padding: 0 10px"> * @group wp-image-editor-gd
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/base.php' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +19,7 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function shutDown() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tearDown() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( glob( $folder ) as $file ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,7 +26,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> unlink( $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">- parent::shutDown();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $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">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -467,6 +470,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->save( $save_to_file );
</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><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">@@ -485,5 +490,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->save( $save_to_file );
</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><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></pre></div>
<a id="branches39testsphpunittestsimageeditor_imagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/image/editor_imagick.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/editor_imagick.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +6,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group media
</span><span class="cx" style="display: block; padding: 0 10px"> * @group wp-image-editor-imagick
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/base.php' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +19,7 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function shutDown() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tearDown() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $folder = DIR_TESTDATA . '/images/waffles-*.jpg';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( glob( $folder ) as $file ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,7 +26,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> unlink( $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">- parent::shutDown();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $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">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -463,10 +466,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->load();
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->resize( 5, 5 );
</span><span class="cx" style="display: block; padding: 0 10px"> $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
</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">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $editor->save( $save_to_file );
</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><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">@@ -485,5 +490,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $editor->save( $save_to_file );
</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><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></pre></div>
<a id="branches39testsphpunittestsimagefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/image/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/image/functions.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/functions.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,7 +88,7 @@
</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><span class="cx" style="display: block; padding: 0 10px"> $files = array(
</span><span class="cx" style="display: block; padding: 0 10px"> // 'test-image-cmyk.jpg', Allowed in r9727
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'test-image.bmp',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // 'test-image.bmp', Allowed in r28589
</ins><span class="cx" style="display: block; padding: 0 10px"> // 'test-image-grayscale.jpg', Allowed in r9727
</span><span class="cx" style="display: block; padding: 0 10px"> 'test-image.pct',
</span><span class="cx" style="display: block; padding: 0 10px"> 'test-image.tga',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,8 +144,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Clean up
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- @unlink( $file );
- @unlink( $ret['path'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $file );
+ unlink( $ret['path'] );
</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"> // Clean up
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -185,8 +185,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Clean up
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- @unlink( $file );
- @unlink( $ret['path'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $file );
+ unlink( $ret['path'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> unset( $img );
</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">@@ -231,8 +231,7 @@
</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">- @unlink( $file );
- @unlink( $ret['path'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $ret['path'] );
</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"> // Clean up
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -291,7 +290,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !function_exists( 'imagejpeg' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( 'jpeg support unavailable' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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',
</ins><span class="cx" style="display: block; padding: 0 10px"> 0, 0, 100, 100, 100, 100, false,
</span><span class="cx" style="display: block; padding: 0 10px"> DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotInstanceOf( 'WP_Error', $file );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -311,7 +314,11 @@
</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"> public function test_wp_crop_image_url_not_exist() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 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',
</ins><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></span></pre></div>
<a id="branches39testsphpunittestsimageintermediate_sizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/image/intermediate_size.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/intermediate_size.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,4 @@
</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">-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</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><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,6 +5,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function tearDown() {
+ $this->remove_added_uploads();
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_make_intermediate_size_no_size() {
</span><span class="cx" style="display: block; padding: 0 10px"> $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches39testsphpunittestsimageresizephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/image/resize.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/image/resize.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/resize.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,10 @@
</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><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group resize
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/base.php' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_resize_jpg() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,7 +111,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 100, $h );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( IMAGETYPE_JPEG, $type );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unlink($image);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unlink( $image );
</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_resize_thumb_50x150_crop() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,17 +138,6 @@
</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"> /**
</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() );
- }
-
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * Function to help out the tests
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function resize_helper( $file, $width, $height, $crop = false ) {
</span></span></pre></div>
<a id="branches39testsphpunittestsimageresize_gdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/image/resize_gd.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/resize_gd.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,10 @@
</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><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group resize
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/resize.php' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
</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">@@ -12,4 +15,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public $editor_engine = 'WP_Image_Editor_GD';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</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 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="branches39testsphpunittestsimageresize_imagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/image/resize_imagick.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/image/resize_imagick.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,10 @@
</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><span class="cx" style="display: block; padding: 0 10px"> * @group upload
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group resize
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once( dirname( __FILE__ ) . '/resize.php' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> class Test_Image_Resize_Imagick extends WP_Tests_Image_Resize_UnitTestCase {
</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">@@ -12,4 +15,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public $editor_engine = 'WP_Image_Editor_Imagick';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ 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 class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="branches39testsphpunittestsiteratorsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/tests/phpunit/tests/iterators.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/iterators.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/iterators.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsl10nphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/l10n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/l10n.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/l10n.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,16 +16,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( unload_textdomain( 'wp-tests-domain' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
</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 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">+}
</ins></span></pre></div>
<a id="branches39testsphpunittestslinkphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/link.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/link.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/link.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,6 +4,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Link extends WP_UnitTestCase {
</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_rewrite->init();
+ parent::tearDown();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function _get_pagenum_link_cb( $url ) {
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,9 +35,15 @@
</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"> function test_wp_get_shortlink() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
+
</ins><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_id2 = $this->factory->post->create();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '' );
+ $wp_rewrite->flush_rules();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Basic case
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,8 +71,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '', wp_get_shortlink( 0 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '', wp_get_shortlink() );
</span><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 = '';
</del><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->flush_rules();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,9 +83,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $wp_rewrite->set_permalink_structure( '' );
- $wp_rewrite->flush_rules();
</del><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_wp_get_shortlink_with_page() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -86,14 +93,10 @@
</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="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_rewrite;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_rewrite->permalink_structure = '';
</del><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->flush_rules();
</span><span class="cx" style="display: block; padding: 0 10px">
</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">-
- $wp_rewrite->set_permalink_structure( '' );
- $wp_rewrite->flush_rules();
</del><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">@@ -112,9 +115,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->flush_rules();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $wp_rewrite->set_permalink_structure( '' );
- $wp_rewrite->flush_rules();
</del><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="branches39testsphpunittestsmailphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/mail.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/mail.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/mail.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/media.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/media.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -123,7 +123,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_embed;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $out = wp_oembed_get( 'http://www.youtube.com/watch?v=oHg5SJYRHA0' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertContains( 'http://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $out = wp_oembed_get( 'https://www.youtube.com/watch?v=oHg5SJYRHA0' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -456,7 +456,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'size' => filesize( $test_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">- $post_id = media_handle_upload( 'upload', 0, array(), array( 'action' => 'test_upload_titles', 'test_form' => false ) );
</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' ),
+ )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $_FILES['upload'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -468,6 +484,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'This is a test', $post->post_title );
</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 _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="branches39testsphpunittestsoptionblogOptionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/option/blogOption.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/option/blogOption.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/option/blogOption.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,79 +21,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $wpdb->suppress_errors( $this->suppress );
</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_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><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="branches39testsphpunittestsoptiontransientphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/option/transient.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/option/transient.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/option/transient.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -38,9 +38,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 22807
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_transient_data_with_timeout() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_multisite() ) {
+ $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $key = rand_str();
</span><span class="cx" style="display: block; padding: 0 10px"> $value = rand_str();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $value2 = rand_str();
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( get_option( '_transient_timeout_' . $key ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $now = time();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,6 +63,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 22807
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_transient_add_timeout() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_multisite() ) {
+ $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $key = rand_str();
</span><span class="cx" style="display: block; padding: 0 10px"> $value = rand_str();
</span><span class="cx" style="display: block; padding: 0 10px"> $value2 = rand_str();
</span></span></pre></div>
<a id="branches39testsphpunittestspostattachmentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/post/attachments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/post/attachments.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/post/attachments.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,10 +9,7 @@
</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"> // Remove all uploads.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $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">+ $this->remove_added_uploads();
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</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">@@ -211,24 +208,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($original) );
</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">- /**
- * 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><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches39testsphpunittestspostfilteringphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/post/filtering.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/post/filtering.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/post/filtering.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestspostgalleryphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/tests/phpunit/tests/post/gallery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/post/gallery.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/post/gallery.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestspostrevisionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/post/revisions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/post/revisions.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/post/revisions.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,42 +59,6 @@
</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="branches39testsphpunittestspostphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/post.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/post.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/post.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -446,7 +446,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // might only fail if the post ID is greater than four characters
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_rewrite;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
</ins><span class="cx" style="display: block; padding: 0 10px"> $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->flush_rules();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $post = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'post_author' => $this->author_id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -736,65 +738,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $post->post_author, $this->author_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $post->post_title, $title );
</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 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() );
- }
-
- /**
- * @ticket 24803
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * @ticket 24803
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_wp_count_posts() {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_type = rand_str(20);
</span><span class="cx" style="display: block; padding: 0 10px"> register_post_type( $post_type );
</span></span></pre></div>
<a id="branches39testsphpunittestsqueryconditionalsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/query/conditionals.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/query/conditionals.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/query/conditionals.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,14 +23,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'posts_per_page', 5 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_rewrite;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> create_initial_taxonomies();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wp_rewrite->flush_rules();
</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 tearDown() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
+ $wp_rewrite->init();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</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="branches39testsphpunittestsqueryresultsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/query/results.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/query/results.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/query/results.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsquerytaxQueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/query/taxQuery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/query/taxQuery.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/query/taxQuery.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,20 +22,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $tax;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
</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"> set_current_screen( 'front' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_the_query'] = new WP_Query();
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> create_initial_taxonomies();
</span><span class="cx" style="display: block; padding: 0 10px"> register_taxonomy( 'testtax', 'post', array( 'public' => true ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->flush_rules();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cat_id = $this->factory->category->create( array( 'slug' => 'cat-slug' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,10 +57,13 @@
</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"> function tearDown() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> _unregister_taxonomy( 'testtax' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
</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="branches39testsphpunittestsqueryverboseRewriteRulesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/query/verboseRewriteRules.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/query/verboseRewriteRules.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/query/verboseRewriteRules.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,11 +8,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
+
</ins><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">- global $wp_rewrite;
- update_option( 'permalink_structure', '/%category%/%year%/%postname%/' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%category%/%year%/%postname%/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> create_initial_taxonomies();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wp_rewrite->flush_rules();
</ins><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="branches39testsphpunittestsqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/query.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/query.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,6 +2,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Query extends WP_UnitTestCase {
</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 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"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 16746
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span></span></pre></div>
<a id="branches39testsphpunittestsrewritephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/rewrite.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/rewrite.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/rewrite.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,18 +8,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Rewrite extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function setUp() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
</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"> // Need rewrite rules in place to use url_to_postid
</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%/' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_rewrite->init();
+ $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> create_initial_taxonomies();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
- flush_rewrite_rules();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $wp_rewrite->flush_rules();
</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 tearDown() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_rewrite']->init();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_rewrite;
+ $wp_rewrite->init();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tearDown();
</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">@@ -34,16 +38,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_url_to_postid_custom_post_type() {
</span><span class="cx" style="display: block; padding: 0 10px"> delete_option( 'rewrite_rules' );
</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">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_type = rand_str( 12 );
</span><span class="cx" style="display: block; padding: 0 10px"> register_post_type( $post_type, array( 'public' => true ) );
</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">+
</ins><span class="cx" style="display: block; padding: 0 10px"> $id = $this->factory->post->create( array( 'post_type' => $post_type ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
-
- _unregister_post_type( $post_type );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+ _unregister_post_type( $post_type );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</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">+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_url_to_postid_hierarchical() {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $parent_id = $this->factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );
</span></span></pre></div>
<a id="branches39testsphpunittestsshortcodephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/shortcode.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/shortcode.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/shortcode.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunitteststaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/taxonomy.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/taxonomy.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -102,59 +102,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * @ticket 11058
</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"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 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><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="branches39testsphpunitteststermphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/term.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/term.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/term.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -412,52 +412,6 @@
</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"> /**
</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 ] );
- }
-
- /**
</del><span class="cx" style="display: block; padding: 0 10px"> * @ticket 17646
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_get_object_terms_types() {
</span></span></pre></div>
<a id="branches39testsphpunittestsuploadphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: branches/3.9/tests/phpunit/tests/upload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/upload.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/upload.php 2020-02-20 17:04:42 UTC (rev 47329)
</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="branches39testsphpunittestsuserlistAuthorsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/user/listAuthors.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/user/listAuthors.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/user/listAuthors.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,13 +83,19 @@
</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"> function test_wp_list_authors_feed() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://example.org/?feed=rss2&author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://example.org/?feed=rss2&author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://example.org/?feed=rss2&author=' . $this->users[0] . '">link to feed</a>)</li>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url0 = get_author_feed_link( $this->users[0] );
+ $url1 = get_author_feed_link( $this->users[1] );
+ $url2 = get_author_feed_link( $this->users[2] );
+ $expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->AssertEquals( $expected['feed'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed' ) ) );
</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"> function test_wp_list_authors_feed_image() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="http://example.org/?feed=rss2&author=' . $this->users[1] . '"><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> <a href="http://example.org/?feed=rss2&author=' . $this->users[2] . '"><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> <a href="http://example.org/?feed=rss2&author=' . $this->users[0] . '&
quot;><img src="http://example.com/path/to/a/graphic.png" style="border: none;" /></a></li>';
- $this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => 'example.com/path/to/a/graphic.png' ) ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url0 = get_author_feed_link( $this->users[0] );
+ $url1 = get_author_feed_link( $this->users[1] );
+ $url2 = get_author_feed_link( $this->users[2] );
+ $expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> <a href="' . $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> <a href="' . $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>';
+ $this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png' ) ) );
</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">@@ -96,7 +102,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 26538
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_list_authors_feed_type() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="http://example.org/?feed=atom&author=' . $this->users[1] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="http://example.org/?feed=atom&author=' . $this->users[2] . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="http://example.org/?feed=atom&author=' . $this->users[0] . '">link to feed</a>)</li>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url0 = get_author_feed_link( $this->users[0], 'atom' );
+ $url1 = get_author_feed_link( $this->users[1], 'atom' );
+ $url2 = get_author_feed_link( $this->users[2], 'atom' );
+ $expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
</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="branches39testsphpunittestsuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/tests/phpunit/tests/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/3.9/tests/phpunit/tests/user.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/user.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,46 +145,6 @@
</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">
</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 );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Test meta property magic functions for property get/set/isset.
</span><span class="cx" style="display: block; padding: 0 10px"> function test_user_meta_properties() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span></span></pre></div>
<a id="branches39testsphpunittestsxmlrpcwpuploadFilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/3.9/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.9/tests/phpunit/tests/xmlrpc/wp/uploadFile.php 2020-02-20 16:56:17 UTC (rev 47328)
+++ branches/3.9/tests/phpunit/tests/xmlrpc/wp/uploadFile.php 2020-02-20 17:04:42 UTC (rev 47329)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,51 +29,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertInternalType( 'string', $result['type'] );
</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 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"> }
</span><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>