<!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>[47780] trunk/tests/phpunit/tests/functions: Coding Standards: Rename some files and classes in `phpunit/tests/functions/` per the naming conventions.</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/47780">47780</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/47780","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-05-10 12:07:49 +0000 (Sun, 10 May 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'>Coding Standards: Rename some files and classes in `phpunit/tests/functions/` per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization
See <a href="https://core.trac.wordpress.org/ticket/49542">#49542</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsfunctionsdeprecatedphp">trunk/tests/phpunit/tests/functions/deprecated.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsgetStatusHeaderDescphp">trunk/tests/phpunit/tests/functions/getStatusHeaderDesc.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsisNewDayphp">trunk/tests/phpunit/tests/functions/isNewDay.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsisSerializedStringphp">trunk/tests/phpunit/tests/functions/isSerializedString.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsnumberFormatI18nphp">trunk/tests/phpunit/tests/functions/numberFormatI18n.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionspluginBasenamephp">trunk/tests/phpunit/tests/functions/pluginBasename.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionssizeFormatphp">trunk/tests/phpunit/tests/functions/sizeFormat.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsunderscoreReturnphp">trunk/tests/phpunit/tests/functions/underscoreReturn.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpArraySliceAssocphp">trunk/tests/phpunit/tests/functions/wpArraySliceAssoc.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpAuthCheckphp">trunk/tests/phpunit/tests/functions/wpAuthCheck.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpGetMimeTypesphp">trunk/tests/phpunit/tests/functions/wpGetMimeTypes.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpListUtilphp">trunk/tests/phpunit/tests/functions/wpListUtil.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpRemoteFopenphp">trunk/tests/phpunit/tests/functions/wpRemoteFopen.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpValidateBooleanphp">trunk/tests/phpunit/tests/functions/wpValidateBoolean.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsfunctionscanonicalCharsetphp">trunk/tests/phpunit/tests/functions/canonicalCharset.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionscleanupHeaderCommentphp">trunk/tests/phpunit/tests/functions/cleanupHeaderComment.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpGetArchivesphp">trunk/tests/phpunit/tests/functions/wpGetArchives.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionswpListFilterphp">trunk/tests/phpunit/tests/functions/wpListFilter.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsfunctions_cleanup_header_commentphp">trunk/tests/phpunit/tests/functions/_cleanup_header_comment.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionscanonicalcharsetphp">trunk/tests/phpunit/tests/functions/canonical-charset.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionsgetArchivesphp">trunk/tests/phpunit/tests/functions/getArchives.php</a></li>
<li><a href="#trunktestsphpunittestsfunctionslistFilterphp">trunk/tests/phpunit/tests/functions/listFilter.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsfunctions_cleanup_header_commentphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/functions/_cleanup_header_comment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/_cleanup_header_comment.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/_cleanup_header_comment.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,121 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/*
- * Test _cleanup_header_comment().
- *
- * @group functions.php
- * @ticket 8497
- * @ticket 38101
- */
-class Tests_Cleanup_Header_Comment extends WP_UnitTestCase {
- /**
- * Test cleanup header of header comment.
- *
- * @covers _cleanup_header_comment
- * @dataProvider data_cleanup_header_comment
- *
- * @param string $test_string
- * @param string $expected
- */
- public function test_cleanup_header_comment( $test_string, $expected ) {
- $this->assertEquals( $expected, _cleanup_header_comment( $test_string ) );
- }
-
- /**
- * Data provider for test_cleanup_header_comment.
- *
- * @return array[] Test parameters {
- * @type string $test_string Test string.
- * @type string $expected Expected return value.
- * }
- */
- public function data_cleanup_header_comment() {
- return array(
- // Set 0: A string.
- array(
- 'ffffffffffffff',
- 'ffffffffffffff',
- ),
- // Set 1: Trim a string.
- array(
- ' ffffffffffffff ',
- 'ffffffffffffff',
- ),
- // Set 2: Trim a full comment string.
- array(
- '<?php
-/*
-Plugin Name: Health Check
-Plugin URI: https://wordpress.org/plugins/health-check/
-Description: Checks the health of your WordPress install
-Version: 0.1.0
-Author: The Health Check Team
-Author URI: http://health-check-team.example.com
-Text Domain: health-check
-Domain Path: /languages
-*/
-',
- '<?php
-/*
-Plugin Name: Health Check
-Plugin URI: https://wordpress.org/plugins/health-check/
-Description: Checks the health of your WordPress install
-Version: 0.1.0
-Author: The Health Check Team
-Author URI: http://health-check-team.example.com
-Text Domain: health-check
-Domain Path: /languages',
- ),
- // Set 3: Trim HTML following comment.
- array(
- '<?php
-/*
-Plugin Name: Health Check
-Plugin URI: https://wordpress.org/plugins/health-check/
-Description: Checks the health of your WordPress install
-Version: 0.1.0
-Author: The Health Check Team
-Author URI: http://health-check-team.example.com
-Text Domain: health-check
-Domain Path: /languages
-*/ ?>
-dddlddfs
-',
- '<?php
-/*
-Plugin Name: Health Check
-Plugin URI: https://wordpress.org/plugins/health-check/
-Description: Checks the health of your WordPress install
-Version: 0.1.0
-Author: The Health Check Team
-Author URI: http://health-check-team.example.com
-Text Domain: health-check
-Domain Path: /languages
-dddlddfs',
- ),
- // Set 4: Trim a docblock style comment.
- array(
- '<?php
-/**
- * Plugin Name: Health Check
- * Plugin URI: https://wordpress.org/plugins/health-check/
- * Description: Checks the health of your WordPress install
- * Version: 0.1.0
- * Author: The Health Check Team
- * Author URI: http://health-check-team.example.com
- * Text Domain: health-check
- * Domain Path: /languages
- */',
- '<?php
-/**
- * Plugin Name: Health Check
- * Plugin URI: https://wordpress.org/plugins/health-check/
- * Description: Checks the health of your WordPress install
- * Version: 0.1.0
- * Author: The Health Check Team
- * Author URI: http://health-check-team.example.com
- * Text Domain: health-check
- * Domain Path: /languages',
- ),
- );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsfunctionscanonicalcharsetphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/functions/canonical-charset.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/canonical-charset.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/canonical-charset.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,88 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/*
- * Validate that's badly named charsets always return the correct format for UTF-8 and ISO-8859-1
- *
- * @since 4.8.0
- */
-
-class Tests_Functions_canonical_charset extends WP_UnitTestCase {
-
- public function test_utf_8_lower() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'utf-8' ) );
- }
-
- public function test_utf_8_upper() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF-8' ) );
- }
-
- public function test_utf_8_mixxed() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'Utf-8' ) );
- }
-
- public function test_utf_8() {
- $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF8' ) );
- }
-
- public function test_iso_lower() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'iso-8859-1' ) );
- }
-
- public function test_iso_upper() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO-8859-1' ) );
- }
-
- public function test_iso_mixxed() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'Iso8859-1' ) );
- }
-
- public function test_iso() {
- $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO8859-1' ) );
- }
-
- public function test_random() {
- $this->assertEquals( 'random', _canonical_charset( 'random' ) );
- }
-
- public function test_empty() {
- $this->assertEquals( '', _canonical_charset( '' ) );
- }
-
- /**
- * @ticket 23688
- */
- function test_update_option_blog_charset() {
- $orig_blog_charset = get_option( 'blog_charset' );
-
- update_option( 'blog_charset', 'utf8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'utf-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'UTF8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'UTF-8' );
- $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'ISO-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'ISO8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'iso8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', 'iso-8859-1' );
- $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
-
- // Arbitrary strings are passed through.
- update_option( 'blog_charset', 'foobarbaz' );
- $this->assertEquals( 'foobarbaz', get_option( 'blog_charset' ) );
-
- update_option( 'blog_charset', $orig_blog_charset );
- }
-
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsfunctionscanonicalCharsetphpfromrev47779trunktestsphpunittestsfunctionscanonicalcharsetphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/tests/phpunit/tests/functions/canonicalCharset.php (from rev 47779, trunk/tests/phpunit/tests/functions/canonical-charset.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/canonicalCharset.php (rev 0)
+++ trunk/tests/phpunit/tests/functions/canonicalCharset.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,88 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/*
+ * Validate that badly named charsets always return the correct format for UTF-8 and ISO-8859-1.
+ *
+ * @since 4.8.0
+ */
+
+class Tests_Functions_CanonicalCharset extends WP_UnitTestCase {
+
+ public function test_utf_8_lower() {
+ $this->assertEquals( 'UTF-8', _canonical_charset( 'utf-8' ) );
+ }
+
+ public function test_utf_8_upper() {
+ $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF-8' ) );
+ }
+
+ public function test_utf_8_mixxed() {
+ $this->assertEquals( 'UTF-8', _canonical_charset( 'Utf-8' ) );
+ }
+
+ public function test_utf_8() {
+ $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF8' ) );
+ }
+
+ public function test_iso_lower() {
+ $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'iso-8859-1' ) );
+ }
+
+ public function test_iso_upper() {
+ $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO-8859-1' ) );
+ }
+
+ public function test_iso_mixxed() {
+ $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'Iso8859-1' ) );
+ }
+
+ public function test_iso() {
+ $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO8859-1' ) );
+ }
+
+ public function test_random() {
+ $this->assertEquals( 'random', _canonical_charset( 'random' ) );
+ }
+
+ public function test_empty() {
+ $this->assertEquals( '', _canonical_charset( '' ) );
+ }
+
+ /**
+ * @ticket 23688
+ */
+ function test_update_option_blog_charset() {
+ $orig_blog_charset = get_option( 'blog_charset' );
+
+ update_option( 'blog_charset', 'utf8' );
+ $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'utf-8' );
+ $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'UTF8' );
+ $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'UTF-8' );
+ $this->assertEquals( 'UTF-8', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'ISO-8859-1' );
+ $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'ISO8859-1' );
+ $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'iso8859-1' );
+ $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', 'iso-8859-1' );
+ $this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset' ) );
+
+ // Arbitrary strings are passed through.
+ update_option( 'blog_charset', 'foobarbaz' );
+ $this->assertEquals( 'foobarbaz', get_option( 'blog_charset' ) );
+
+ update_option( 'blog_charset', $orig_blog_charset );
+ }
+
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsfunctionscleanupHeaderCommentphpfromrev47779trunktestsphpunittestsfunctions_cleanup_header_commentphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/tests/phpunit/tests/functions/cleanupHeaderComment.php (from rev 47779, trunk/tests/phpunit/tests/functions/_cleanup_header_comment.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/cleanupHeaderComment.php (rev 0)
+++ trunk/tests/phpunit/tests/functions/cleanupHeaderComment.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,121 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/*
+ * Test _cleanup_header_comment().
+ *
+ * @group functions.php
+ * @ticket 8497
+ * @ticket 38101
+ */
+class Tests_Functions_CleanupHeaderComment extends WP_UnitTestCase {
+ /**
+ * Test cleanup header of header comment.
+ *
+ * @covers _cleanup_header_comment
+ * @dataProvider data_cleanup_header_comment
+ *
+ * @param string $test_string
+ * @param string $expected
+ */
+ public function test_cleanup_header_comment( $test_string, $expected ) {
+ $this->assertEquals( $expected, _cleanup_header_comment( $test_string ) );
+ }
+
+ /**
+ * Data provider for test_cleanup_header_comment.
+ *
+ * @return array[] Test parameters {
+ * @type string $test_string Test string.
+ * @type string $expected Expected return value.
+ * }
+ */
+ public function data_cleanup_header_comment() {
+ return array(
+ // Set 0: A string.
+ array(
+ 'ffffffffffffff',
+ 'ffffffffffffff',
+ ),
+ // Set 1: Trim a string.
+ array(
+ ' ffffffffffffff ',
+ 'ffffffffffffff',
+ ),
+ // Set 2: Trim a full comment string.
+ array(
+ '<?php
+/*
+Plugin Name: Health Check
+Plugin URI: https://wordpress.org/plugins/health-check/
+Description: Checks the health of your WordPress install
+Version: 0.1.0
+Author: The Health Check Team
+Author URI: http://health-check-team.example.com
+Text Domain: health-check
+Domain Path: /languages
+*/
+',
+ '<?php
+/*
+Plugin Name: Health Check
+Plugin URI: https://wordpress.org/plugins/health-check/
+Description: Checks the health of your WordPress install
+Version: 0.1.0
+Author: The Health Check Team
+Author URI: http://health-check-team.example.com
+Text Domain: health-check
+Domain Path: /languages',
+ ),
+ // Set 3: Trim HTML following comment.
+ array(
+ '<?php
+/*
+Plugin Name: Health Check
+Plugin URI: https://wordpress.org/plugins/health-check/
+Description: Checks the health of your WordPress install
+Version: 0.1.0
+Author: The Health Check Team
+Author URI: http://health-check-team.example.com
+Text Domain: health-check
+Domain Path: /languages
+*/ ?>
+dddlddfs
+',
+ '<?php
+/*
+Plugin Name: Health Check
+Plugin URI: https://wordpress.org/plugins/health-check/
+Description: Checks the health of your WordPress install
+Version: 0.1.0
+Author: The Health Check Team
+Author URI: http://health-check-team.example.com
+Text Domain: health-check
+Domain Path: /languages
+dddlddfs',
+ ),
+ // Set 4: Trim a docblock style comment.
+ array(
+ '<?php
+/**
+ * Plugin Name: Health Check
+ * Plugin URI: https://wordpress.org/plugins/health-check/
+ * Description: Checks the health of your WordPress install
+ * Version: 0.1.0
+ * Author: The Health Check Team
+ * Author URI: http://health-check-team.example.com
+ * Text Domain: health-check
+ * Domain Path: /languages
+ */',
+ '<?php
+/**
+ * Plugin Name: Health Check
+ * Plugin URI: https://wordpress.org/plugins/health-check/
+ * Description: Checks the health of your WordPress install
+ * Version: 0.1.0
+ * Author: The Health Check Team
+ * Author URI: http://health-check-team.example.com
+ * Text Domain: health-check
+ * Domain Path: /languages',
+ ),
+ );
+ }
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsfunctionsdeprecatedphp"></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/functions/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/deprecated.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/deprecated.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,10 +5,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @package WordPress
</span><span class="cx" style="display: block; padding: 0 10px"> * @subpackage Unit Tests
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 3.5
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 3.5.0
</ins><span class="cx" style="display: block; padding: 0 10px"> * @group deprecated
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Test_Functions_Deprecated extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_Deprecated extends WP_UnitTestCase {
</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"> * List of functions that have been passed through _deprecated_function()
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsgetArchivesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/functions/getArchives.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/getArchives.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/getArchives.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,209 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/*
-$defaults = array(
- 'type' => 'monthly', 'limit' => '',
- 'format' => 'html', 'before' => '',
- 'after' => '', 'show_post_count' => false,
- 'echo' => 1, 'order' => 'DESC',
-);
-*/
-class Tests_Get_Archives extends WP_UnitTestCase {
- protected static $post_ids;
- protected $month_url;
- protected $year_url;
-
- function setUp() {
- parent::setUp();
-
- $this->month_url = get_month_link( gmdate( 'Y' ), gmdate( 'm' ) );
- $this->year_url = get_year_link( gmdate( 'Y' ) );
- }
-
- public static function wpSetUpBeforeClass( $factory ) {
- self::$post_ids = $factory->post->create_many(
- 8,
- array(
- 'post_type' => 'post',
- 'post_author' => '1',
- )
- );
- }
-
- function test_wp_get_archives_default() {
- $expected['default'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>';
- $this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
- }
-
- function test_wp_get_archives_type() {
- $expected['type'] = "<li><a href='" . $this->year_url . "'>" . gmdate( 'Y' ) . '</a></li>';
- $this->assertEquals(
- $expected['type'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'type' => 'yearly',
- )
- )
- )
- );
- }
-
- function test_wp_get_archives_limit() {
- $ids = array_slice( array_reverse( self::$post_ids ), 0, 5 );
-
- $link1 = get_permalink( $ids[0] );
- $link2 = get_permalink( $ids[1] );
- $link3 = get_permalink( $ids[2] );
- $link4 = get_permalink( $ids[3] );
- $link5 = get_permalink( $ids[4] );
-
- $title1 = get_post( $ids[0] )->post_title;
- $title2 = get_post( $ids[1] )->post_title;
- $title3 = get_post( $ids[2] )->post_title;
- $title4 = get_post( $ids[3] )->post_title;
- $title5 = get_post( $ids[4] )->post_title;
-
- $expected['limit'] = <<<EOF
-<li><a href='$link1'>$title1</a></li>
- <li><a href='$link2'>$title2</a></li>
- <li><a href='$link3'>$title3</a></li>
- <li><a href='$link4'>$title4</a></li>
- <li><a href='$link5'>$title5</a></li>
-EOF;
- $this->assertEqualsIgnoreEOL(
- $expected['limit'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'type' => 'postbypost',
- 'limit' => 5,
- )
- )
- )
- );
- }
-
- function test_wp_get_archives_format() {
- $expected['format'] = "<option value='" . $this->month_url . "'> " . gmdate( 'F Y' ) . ' </option>';
- $this->assertEquals(
- $expected['format'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'format' => 'option',
- )
- )
- )
- );
- }
-
- function test_wp_get_archives_before_and_after() {
- $expected['before_and_after'] = "<div><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></div>';
- $this->assertEquals(
- $expected['before_and_after'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'format' => 'custom',
- 'before' => '<div>',
- 'after' => '</div>',
- )
- )
- )
- );
- }
-
- function test_wp_get_archives_show_post_count() {
- $expected['show_post_count'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a> (8)</li>';
- $this->assertEquals(
- $expected['show_post_count'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'show_post_count' => 1,
- )
- )
- )
- );
- }
-
- function test_wp_get_archives_echo() {
- $expected['echo'] = "\t<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>' . "\n";
- $this->expectOutputString( $expected['echo'] );
- wp_get_archives( array( 'echo' => true ) );
- }
-
- function test_wp_get_archives_order() {
- self::factory()->post->create(
- array(
- 'post_type' => 'post',
- 'post_author' => '1',
- 'post_date' => '2012-10-23 19:34:42',
- )
- );
-
- $date_full = gmdate( 'F Y' );
- $oct_url = get_month_link( 2012, 10 );
- $expected['order_asc'] = <<<EOF
-<li><a href='{$oct_url}'>October 2012</a></li>
- <li><a href='{$this->month_url}'>$date_full</a></li>
-EOF;
- $this->assertEqualsIgnoreEOL(
- $expected['order_asc'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'order' => 'ASC',
- )
- )
- )
- );
-
- $expected['order_desc'] = <<<EOF
-<li><a href='{$this->month_url}'>$date_full</a></li>
- <li><a href='{$oct_url}'>October 2012</a></li>
-EOF;
- $this->assertEqualsIgnoreEOL(
- $expected['order_desc'],
- trim(
- wp_get_archives(
- array(
- 'echo' => false,
- 'order' => 'DESC',
- )
- )
- )
- );
- }
-
- /**
- * @ticket 21596
- */
- function test_wp_get_archives_post_type() {
- register_post_type( 'taco', array( 'public' => true ) );
-
- self::factory()->post->create(
- array(
- 'post_type' => 'taco',
- 'post_author' => '1',
- 'post_date' => '2014-10-23 19:34:42',
- )
- );
-
- $oct_url = esc_url( add_query_arg( 'post_type', 'taco', get_month_link( 2014, 10 ) ) );
- $expected = "<li><a href='{$oct_url}'>October 2014</a></li>";
- $archives = wp_get_archives(
- array(
- 'echo' => false,
- 'post_type' => 'taco',
- )
- );
- $this->assertEquals( $expected, trim( $archives ) );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsfunctionsgetStatusHeaderDescphp"></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/functions/getStatusHeaderDesc.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/getStatusHeaderDesc.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/getStatusHeaderDesc.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,7 +7,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_get_status_header_desc extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_GetStatusHeaderDesc extends WP_UnitTestCase {
</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"> * @dataProvider _status_strings
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsisNewDayphp"></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/functions/isNewDay.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/isNewDay.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/isNewDay.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_is_new_date extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_IsNewDate extends WP_UnitTestCase {
</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"> * @ticket 46627
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsisSerializedStringphp"></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/functions/isSerializedString.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/isSerializedString.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/isSerializedString.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 42870
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_Is_Serialized_String extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_IsSerializedString extends WP_UnitTestCase {
</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"> * Data provider method for testing `is_serialized_string()`.
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionslistFilterphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/functions/listFilter.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/listFilter.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/listFilter.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,355 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck().
- *
- * @group functions.php
- */
-class Tests_Functions_ListFilter extends WP_UnitTestCase {
- var $object_list = array();
- var $array_list = array();
-
- function setUp() {
- parent::setUp();
- $this->array_list['foo'] = array(
- 'name' => 'foo',
- 'id' => 'f',
- 'field1' => true,
- 'field2' => true,
- 'field3' => true,
- 'field4' => array( 'red' ),
- );
- $this->array_list['bar'] = array(
- 'name' => 'bar',
- 'id' => 'b',
- 'field1' => true,
- 'field2' => true,
- 'field3' => false,
- 'field4' => array( 'green' ),
- );
- $this->array_list['baz'] = array(
- 'name' => 'baz',
- 'id' => 'z',
- 'field1' => true,
- 'field2' => false,
- 'field3' => false,
- 'field4' => array( 'blue' ),
- );
- foreach ( $this->array_list as $key => $value ) {
- $this->object_list[ $key ] = (object) $value;
- }
- }
-
- function test_filter_object_list_and() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field1' => true,
- 'field2' => true,
- ),
- 'AND'
- );
- $this->assertEquals( 2, count( $list ) );
- $this->assertArrayHasKey( 'foo', $list );
- $this->assertArrayHasKey( 'bar', $list );
- }
-
- function test_filter_object_list_or() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field1' => true,
- 'field2' => true,
- ),
- 'OR'
- );
- $this->assertEquals( 3, count( $list ) );
- $this->assertArrayHasKey( 'foo', $list );
- $this->assertArrayHasKey( 'bar', $list );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
- function test_filter_object_list_not() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field2' => true,
- 'field3' => true,
- ),
- 'NOT'
- );
- $this->assertEquals( 1, count( $list ) );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
- function test_filter_object_list_and_field() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field1' => true,
- 'field2' => true,
- ),
- 'AND',
- 'name'
- );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'bar' => 'bar',
- ),
- $list
- );
- }
-
- function test_filter_object_list_or_field() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field2' => true,
- 'field3' => true,
- ),
- 'OR',
- 'name'
- );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'bar' => 'bar',
- ),
- $list
- );
- }
-
- function test_filter_object_list_not_field() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field2' => true,
- 'field3' => true,
- ),
- 'NOT',
- 'name'
- );
- $this->assertEquals( array( 'baz' => 'baz' ), $list );
- }
-
- function test_wp_list_pluck() {
- $list = wp_list_pluck( $this->object_list, 'name' );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'bar' => 'bar',
- 'baz' => 'baz',
- ),
- $list
- );
-
- $list = wp_list_pluck( $this->array_list, 'name' );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'bar' => 'bar',
- 'baz' => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 28666
- */
- function test_wp_list_pluck_index_key() {
- $list = wp_list_pluck( $this->array_list, 'name', 'id' );
- $this->assertEquals(
- array(
- 'f' => 'foo',
- 'b' => 'bar',
- 'z' => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 28666
- */
- function test_wp_list_pluck_object_index_key() {
- $list = wp_list_pluck( $this->object_list, 'name', 'id' );
- $this->assertEquals(
- array(
- 'f' => 'foo',
- 'b' => 'bar',
- 'z' => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 28666
- */
- function test_wp_list_pluck_missing_index_key() {
- $list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
- $this->assertEquals(
- array(
- 0 => 'foo',
- 1 => 'bar',
- 2 => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 28666
- */
- function test_wp_list_pluck_partial_missing_index_key() {
- $array_list = $this->array_list;
- unset( $array_list['bar']['id'] );
- $list = wp_list_pluck( $array_list, 'name', 'id' );
- $this->assertEquals(
- array(
- 'f' => 'foo',
- 0 => 'bar',
- 'z' => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 28666
- */
- function test_wp_list_pluck_mixed_index_key() {
- $mixed_list = $this->array_list;
- $mixed_list['bar'] = (object) $mixed_list['bar'];
- $list = wp_list_pluck( $mixed_list, 'name', 'id' );
- $this->assertEquals(
- array(
- 'f' => 'foo',
- 'b' => 'bar',
- 'z' => 'baz',
- ),
- $list
- );
- }
-
- /**
- * @ticket 16895
- */
- function test_wp_list_pluck_containing_references() {
- $ref_list = array(
- & $this->object_list['foo'],
- & $this->object_list['bar'],
- );
-
- $this->assertInstanceOf( 'stdClass', $ref_list[0] );
- $this->assertInstanceOf( 'stdClass', $ref_list[1] );
-
- $list = wp_list_pluck( $ref_list, 'name' );
- $this->assertEquals(
- array(
- 'foo',
- 'bar',
- ),
- $list
- );
-
- $this->assertInstanceOf( 'stdClass', $ref_list[0] );
- $this->assertInstanceOf( 'stdClass', $ref_list[1] );
- }
-
- /**
- * @ticket 16895
- */
- function test_wp_list_pluck_containing_references_keys() {
- $ref_list = array(
- & $this->object_list['foo'],
- & $this->object_list['bar'],
- );
-
- $this->assertInstanceOf( 'stdClass', $ref_list[0] );
- $this->assertInstanceOf( 'stdClass', $ref_list[1] );
-
- $list = wp_list_pluck( $ref_list, 'name', 'id' );
- $this->assertEquals(
- array(
- 'f' => 'foo',
- 'b' => 'bar',
- ),
- $list
- );
-
- $this->assertInstanceOf( 'stdClass', $ref_list[0] );
- $this->assertInstanceOf( 'stdClass', $ref_list[1] );
- }
-
- function test_filter_object_list_nested_array_and() {
- $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
- $this->assertEquals( 1, count( $list ) );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
- function test_filter_object_list_nested_array_not() {
- $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
- $this->assertEquals( 2, count( $list ) );
- $this->assertArrayHasKey( 'bar', $list );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
- function test_filter_object_list_nested_array_or() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field3' => true,
- 'field4' => array( 'blue' ),
- ),
- 'OR'
- );
- $this->assertEquals( 2, count( $list ) );
- $this->assertArrayHasKey( 'foo', $list );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
- function test_filter_object_list_nested_array_or_singular() {
- $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
- $this->assertEquals( 1, count( $list ) );
- $this->assertArrayHasKey( 'baz', $list );
- }
-
-
- function test_filter_object_list_nested_array_and_field() {
- $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
- $this->assertEquals( array( 'baz' => 'baz' ), $list );
- }
-
- function test_filter_object_list_nested_array_not_field() {
- $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'baz' => 'baz',
- ),
- $list
- );
- }
-
- function test_filter_object_list_nested_array_or_field() {
- $list = wp_filter_object_list(
- $this->object_list,
- array(
- 'field3' => true,
- 'field4' => array( 'blue' ),
- ),
- 'OR',
- 'name'
- );
- $this->assertEquals(
- array(
- 'foo' => 'foo',
- 'baz' => 'baz',
- ),
- $list
- );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsfunctionsnumberFormatI18nphp"></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/functions/numberFormatI18n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/numberFormatI18n.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/numberFormatI18n.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> * @group i18n
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_Number_Format_I18n extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_NumberFormatI18n extends WP_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_should_fall_back_to_number_format_when_wp_locale_is_not_set() {
</span><span class="cx" style="display: block; padding: 0 10px"> $locale = clone $GLOBALS['wp_locale'];
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_locale'] = null;
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionspluginBasenamephp"></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/functions/pluginBasename.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/pluginBasename.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/pluginBasename.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> * @group plugins
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Plugin_Basename extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_PluginBasename extends WP_UnitTestCase {
</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"> * @var array
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionssizeFormatphp"></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/functions/sizeFormat.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/sizeFormat.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/sizeFormat.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 36635
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_Size_Format extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_SizeFormat extends WP_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px"> public function _data_size_format() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> array( array(), 0, false ),
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionsunderscoreReturnphp"></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/functions/underscoreReturn.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/underscoreReturn.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/underscoreReturn.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_Underscore_Return extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_UnderscoreReturn extends WP_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function test__return_true() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( __return_true() );
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpArraySliceAssocphp"></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/functions/wpArraySliceAssoc.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpArraySliceAssoc.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpArraySliceAssoc.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,7 +8,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers wp_array_slice_assoc
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_WpArraySliceAssoc extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpArraySliceAssoc extends WP_UnitTestCase {
</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"> * Test wp_array_slice_assoc().
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpAuthCheckphp"></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/functions/wpAuthCheck.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpAuthCheck.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpAuthCheck.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_WP_Auth_Check extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpAuthCheck extends WP_UnitTestCase {
</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"> * Run with user not logged in.
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpGetArchivesphpfromrev47779trunktestsphpunittestsfunctionsgetArchivesphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/tests/phpunit/tests/functions/wpGetArchives.php (from rev 47779, trunk/tests/phpunit/tests/functions/getArchives.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpGetArchives.php (rev 0)
+++ trunk/tests/phpunit/tests/functions/wpGetArchives.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,209 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/*
+$defaults = array(
+ 'type' => 'monthly', 'limit' => '',
+ 'format' => 'html', 'before' => '',
+ 'after' => '', 'show_post_count' => false,
+ 'echo' => 1, 'order' => 'DESC',
+);
+*/
+class Tests_Functions_wpGetArchives extends WP_UnitTestCase {
+ protected static $post_ids;
+ protected $month_url;
+ protected $year_url;
+
+ function setUp() {
+ parent::setUp();
+
+ $this->month_url = get_month_link( gmdate( 'Y' ), gmdate( 'm' ) );
+ $this->year_url = get_year_link( gmdate( 'Y' ) );
+ }
+
+ public static function wpSetUpBeforeClass( $factory ) {
+ self::$post_ids = $factory->post->create_many(
+ 8,
+ array(
+ 'post_type' => 'post',
+ 'post_author' => '1',
+ )
+ );
+ }
+
+ function test_wp_get_archives_default() {
+ $expected['default'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>';
+ $this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
+ }
+
+ function test_wp_get_archives_type() {
+ $expected['type'] = "<li><a href='" . $this->year_url . "'>" . gmdate( 'Y' ) . '</a></li>';
+ $this->assertEquals(
+ $expected['type'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'type' => 'yearly',
+ )
+ )
+ )
+ );
+ }
+
+ function test_wp_get_archives_limit() {
+ $ids = array_slice( array_reverse( self::$post_ids ), 0, 5 );
+
+ $link1 = get_permalink( $ids[0] );
+ $link2 = get_permalink( $ids[1] );
+ $link3 = get_permalink( $ids[2] );
+ $link4 = get_permalink( $ids[3] );
+ $link5 = get_permalink( $ids[4] );
+
+ $title1 = get_post( $ids[0] )->post_title;
+ $title2 = get_post( $ids[1] )->post_title;
+ $title3 = get_post( $ids[2] )->post_title;
+ $title4 = get_post( $ids[3] )->post_title;
+ $title5 = get_post( $ids[4] )->post_title;
+
+ $expected['limit'] = <<<EOF
+<li><a href='$link1'>$title1</a></li>
+ <li><a href='$link2'>$title2</a></li>
+ <li><a href='$link3'>$title3</a></li>
+ <li><a href='$link4'>$title4</a></li>
+ <li><a href='$link5'>$title5</a></li>
+EOF;
+ $this->assertEqualsIgnoreEOL(
+ $expected['limit'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'type' => 'postbypost',
+ 'limit' => 5,
+ )
+ )
+ )
+ );
+ }
+
+ function test_wp_get_archives_format() {
+ $expected['format'] = "<option value='" . $this->month_url . "'> " . gmdate( 'F Y' ) . ' </option>';
+ $this->assertEquals(
+ $expected['format'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'format' => 'option',
+ )
+ )
+ )
+ );
+ }
+
+ function test_wp_get_archives_before_and_after() {
+ $expected['before_and_after'] = "<div><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></div>';
+ $this->assertEquals(
+ $expected['before_and_after'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'format' => 'custom',
+ 'before' => '<div>',
+ 'after' => '</div>',
+ )
+ )
+ )
+ );
+ }
+
+ function test_wp_get_archives_show_post_count() {
+ $expected['show_post_count'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a> (8)</li>';
+ $this->assertEquals(
+ $expected['show_post_count'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'show_post_count' => 1,
+ )
+ )
+ )
+ );
+ }
+
+ function test_wp_get_archives_echo() {
+ $expected['echo'] = "\t<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>' . "\n";
+ $this->expectOutputString( $expected['echo'] );
+ wp_get_archives( array( 'echo' => true ) );
+ }
+
+ function test_wp_get_archives_order() {
+ self::factory()->post->create(
+ array(
+ 'post_type' => 'post',
+ 'post_author' => '1',
+ 'post_date' => '2012-10-23 19:34:42',
+ )
+ );
+
+ $date_full = gmdate( 'F Y' );
+ $oct_url = get_month_link( 2012, 10 );
+ $expected['order_asc'] = <<<EOF
+<li><a href='{$oct_url}'>October 2012</a></li>
+ <li><a href='{$this->month_url}'>$date_full</a></li>
+EOF;
+ $this->assertEqualsIgnoreEOL(
+ $expected['order_asc'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'order' => 'ASC',
+ )
+ )
+ )
+ );
+
+ $expected['order_desc'] = <<<EOF
+<li><a href='{$this->month_url}'>$date_full</a></li>
+ <li><a href='{$oct_url}'>October 2012</a></li>
+EOF;
+ $this->assertEqualsIgnoreEOL(
+ $expected['order_desc'],
+ trim(
+ wp_get_archives(
+ array(
+ 'echo' => false,
+ 'order' => 'DESC',
+ )
+ )
+ )
+ );
+ }
+
+ /**
+ * @ticket 21596
+ */
+ function test_wp_get_archives_post_type() {
+ register_post_type( 'taco', array( 'public' => true ) );
+
+ self::factory()->post->create(
+ array(
+ 'post_type' => 'taco',
+ 'post_author' => '1',
+ 'post_date' => '2014-10-23 19:34:42',
+ )
+ );
+
+ $oct_url = esc_url( add_query_arg( 'post_type', 'taco', get_month_link( 2014, 10 ) ) );
+ $expected = "<li><a href='{$oct_url}'>October 2014</a></li>";
+ $archives = wp_get_archives(
+ array(
+ 'echo' => false,
+ 'post_type' => 'taco',
+ )
+ );
+ $this->assertEquals( $expected, trim( $archives ) );
+ }
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpGetMimeTypesphp"></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/functions/wpGetMimeTypes.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpGetMimeTypes.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpGetMimeTypes.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_wp_get_mime_types extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpGetMimeTypes extends WP_UnitTestCase {
</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"> * @ticket 47701
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpListFilterphpfromrev47779trunktestsphpunittestsfunctionslistFilterphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: trunk/tests/phpunit/tests/functions/wpListFilter.php (from rev 47779, trunk/tests/phpunit/tests/functions/listFilter.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpListFilter.php (rev 0)
+++ trunk/tests/phpunit/tests/functions/wpListFilter.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,355 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck().
+ *
+ * @group functions.php
+ */
+class Tests_Functions_wpListFilter extends WP_UnitTestCase {
+ var $object_list = array();
+ var $array_list = array();
+
+ function setUp() {
+ parent::setUp();
+ $this->array_list['foo'] = array(
+ 'name' => 'foo',
+ 'id' => 'f',
+ 'field1' => true,
+ 'field2' => true,
+ 'field3' => true,
+ 'field4' => array( 'red' ),
+ );
+ $this->array_list['bar'] = array(
+ 'name' => 'bar',
+ 'id' => 'b',
+ 'field1' => true,
+ 'field2' => true,
+ 'field3' => false,
+ 'field4' => array( 'green' ),
+ );
+ $this->array_list['baz'] = array(
+ 'name' => 'baz',
+ 'id' => 'z',
+ 'field1' => true,
+ 'field2' => false,
+ 'field3' => false,
+ 'field4' => array( 'blue' ),
+ );
+ foreach ( $this->array_list as $key => $value ) {
+ $this->object_list[ $key ] = (object) $value;
+ }
+ }
+
+ function test_filter_object_list_and() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field1' => true,
+ 'field2' => true,
+ ),
+ 'AND'
+ );
+ $this->assertEquals( 2, count( $list ) );
+ $this->assertArrayHasKey( 'foo', $list );
+ $this->assertArrayHasKey( 'bar', $list );
+ }
+
+ function test_filter_object_list_or() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field1' => true,
+ 'field2' => true,
+ ),
+ 'OR'
+ );
+ $this->assertEquals( 3, count( $list ) );
+ $this->assertArrayHasKey( 'foo', $list );
+ $this->assertArrayHasKey( 'bar', $list );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+ function test_filter_object_list_not() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field2' => true,
+ 'field3' => true,
+ ),
+ 'NOT'
+ );
+ $this->assertEquals( 1, count( $list ) );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+ function test_filter_object_list_and_field() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field1' => true,
+ 'field2' => true,
+ ),
+ 'AND',
+ 'name'
+ );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'bar' => 'bar',
+ ),
+ $list
+ );
+ }
+
+ function test_filter_object_list_or_field() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field2' => true,
+ 'field3' => true,
+ ),
+ 'OR',
+ 'name'
+ );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'bar' => 'bar',
+ ),
+ $list
+ );
+ }
+
+ function test_filter_object_list_not_field() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field2' => true,
+ 'field3' => true,
+ ),
+ 'NOT',
+ 'name'
+ );
+ $this->assertEquals( array( 'baz' => 'baz' ), $list );
+ }
+
+ function test_wp_list_pluck() {
+ $list = wp_list_pluck( $this->object_list, 'name' );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'bar' => 'bar',
+ 'baz' => 'baz',
+ ),
+ $list
+ );
+
+ $list = wp_list_pluck( $this->array_list, 'name' );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'bar' => 'bar',
+ 'baz' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 28666
+ */
+ function test_wp_list_pluck_index_key() {
+ $list = wp_list_pluck( $this->array_list, 'name', 'id' );
+ $this->assertEquals(
+ array(
+ 'f' => 'foo',
+ 'b' => 'bar',
+ 'z' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 28666
+ */
+ function test_wp_list_pluck_object_index_key() {
+ $list = wp_list_pluck( $this->object_list, 'name', 'id' );
+ $this->assertEquals(
+ array(
+ 'f' => 'foo',
+ 'b' => 'bar',
+ 'z' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 28666
+ */
+ function test_wp_list_pluck_missing_index_key() {
+ $list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
+ $this->assertEquals(
+ array(
+ 0 => 'foo',
+ 1 => 'bar',
+ 2 => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 28666
+ */
+ function test_wp_list_pluck_partial_missing_index_key() {
+ $array_list = $this->array_list;
+ unset( $array_list['bar']['id'] );
+ $list = wp_list_pluck( $array_list, 'name', 'id' );
+ $this->assertEquals(
+ array(
+ 'f' => 'foo',
+ 0 => 'bar',
+ 'z' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 28666
+ */
+ function test_wp_list_pluck_mixed_index_key() {
+ $mixed_list = $this->array_list;
+ $mixed_list['bar'] = (object) $mixed_list['bar'];
+ $list = wp_list_pluck( $mixed_list, 'name', 'id' );
+ $this->assertEquals(
+ array(
+ 'f' => 'foo',
+ 'b' => 'bar',
+ 'z' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ /**
+ * @ticket 16895
+ */
+ function test_wp_list_pluck_containing_references() {
+ $ref_list = array(
+ & $this->object_list['foo'],
+ & $this->object_list['bar'],
+ );
+
+ $this->assertInstanceOf( 'stdClass', $ref_list[0] );
+ $this->assertInstanceOf( 'stdClass', $ref_list[1] );
+
+ $list = wp_list_pluck( $ref_list, 'name' );
+ $this->assertEquals(
+ array(
+ 'foo',
+ 'bar',
+ ),
+ $list
+ );
+
+ $this->assertInstanceOf( 'stdClass', $ref_list[0] );
+ $this->assertInstanceOf( 'stdClass', $ref_list[1] );
+ }
+
+ /**
+ * @ticket 16895
+ */
+ function test_wp_list_pluck_containing_references_keys() {
+ $ref_list = array(
+ & $this->object_list['foo'],
+ & $this->object_list['bar'],
+ );
+
+ $this->assertInstanceOf( 'stdClass', $ref_list[0] );
+ $this->assertInstanceOf( 'stdClass', $ref_list[1] );
+
+ $list = wp_list_pluck( $ref_list, 'name', 'id' );
+ $this->assertEquals(
+ array(
+ 'f' => 'foo',
+ 'b' => 'bar',
+ ),
+ $list
+ );
+
+ $this->assertInstanceOf( 'stdClass', $ref_list[0] );
+ $this->assertInstanceOf( 'stdClass', $ref_list[1] );
+ }
+
+ function test_filter_object_list_nested_array_and() {
+ $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
+ $this->assertEquals( 1, count( $list ) );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+ function test_filter_object_list_nested_array_not() {
+ $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
+ $this->assertEquals( 2, count( $list ) );
+ $this->assertArrayHasKey( 'bar', $list );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+ function test_filter_object_list_nested_array_or() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field3' => true,
+ 'field4' => array( 'blue' ),
+ ),
+ 'OR'
+ );
+ $this->assertEquals( 2, count( $list ) );
+ $this->assertArrayHasKey( 'foo', $list );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+ function test_filter_object_list_nested_array_or_singular() {
+ $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
+ $this->assertEquals( 1, count( $list ) );
+ $this->assertArrayHasKey( 'baz', $list );
+ }
+
+
+ function test_filter_object_list_nested_array_and_field() {
+ $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
+ $this->assertEquals( array( 'baz' => 'baz' ), $list );
+ }
+
+ function test_filter_object_list_nested_array_not_field() {
+ $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'baz' => 'baz',
+ ),
+ $list
+ );
+ }
+
+ function test_filter_object_list_nested_array_or_field() {
+ $list = wp_filter_object_list(
+ $this->object_list,
+ array(
+ 'field3' => true,
+ 'field4' => array( 'blue' ),
+ ),
+ 'OR',
+ 'name'
+ );
+ $this->assertEquals(
+ array(
+ 'foo' => 'foo',
+ 'baz' => 'baz',
+ ),
+ $list
+ );
+ }
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpListUtilphp"></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/functions/wpListUtil.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpListUtil.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpListUtil.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_WP_List_Util extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpListUtil extends WP_UnitTestCase {
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function data_test_wp_list_pluck() {
</span><span class="cx" style="display: block; padding: 0 10px"> return array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'arrays' => array(
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpRemoteFopenphp"></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/functions/wpRemoteFopen.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpRemoteFopen.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpRemoteFopen.php 2020-05-10 12:07:49 UTC (rev 47780)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @group external-http
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_wp_remote_fopen extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpRemoteFopen extends WP_UnitTestCase {
</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"> * @ticket 48845
</span></span></pre></div>
<a id="trunktestsphpunittestsfunctionswpValidateBooleanphp"></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/functions/wpValidateBoolean.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/functions/wpValidateBoolean.php 2020-05-10 05:21:48 UTC (rev 47779)
+++ trunk/tests/phpunit/tests/functions/wpValidateBoolean.php 2020-05-10 12:07:49 UTC (rev 47780)
</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"> * @covers ::wp_validate_boolean
</span><span class="cx" style="display: block; padding: 0 10px"> * @group functions.php
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_Functions_WpValidateBoolean extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Provides test scenarios for all possible scenarios in wp_validate_boolean().
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre>
</div>
</div>
</body>
</html>