<!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>[52009] trunk/tests/phpunit/includes: Coding Standards: Add `public` visibility to methods in `tests/phpunit/includes/`.</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/52009">52009</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/52009","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>hellofromTonya</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-11-04 13:15:33 +0000 (Thu, 04 Nov 2021)</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'>Coding Standards: Add `public` visibility to methods in `tests/phpunit/includes/`.
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.
Why `public`?
With no visibility previously declared, these methods are implicitly `public` and available for use. As these are part of the WordPress testing framework (for Core and extenders), changing them to anything else would be a backwards-compatibility break.
Props costdev, jrf, hellofromTonya.
See <a href="https://core.trac.wordpress.org/ticket/54177">#54177</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunitincludesbootstrapphp">trunk/tests/phpunit/includes/bootstrap.php</a></li>
<li><a href="#trunktestsphpunitincludesmockfsphp">trunk/tests/phpunit/includes/mock-fs.php</a></li>
<li><a href="#trunktestsphpunitincludesmockmailerphp">trunk/tests/phpunit/includes/mock-mailer.php</a></li>
<li><a href="#trunktestsphpunitincludestestcasexmlrpcphp">trunk/tests/phpunit/includes/testcase-xmlrpc.php</a></li>
<li><a href="#trunktestsphpunitincludesutilsphp">trunk/tests/phpunit/includes/utils.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitincludesbootstrapphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/bootstrap.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/bootstrap.php 2021-11-04 12:42:26 UTC (rev 52008)
+++ trunk/tests/phpunit/includes/bootstrap.php 2021-11-04 13:15:33 UTC (rev 52009)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -340,7 +340,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_PHPUnit_Util_Getopt {
</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 __construct( $argv ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( $argv ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $skipped_groups = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'ajax' => true,
</span><span class="cx" style="display: block; padding: 0 10px"> 'ms-files' => true,
</span></span></pre></div>
<a id="trunktestsphpunitincludesmockfsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/mock-fs.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/mock-fs.php 2021-11-04 12:42:26 UTC (rev 52008)
+++ trunk/tests/phpunit/includes/mock-fs.php 2021-11-04 13:15:33 UTC (rev 52009)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,14 +13,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $errors = array();
</span><span class="cx" style="display: block; padding: 0 10px"> public $method = 'MockFS';
</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 __construct() {}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct() {}
</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 connect() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function connect() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</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"> // Copy of core's function, but accepts a path.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function abspath( $path = false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function abspath( $path = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $path ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $path = ABSPATH;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,7 +40,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Sets initial filesystem environment and/or clears the current environment.
</span><span class="cx" style="display: block; padding: 0 10px"> * Can also be passed the initial filesystem to be setup which is passed to self::setfs()
</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 init( $paths = '', $home_dir = '/' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function init( $paths = '', $home_dir = '/' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->fs = new MockFS_Directory_Node( '/' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->fs_map = array(
</span><span class="cx" style="display: block; padding: 0 10px"> '/' => $this->fs,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,7 +53,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * "Bulk Loads" a filesystem into the internal virtual filesystem
</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 setfs( $paths ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function setfs( $paths ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $paths ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $paths = explode( "\n", $paths );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,7 +93,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Here starteth the WP_Filesystem functions.
</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 mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $path = trailingslashit( $path );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $parent_node = $this->locate_parent_node( $path );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -114,7 +114,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</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 put_contents( $path, $contents = '', $mode = null ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function put_contents( $path, $contents = '', $mode = null ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->is_dir( dirname( $path ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->mkdir( dirname( $path ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -126,7 +126,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->fs_map[ $path ] = $new_file;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_contents( $file ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_contents( $file ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! $this->is_file( $file ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -133,11 +133,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->fs_map[ $file ]->contents;
</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 cwd() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function cwd() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $this->cwd->path;
</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 chdir( $path ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function chdir( $path ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->fs_map[ $path ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -146,21 +146,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</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 exists( $path ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function exists( $path ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] );
</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 is_file( $file ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function is_file( $file ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function is_dir( $path ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function is_dir( $path ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $path = trailingslashit( $path );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return isset( $this->fs_map[ $path ] ) && $this->fs_map[ $path ]->is_dir();
</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 dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $path ) || '.' === $path ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $path = $this->cwd();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,16 +214,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $type; // The type of the entry 'f' for file, 'd' for directory.
</span><span class="cx" style="display: block; padding: 0 10px"> public $path; // The full path to the entry.
</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 __construct( $path ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( $path ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->path = $path;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->name = basename( $path );
</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 is_file() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function is_file() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return 'f' === $this->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">- function is_dir() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function is_dir() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return 'd' === $this->type;
</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">@@ -237,7 +237,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $type = 'f';
</span><span class="cx" style="display: block; padding: 0 10px"> public $contents = ''; // The contents of the file.
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function __construct( $path, $contents = '' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( $path, $contents = '' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::__construct( $path );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->contents = $contents;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunitincludesmockmailerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/mock-mailer.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/mock-mailer.php 2021-11-04 12:42:26 UTC (rev 52008)
+++ trunk/tests/phpunit/includes/mock-mailer.php 2021-11-04 13:15:33 UTC (rev 52009)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,7 +5,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> class MockPHPMailer extends PHPMailer\PHPMailer\PHPMailer {
</span><span class="cx" style="display: block; padding: 0 10px"> public $mock_sent = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function preSend() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function preSend() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->Encoding = '8bit';
</span><span class="cx" style="display: block; padding: 0 10px"> return parent::preSend();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,7 +13,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Override postSend() so mail isn't actually sent.
</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 postSend() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function postSend() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->mock_sent[] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'to' => $this->to,
</span><span class="cx" style="display: block; padding: 0 10px"> 'cc' => $this->cc,
</span></span></pre></div>
<a id="trunktestsphpunitincludestestcasexmlrpcphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/testcase-xmlrpc.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/testcase-xmlrpc.php 2021-11-04 12:42:26 UTC (rev 52008)
+++ trunk/tests/phpunit/includes/testcase-xmlrpc.php 2021-11-04 13:15:33 UTC (rev 52009)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,7 +6,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> abstract class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase {
</span><span class="cx" style="display: block; padding: 0 10px"> protected $myxmlrpcserver;
</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 set_up() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function set_up() {
</ins><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="cx" style="display: block; padding: 0 10px"> add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->myxmlrpcserver = new wp_xmlrpc_server();
</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 tear_down() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tear_down() {
</ins><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->remove_added_uploads();
</span></span></pre></div>
<a id="trunktestsphpunitincludesutilsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/utils.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/utils.php 2021-11-04 12:42:26 UTC (rev 52008)
+++ trunk/tests/phpunit/includes/utils.php 2021-11-04 13:15:33 UTC (rev 52009)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,16 +64,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * PHP5 constructor.
</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 __construct( $debug = 0 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( $debug = 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->reset();
</span><span class="cx" style="display: block; padding: 0 10px"> $this->debug = $debug;
</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 reset() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function reset() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->events = array();
</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 current_filter() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function current_filter() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_callable( 'current_filter' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return current_filter();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -81,7 +81,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return end( $wp_actions );
</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 action( $arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function action( $arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,7 +94,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $arg;
</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 action2( $arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function action2( $arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,7 +108,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $arg;
</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 filter( $arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function filter( $arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,7 +122,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $arg;
</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 filter2( $arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function filter2( $arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -136,7 +136,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $arg;
</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 filter_append( $arg ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function filter_append( $arg ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -150,7 +150,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $arg . '_append';
</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 filterall( $tag, ...$args ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function filterall( $tag, ...$args ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // This one doesn't return the result, so it's safe to use with the new 'all' filter.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $this->debug ) {
</span><span class="cx" style="display: block; padding: 0 10px"> dmp( __FUNCTION__, $this->current_filter() );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -164,12 +164,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Return a list of all the actions, tags and args.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_events() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_events() {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $this->events;
</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"> // Return a count of the number of times the action was called since the last reset.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_call_count( $tag = '' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_call_count( $tag = '' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $tag ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $count = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->events as $e ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -183,7 +183,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"> // Return an array of the tags that triggered calls to this action.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_tags() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_tags() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $out = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->events as $e ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $out[] = $e['tag'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -192,7 +192,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"> // Return an array of args passed in calls to this action.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function get_args() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_args() {
</ins><span class="cx" style="display: block; padding: 0 10px"> $out = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->events as $e ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $out[] = $e['args'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -210,7 +210,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * PHP5 constructor.
</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 __construct( $in ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function __construct( $in ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->xml = xml_parser_create();
</span><span class="cx" style="display: block; padding: 0 10px"> xml_set_object( $this->xml, $this );
</span><span class="cx" style="display: block; padding: 0 10px"> xml_parser_set_option( $this->xml, XML_OPTION_CASE_FOLDING, 0 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -219,7 +219,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->parse( $in );
</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 parse( $in ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function parse( $in ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $parse = xml_parse( $this->xml, $in, true );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $parse ) {
</span><span class="cx" style="display: block; padding: 0 10px"> trigger_error(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -235,7 +235,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</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 start_handler( $parser, $name, $attributes ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function start_handler( $parser, $name, $attributes ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $data['name'] = $name;
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $attributes ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $data['attributes'] = $attributes; }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -242,7 +242,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->data[] = $data;
</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 data_handler( $parser, $data ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function data_handler( $parser, $data ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $index = count( $this->data ) - 1;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->data[ $index ]['content'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -251,7 +251,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->data[ $index ]['content'] .= $data;
</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 end_handler( $parser, $name ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function end_handler( $parser, $name ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( count( $this->data ) > 1 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $data = array_pop( $this->data );
</span><span class="cx" style="display: block; padding: 0 10px"> $index = count( $this->data ) - 1;
</span></span></pre>
</div>
</div>
</body>
</html>