<!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>[53942] trunk/tests/phpunit/tests: Code Modernization: Explicitly declare all properties in various tests.</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/53942">53942</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/53942","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>2022-08-25 15:34:24 +0000 (Thu, 25 Aug 2022)</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'>Code Modernization: Explicitly declare all properties in various tests.

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In each of the cases included in this commit, one or more individual tests set a property to allow a filter or action access to certain information.

This commit:
* Explicitly declares these properties and documents in which tests they are being used.
* Adds a reset to the default value of the property to a pre-existing `tear_down()` method or adds that method specifically for that purpose. This ensures that tests do not accidentally {U+201C}taint{U+201D} each other.

As these properties are being declared on test classes, they are marked as private. Even though the original dynamic property was public, this should not be considered a backward compatibility break as this only involves test classes.

Includes:
* In the `Tests_Post_Query` class, there were two tests assigning a value to an undeclared `$post_id` property, but subsequently not using the property, so those assignments should have been to a local variable (if they should be assignments at all).
* In the `Test_User_Capabilities` class, the property name had a leading `_` underscore. This is an outdated PHP 4 practice to indicate a private property. As PHP 4 is no longer supported, the leading underscore is removed from the property name.
* In the `Tests_User_Capabilities` class, an unused `$_role_test_wp_roles_role` property was declared somewhere in the middle of the class. That property is now removed in favor of `$_role_test_wp_roles_init`, which appears to be the intended name, previously misspelled.

Follow-up to <a href="https://core.trac.wordpress.org/changeset/27294">[27294]</a>, <a href="https://core.trac.wordpress.org/changeset/36277">[36277]</a>, <a href="https://core.trac.wordpress.org/changeset/36750">[36750]</a>, <a href="https://core.trac.wordpress.org/changeset/37712">[37712]</a>, <a href="https://core.trac.wordpress.org/changeset/38571">[38571]</a>, <a href="https://core.trac.wordpress.org/changeset/39082">[39082]</a>, <a href="https://core.trac.wordpress.org/changeset/40290">[40290]</a>, <a href="https://core.trac.wordpress.org/changeset/43049">[43049]</a>, <a href="https://core.trac.wordpress.org/changeset/44628">[44628]</a>, <a href="https://core.trac.wordpress.org/changeset/48328">[48328]</a>, <a href="https://core.trac.wordpress.org/changeset/53557">[53557]</a>, <a href="https://core.trac.wordpress.org/changeset/53558">[53558]</a>, <a href="https://core.trac.wordpress.org/changeset/53850">[53850]</a>, <a href="https://core.trac.wordpress.org/changeset/53851">[538
 51]</a>, <a href="https://core.trac.wordpress.org/changeset/53852">[53852]</a>, <a href="https://core.trac.wordpress.org/changeset/53853">[53853]</a>, <a href="https://core.trac.wordpress.org/changeset/53854">[53854]</a>, <a href="https://core.trac.wordpress.org/changeset/53856">[53856]</a>, <a href="https://core.trac.wordpress.org/changeset/53916">[53916]</a>, <a href="https://core.trac.wordpress.org/changeset/53935">[53935]</a>, <a href="https://core.trac.wordpress.org/changeset/53936">[53936]</a>, <a href="https://core.trac.wordpress.org/changeset/53937">[53937]</a>, <a href="https://core.trac.wordpress.org/changeset/53938">[53938]</a>.

Props jrf.
See <a href="https://core.trac.wordpress.org/ticket/56033">#56033</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsactionsphp">trunk/tests/phpunit/tests/actions.php</a></li>
<li><a href="#trunktestsphpunittestsadminwpPrivacyRequestsTablephp">trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php</a></li>
<li><a href="#trunktestsphpunittestscommentqueryphp">trunk/tests/phpunit/tests/comment/query.php</a></li>
<li><a href="#trunktestsphpunittestshooksaddFilterphp">trunk/tests/phpunit/tests/hooks/addFilter.php</a></li>
<li><a href="#trunktestsphpunittestspostqueryphp">trunk/tests/phpunit/tests/post/query.php</a></li>
<li><a href="#trunktestsphpunittestsrewritephp">trunk/tests/phpunit/tests/rewrite.php</a></li>
<li><a href="#trunktestsphpunitteststermqueryphp">trunk/tests/phpunit/tests/term/query.php</a></li>
<li><a href="#trunktestsphpunitteststermwpGetObjectTermsphp">trunk/tests/phpunit/tests/term/wpGetObjectTerms.php</a></li>
<li><a href="#trunktestsphpunittestsusercapabilitiesphp">trunk/tests/phpunit/tests/user/capabilities.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/actions.php     2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/actions.php       2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,35 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Actions extends WP_UnitTestCase {
</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">+         * Flag to keep track whether a certain filter has been applied.
+        *
+        * Used in the `test_doing_filter_real()` test method.
+        *
+        * @var bool
+        */
+       private $apply_testing_filter = false;
+
+       /**
+        * Flag to keep track whether a certain filter has been applied.
+        *
+        * Used in the `test_doing_filter_real()` test method.
+        *
+        * @var bool
+        */
+       private $apply_testing_nested_filter = false;
+
+       /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               // Make sure potentially changed properties are reverted to their default value.
+               $this->apply_testing_filter        = false;
+               $this->apply_testing_nested_filter = false;
+
+               parent::tear_down();
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @covers ::do_action
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_simple_action() {
</span></span></pre></div>
<a id="trunktestsphpunittestsadminwpPrivacyRequestsTablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php        2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/admin/wpPrivacyRequestsTable.php  2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 5.1.0
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Admin_wpPrivacyRequestsTable extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Temporary storage for SQL to allow a filter to access it.
+        *
+        * Used in the `test_columns_should_be_sortable()` test method.
+        *
+        * @var string
+        */
+       private $sql;
+
+       /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               unset( $this->sql );
+
+               parent::tear_down();
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Get instance for mocked class.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since 5.1.0
</span></span></pre></div>
<a id="trunktestsphpunittestscommentqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/comment/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/comment/query.php       2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/comment/query.php 2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,10 +9,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $post_id;
</span><span class="cx" style="display: block; padding: 0 10px">        protected $comment_id;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Temporary storage for comment exclusions to allow a filter to access these.
+        *
+        * Used in the following tests:
+        * - `test_comment_clauses_prepend_callback_should_be_respected_when_filling_descendants()`
+        * - `test_comment_clauses_append_callback_should_be_respected_when_filling_descendants()`
+        *
+        * @var array
+        */
+       private $to_exclude;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
</span><span class="cx" style="display: block; padding: 0 10px">                self::$post_id = $factory->post->create();
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        public function tear_down() {
+               unset( $this->to_exclude );
+               parent::tear_down();
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @covers WP_Comment_Query::query
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4301,8 +4317,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'comments_clauses', array( $this, 'prepend_exclusions' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                unset( $this->to_exclude );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $this->assertEqualSets( array( $top_level_0, $child1_of_0, $top_level_comments[0], $top_level_comments[2] ), wp_list_pluck( $q->comments, 'comment_ID' ) );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4360,8 +4374,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                );
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'comments_clauses', array( $this, 'append_exclusions' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                unset( $this->to_exclude );
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $this->assertEqualSets( array( $top_level_0, $child1_of_0, $top_level_comments[0], $top_level_comments[2] ), wp_list_pluck( $q->comments, 'comment_ID' ) );
</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="trunktestsphpunittestshooksaddFilterphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/hooks/addFilter.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/hooks/addFilter.php     2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/hooks/addFilter.php       2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,6 +11,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public $hook;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Temporary storage for action output.
+        *
+        * Used in the following tests:
+        * - `test_remove_and_add_action()`
+        * - `test_remove_and_add_last_action()`
+        * - `test_remove_and_recurse_and_add_action()`
+        *
+        * @var array
+        */
+       private $action_output = '';
+
+       public function tear_down() {
+               $this->action_output = '';
+               parent::tear_down();
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function test_add_filter_with_function() {
</span><span class="cx" style="display: block; padding: 0 10px">                $callback      = '__return_null';
</span><span class="cx" style="display: block; padding: 0 10px">                $hook          = new WP_Hook();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -202,8 +219,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">        public function test_remove_and_add_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->hook          = new WP_Hook();
-               $this->action_output = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->hook = new WP_Hook();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->hook->add_filter( 'remove_and_add_action', '__return_empty_string', 10, 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -217,8 +233,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">        public function test_remove_and_add_last_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->hook          = new WP_Hook();
-               $this->action_output = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->hook = new WP_Hook();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->hook->add_filter( 'remove_and_add_action', '__return_empty_string', 10, 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -232,8 +247,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">        public function test_remove_and_recurse_and_add_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->hook          = new WP_Hook();
-               $this->action_output = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->hook = new WP_Hook();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->hook->add_filter( 'remove_and_add_action', '__return_empty_string', 10, 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestspostqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post/query.php  2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/post/query.php    2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,7 +5,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @group post
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Post_Query extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Temporary storage for a post ID for tests using filter callbacks.
+        *
+        * Used in the `test_posts_pre_query_filter_should_respect_set_found_posts()` method.
+        *
+        * @var int
+        */
+       private $post_id;
+
+       /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               unset( $this->post_id );
+
+               parent::tear_down();
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @group taxonomy
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_category__and_var() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -729,7 +748,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 42469
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_found_posts_should_be_integer_not_string() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->post_id = self::factory()->post->create();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $post_id = self::factory()->post->create();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $q = new WP_Query(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -744,7 +763,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 42469
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_found_posts_should_be_integer_even_if_found_posts_filter_returns_string_value() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->post_id = self::factory()->post->create();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $post_id = self::factory()->post->create();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'found_posts', '__return_empty_string' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsrewritephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rewrite.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rewrite.php     2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/rewrite.php       2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,15 @@
</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">        private $home_url;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Temporary storage for blog id for use with filters.
+        *
+        * Used in the `test_url_to_postid_of_http_site_when_current_site_uses_https()` method.
+        *
+        * @var int
+        */
+       private $blog_id_35531;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function set_up() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,6 +31,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $wp_rewrite->init();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                update_option( 'home', $this->home_url );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                unset( $this->blog_id_35531 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 parent::tear_down();
</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="trunktestsphpunitteststermqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/term/query.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/term/query.php  2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/term/query.php    2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,28 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @group taxonomy
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Term_Query extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px">         /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Temporary storage for a term ID for tests using filter callbacks.
+        *
+        * Used in the following tests:
+        * - `test_null_term_object_should_be_discarded()`
+        * - `test_error_term_object_should_be_discarded()`
+        *
+        * @var int
+        */
+       private $term_id;
+
+       /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               unset( $this->term_id );
+
+               parent::tear_down();
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 37545
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_taxonomy_should_accept_single_taxonomy_as_string() {
</span></span></pre></div>
<a id="trunktestsphpunitteststermwpGetObjectTermsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/term/wpGetObjectTerms.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/term/wpGetObjectTerms.php       2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/term/wpGetObjectTerms.php 2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,11 +7,29 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_Term_WpGetObjectTerms extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px">        private $taxonomy = 'wptests_tax';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Temporary storage for taxonomies for tests using filter callbacks.
+        *
+        * Used in the `test_taxonomies_passed_to_wp_get_object_terms_filter_should_be_quoted()` method.
+        *
+        * @var array
+        */
+       private $taxonomies;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function set_up() {
</span><span class="cx" style="display: block; padding: 0 10px">                parent::set_up();
</span><span class="cx" style="display: block; padding: 0 10px">                register_taxonomy( 'wptests_tax', 'post' );
</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">+        /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               unset( $this->taxonomies );
+
+               parent::tear_down();
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public function test_get_object_terms_by_slug() {
</span><span class="cx" style="display: block; padding: 0 10px">                $post_id = self::factory()->post->create();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestsusercapabilitiesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/user/capabilities.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/user/capabilities.php   2022-08-25 04:21:40 UTC (rev 53941)
+++ trunk/tests/phpunit/tests/user/capabilities.php     2022-08-25 15:34:24 UTC (rev 53942)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -30,6 +30,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $block_id;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Temporary storage for roles for tests using filter callbacks.
+        *
+        * Used in the `test_wp_roles_init_action()` method.
+        *
+        * @var array
+        */
+       private $role_test_wp_roles_init;
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
</span><span class="cx" style="display: block; padding: 0 10px">                self::$users       = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'anonymous'     => new WP_User( 0 ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,6 +69,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"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Clean up after each test.
+        */
+       public function tear_down() {
+               unset( $this->role_test_wp_roles_init );
+
+               parent::tear_down();
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         public static function wpTearDownAfterClass() {
</span><span class="cx" style="display: block; padding: 0 10px">                wp_delete_post( self::$block_id, true );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1996,13 +2014,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"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       protected $_role_test_wp_roles_role;
</del><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @ticket 23016
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_wp_roles_init_action() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->_role_test_wp_roles_init = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->role_test_wp_roles_init = array(
</ins><span class="cx" style="display: block; padding: 0 10px">                         'role' => 'test_wp_roles_init',
</span><span class="cx" style="display: block; padding: 0 10px">                        'info' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'name'         => 'Test WP Roles Init',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2015,16 +2031,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                remove_action( 'wp_roles_init', array( $this, '_hook_wp_roles_init' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $expected = new WP_Role( $this->_role_test_wp_roles_init['role'], $this->_role_test_wp_roles_init['info']['capabilities'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $expected = new WP_Role( $this->role_test_wp_roles_init['role'], $this->role_test_wp_roles_init['info']['capabilities'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $role = $wp_roles->get_role( $this->_role_test_wp_roles_init['role'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $role = $wp_roles->get_role( $this->role_test_wp_roles_init['role'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( $expected, $role );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertContains( $this->_role_test_wp_roles_init['info']['name'], $wp_roles->role_names );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertContains( $this->role_test_wp_roles_init['info']['name'], $wp_roles->role_names );
</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">        public function _hook_wp_roles_init( $wp_roles ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $wp_roles->add_role( $this->_role_test_wp_roles_init['role'], $this->_role_test_wp_roles_init['info']['name'], $this->_role_test_wp_roles_init['info']['capabilities'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $wp_roles->add_role( $this->role_test_wp_roles_init['role'], $this->role_test_wp_roles_init['info']['name'], $this->role_test_wp_roles_init['info']['capabilities'] );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span></span></pre>
</div>
</div>

</body>
</html>