<!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>[53494] trunk/tests/phpunit/tests/option: Tests: Rename classes in `phpunit/tests/option/` 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/53494">53494</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/53494","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-06-13 15:24:11 +0000 (Mon, 13 Jun 2022)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Tests: Rename classes in `phpunit/tests/option/` per the naming conventions.

https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to <a href="https://core.trac.wordpress.org/changeset/47780">[47780]</a>, <a href="https://core.trac.wordpress.org/changeset/48911">[48911]</a>, <a href="https://core.trac.wordpress.org/changeset/49327">[49327]</a>, <a href="https://core.trac.wordpress.org/changeset/50291">[50291]</a>, <a href="https://core.trac.wordpress.org/changeset/50292">[50292]</a>, <a href="https://core.trac.wordpress.org/changeset/50342">[50342]</a>, <a href="https://core.trac.wordpress.org/changeset/50452">[50452]</a>, <a href="https://core.trac.wordpress.org/changeset/50453">[50453]</a>, <a href="https://core.trac.wordpress.org/changeset/50456">[50456]</a>, <a href="https://core.trac.wordpress.org/changeset/50967">[50967]</a>, <a href="https://core.trac.wordpress.org/changeset/50968">[50968]</a>, <a href="https://core.trac.wordpress.org/changeset/50969">[50969]</a>, <a href="https://core.trac.wordpress.org/changeset/51491">[51491]</a>, <a href="https://core.trac.wordpress.org/changeset/51492">[514
 92]</a>, <a href="https://core.trac.wordpress.org/changeset/51493">[51493]</a>, <a href="https://core.trac.wordpress.org/changeset/51623">[51623]</a>, <a href="https://core.trac.wordpress.org/changeset/51639">[51639]</a>, <a href="https://core.trac.wordpress.org/changeset/51646">[51646]</a>, <a href="https://core.trac.wordpress.org/changeset/51650">[51650]</a>, <a href="https://core.trac.wordpress.org/changeset/51651">[51651]</a>, <a href="https://core.trac.wordpress.org/changeset/51860">[51860]</a>, <a href="https://core.trac.wordpress.org/changeset/52264">[52264]</a>, <a href="https://core.trac.wordpress.org/changeset/52265">[52265]</a>, <a href="https://core.trac.wordpress.org/changeset/53489">[53489]</a>.

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsoptionmultisitephp">trunk/tests/phpunit/tests/option/multisite.php</a></li>
<li><a href="#trunktestsphpunittestsoptionoptionphp">trunk/tests/phpunit/tests/option/option.php</a></li>
<li><a href="#trunktestsphpunittestsoptionthemeModsphp">trunk/tests/phpunit/tests/option/themeMods.php</a></li>
<li><a href="#trunktestsphpunittestsoptionuserSettingsphp">trunk/tests/phpunit/tests/option/userSettings.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsoptionsanitizeOptionphp">trunk/tests/phpunit/tests/option/sanitizeOption.php</a></li>
<li><a href="#trunktestsphpunittestsoptionwpLoadAlloptionsphp">trunk/tests/phpunit/tests/option/wpLoadAlloptions.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsoptionsanitizeoptionphp">trunk/tests/phpunit/tests/option/sanitize-option.php</a></li>
<li><a href="#trunktestsphpunittestsoptionwpLoadAllOptionsphp">trunk/tests/phpunit/tests/option/wpLoadAllOptions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunittestsoptionmultisitephp"></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/option/multisite.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/multisite.php    2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/multisite.php      2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9,7 +9,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @group ms-option
</span><span class="cx" style="display: block; padding: 0 10px">         * @group multisite
</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_Multisite_Option extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ class Tests_Option_Multisite 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_from_same_site() {
</span><span class="cx" style="display: block; padding: 0 10px">                        $key    = __FUNCTION__ . '_1';
</span></span></pre></div>
<a id="trunktestsphpunittestsoptionoptionphp"></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/option/option.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/option.php       2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/option.php 2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -224,17 +224,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                delete_option( 'notoptions' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function data_option_autoloading() {
-               return array(
-                       array( 'autoload_yes', 'yes', 'yes' ),
-                       array( 'autoload_true', true, 'yes' ),
-                       array( 'autoload_string', 'foo', 'yes' ),
-                       array( 'autoload_int', 123456, 'yes' ),
-                       array( 'autoload_array', array(), 'yes' ),
-                       array( 'autoload_no', 'no', 'no' ),
-                       array( 'autoload_false', false, 'no' ),
-               );
-       }
</del><span class="cx" style="display: block; padding: 0 10px">         /**
</span><span class="cx" style="display: block; padding: 0 10px">         * Options should be autoloaded unless they were added with "no" or `false`.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,4 +238,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $actual = $wpdb->get_row( $wpdb->prepare( "SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1", $name ) );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertSame( $expected, $actual->autoload );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Data provider.
+        *
+        * @return array
+        */
+       public function data_option_autoloading() {
+               return array(
+                       array( 'autoload_yes', 'yes', 'yes' ),
+                       array( 'autoload_true', true, 'yes' ),
+                       array( 'autoload_string', 'foo', 'yes' ),
+                       array( 'autoload_int', 123456, 'yes' ),
+                       array( 'autoload_array', array(), 'yes' ),
+                       array( 'autoload_no', 'no', 'no' ),
+                       array( 'autoload_false', false, 'no' ),
+               );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsoptionsanitizeoptionphp"></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/option/sanitize-option.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/sanitize-option.php      2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/sanitize-option.php        2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,162 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group option
- */
-class Tests_Sanitize_Option extends WP_UnitTestCase {
-
-       /**
-        * Data provider to test all of the sanitize_option() case
-        *
-        * Inner array params: $option_name, $sanitized, $original
-        *
-        * @return array
-        */
-       public function sanitize_option_provider() {
-               return array(
-                       array( 'admin_email', 'mail@example.com', 'mail@example.com' ),
-                       array( 'admin_email', get_option( 'admin_email' ), 'invalid' ),
-                       array( 'page_on_front', 0, 0 ),
-                       array( 'page_on_front', 10, '-10' ),
-                       array( 'posts_per_page', 10, 10 ),
-                       array( 'posts_per_page', -1, -1 ),
-                       array( 'posts_per_page', 2, -2 ),
-                       array( 'posts_per_page', 1, 'ten' ),
-                       array( 'default_ping_status', 'open', 'open' ),
-                       array( 'default_ping_status', 'closed', '' ),
-                       array( 'blogname', 'My Site', 'My Site' ),
-                       array( 'blogname', '&lt;i&gt;My Site&lt;/i&gt;', '<i>My Site</i>' ),
-                       array( 'blog_charset', 'UTF-8', 'UTF-8' ),
-                       array( 'blog_charset', 'charset', '">charset<"' ),
-                       array( 'blog_public', 1, null ),
-                       array( 'blog_public', 1, '1' ),
-                       array( 'blog_public', -2, '-2' ),
-                       array( 'date_format', 'F j, Y', 'F j, Y' ),
-                       array( 'date_format', 'F j, Y', 'F j, <strong>Y</strong>' ),
-                       array( 'ping_sites', 'http://rpc.pingomatic.com/', 'http://rpc.pingomatic.com/' ),
-                       array( 'ping_sites', "http://www.example.com\nhttp://example.org", "www.example.com \n\texample.org\n\n" ),
-                       array( 'gmt_offset', '0', 0 ),
-                       array( 'gmt_offset', '1.5', '1.5' ),
-                       array( 'siteurl', 'http://example.org', 'http://example.org' ),
-                       array( 'siteurl', 'http://example.org/subdir', 'http://example.org/subdir' ),
-                       array( 'siteurl', get_option( 'siteurl' ), '' ),
-                       array( 'home', 'http://example.org', 'http://example.org' ),
-                       array( 'home', 'https://example.org', 'https://example.org' ),
-                       array( 'home', 'http://localhost:8000', 'http://localhost:8000' ),
-                       array( 'home', get_option( 'home' ), '' ),
-                       array( 'WPLANG', 0, 0 ),
-                       array( 'WPLANG', '', '' ),
-                       array(
-                               'illegal_names',
-                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
-                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
-                       ),
-                       array(
-                               'illegal_names',
-                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
-                               'www     web root admin main invite administrator files',
-                       ),
-                       array(
-                               'banned_email_domains',
-                               array( 'mail.com', 'gmail.com' ),
-                               array( 'mail.com', 'gmail.com' ),
-                       ),
-                       array(
-                               'banned_email_domains',
-                               array( 'mail.com' ),
-                               "mail.com\ngmail,com",
-                       ),
-                       array( 'timezone_string', 0, 0 ),
-                       array( 'timezone_string', 'Europe/London', 'Europe/London' ),
-                       array( 'timezone_string', get_option( 'timezone_string' ), 'invalid' ),
-                       array( 'permalink_structure', '', '' ),
-                       array( 'permalink_structure', '/%year%/%20%postname%', '/%year%/ %postname%' ),
-                       array( 'default_role', 'subscriber', 'subscriber' ),
-                       array( 'default_role', 'subscriber', 'invalid' ),
-                       array( 'default_role', 'editor', 'editor' ),
-                       array( 'moderation_keys', 'string of words', 'string of words' ),
-                       array( 'moderation_keys', "one\ntwo three", "one\none\ntwo three" ),
-               );
-       }
-
-       /**
-        * @dataProvider sanitize_option_provider
-        */
-       public function test_sanitize_option( $option_name, $sanitized, $original ) {
-               $this->assertSame( $sanitized, sanitize_option( $option_name, $original ) );
-       }
-
-       public function upload_path_provider() {
-               return array(
-                       array( '<a href="http://www.example.com">Link</a>', 'Link' ),
-                       array( '<scr' . 'ipt>url</scr' . 'ipt>', 'url' ),
-                       array( '/path/to/things', '/path/to/things' ),
-                       array( '\path\to\things', '\path\to\things' ),
-               );
-       }
-
-       /**
-        * @dataProvider upload_path_provider
-        */
-       public function test_sanitize_option_upload_path( $provided, $expected ) {
-               $this->assertSame( $expected, sanitize_option( 'upload_path', $provided ) );
-       }
-
-       /**
-        * @ticket 36122
-        */
-       public function test_emoji_in_blogname_and_description() {
-               global $wpdb;
-
-               $value = "whee\xf0\x9f\x98\x88";
-
-               if ( 'utf8mb4' === $wpdb->get_col_charset( $wpdb->options, 'option_value' ) ) {
-                       $expected = $value;
-               } else {
-                       $expected = 'whee&#x1f608;';
-               }
-
-               $this->assertSame( $expected, sanitize_option( 'blogname', $value ) );
-               $this->assertSame( $expected, sanitize_option( 'blogdescription', $value ) );
-       }
-
-       /**
-        * @dataProvider permalink_structure_provider
-        */
-       public function test_sanitize_permalink_structure( $provided, $expected, $valid ) {
-               global $wp_settings_errors;
-
-               $old_wp_settings_errors = (array) $wp_settings_errors;
-
-               $actual = sanitize_option( 'permalink_structure', $provided );
-               $errors = get_settings_errors( 'permalink_structure' );
-
-               // Clear errors.
-               $wp_settings_errors = $old_wp_settings_errors;
-
-               if ( $valid ) {
-                       $this->assertEmpty( $errors );
-               } else {
-                       $this->assertNotEmpty( $errors );
-                       $this->assertSame( 'invalid_permalink_structure', $errors[0]['code'] );
-               }
-
-               $this->assertEquals( $expected, $actual );
-       }
-
-       public function permalink_structure_provider() {
-               return array(
-                       array( '', '', true ),
-                       array( '%postname', false, false ),
-                       array( '%/%', false, false ),
-                       array( '%%%', false, false ),
-                       array( '%a%', '%a%', true ),
-                       array( '%postname%', '%postname%', true ),
-                       array( '/%postname%/', '/%postname%/', true ),
-                       array( '/%year%/%monthnum%/%day%/%postname%/', '/%year%/%monthnum%/%day%/%postname%/', true ),
-                       array( '/%year/%postname%/', '/%year/%postname%/', true ),
-                       array( new WP_Error( 'wpdb_get_table_charset_failure' ), false, false ), // @ticket 53986
-               );
-       }
-
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsoptionsanitizeOptionphpfromrev53493trunktestsphpunittestsoptionsanitizeoptionphp"></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/option/sanitizeOption.php (from rev 53493, trunk/tests/phpunit/tests/option/sanitize-option.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/sanitizeOption.php                               (rev 0)
+++ trunk/tests/phpunit/tests/option/sanitizeOption.php 2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,162 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SanitizeOption extends WP_UnitTestCase {
+
+       /**
+        * Data provider to test all of the sanitize_option() case
+        *
+        * Inner array params: $option_name, $sanitized, $original
+        *
+        * @return array
+        */
+       public function sanitize_option_provider() {
+               return array(
+                       array( 'admin_email', 'mail@example.com', 'mail@example.com' ),
+                       array( 'admin_email', get_option( 'admin_email' ), 'invalid' ),
+                       array( 'page_on_front', 0, 0 ),
+                       array( 'page_on_front', 10, '-10' ),
+                       array( 'posts_per_page', 10, 10 ),
+                       array( 'posts_per_page', -1, -1 ),
+                       array( 'posts_per_page', 2, -2 ),
+                       array( 'posts_per_page', 1, 'ten' ),
+                       array( 'default_ping_status', 'open', 'open' ),
+                       array( 'default_ping_status', 'closed', '' ),
+                       array( 'blogname', 'My Site', 'My Site' ),
+                       array( 'blogname', '&lt;i&gt;My Site&lt;/i&gt;', '<i>My Site</i>' ),
+                       array( 'blog_charset', 'UTF-8', 'UTF-8' ),
+                       array( 'blog_charset', 'charset', '">charset<"' ),
+                       array( 'blog_public', 1, null ),
+                       array( 'blog_public', 1, '1' ),
+                       array( 'blog_public', -2, '-2' ),
+                       array( 'date_format', 'F j, Y', 'F j, Y' ),
+                       array( 'date_format', 'F j, Y', 'F j, <strong>Y</strong>' ),
+                       array( 'ping_sites', 'http://rpc.pingomatic.com/', 'http://rpc.pingomatic.com/' ),
+                       array( 'ping_sites', "http://www.example.com\nhttp://example.org", "www.example.com \n\texample.org\n\n" ),
+                       array( 'gmt_offset', '0', 0 ),
+                       array( 'gmt_offset', '1.5', '1.5' ),
+                       array( 'siteurl', 'http://example.org', 'http://example.org' ),
+                       array( 'siteurl', 'http://example.org/subdir', 'http://example.org/subdir' ),
+                       array( 'siteurl', get_option( 'siteurl' ), '' ),
+                       array( 'home', 'http://example.org', 'http://example.org' ),
+                       array( 'home', 'https://example.org', 'https://example.org' ),
+                       array( 'home', 'http://localhost:8000', 'http://localhost:8000' ),
+                       array( 'home', get_option( 'home' ), '' ),
+                       array( 'WPLANG', 0, 0 ),
+                       array( 'WPLANG', '', '' ),
+                       array(
+                               'illegal_names',
+                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
+                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
+                       ),
+                       array(
+                               'illegal_names',
+                               array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
+                               'www     web root admin main invite administrator files',
+                       ),
+                       array(
+                               'banned_email_domains',
+                               array( 'mail.com', 'gmail.com' ),
+                               array( 'mail.com', 'gmail.com' ),
+                       ),
+                       array(
+                               'banned_email_domains',
+                               array( 'mail.com' ),
+                               "mail.com\ngmail,com",
+                       ),
+                       array( 'timezone_string', 0, 0 ),
+                       array( 'timezone_string', 'Europe/London', 'Europe/London' ),
+                       array( 'timezone_string', get_option( 'timezone_string' ), 'invalid' ),
+                       array( 'permalink_structure', '', '' ),
+                       array( 'permalink_structure', '/%year%/%20%postname%', '/%year%/ %postname%' ),
+                       array( 'default_role', 'subscriber', 'subscriber' ),
+                       array( 'default_role', 'subscriber', 'invalid' ),
+                       array( 'default_role', 'editor', 'editor' ),
+                       array( 'moderation_keys', 'string of words', 'string of words' ),
+                       array( 'moderation_keys', "one\ntwo three", "one\none\ntwo three" ),
+               );
+       }
+
+       /**
+        * @dataProvider sanitize_option_provider
+        */
+       public function test_sanitize_option( $option_name, $sanitized, $original ) {
+               $this->assertSame( $sanitized, sanitize_option( $option_name, $original ) );
+       }
+
+       public function upload_path_provider() {
+               return array(
+                       array( '<a href="http://www.example.com">Link</a>', 'Link' ),
+                       array( '<scr' . 'ipt>url</scr' . 'ipt>', 'url' ),
+                       array( '/path/to/things', '/path/to/things' ),
+                       array( '\path\to\things', '\path\to\things' ),
+               );
+       }
+
+       /**
+        * @dataProvider upload_path_provider
+        */
+       public function test_sanitize_option_upload_path( $provided, $expected ) {
+               $this->assertSame( $expected, sanitize_option( 'upload_path', $provided ) );
+       }
+
+       /**
+        * @ticket 36122
+        */
+       public function test_emoji_in_blogname_and_description() {
+               global $wpdb;
+
+               $value = "whee\xf0\x9f\x98\x88";
+
+               if ( 'utf8mb4' === $wpdb->get_col_charset( $wpdb->options, 'option_value' ) ) {
+                       $expected = $value;
+               } else {
+                       $expected = 'whee&#x1f608;';
+               }
+
+               $this->assertSame( $expected, sanitize_option( 'blogname', $value ) );
+               $this->assertSame( $expected, sanitize_option( 'blogdescription', $value ) );
+       }
+
+       /**
+        * @dataProvider permalink_structure_provider
+        */
+       public function test_sanitize_permalink_structure( $provided, $expected, $valid ) {
+               global $wp_settings_errors;
+
+               $old_wp_settings_errors = (array) $wp_settings_errors;
+
+               $actual = sanitize_option( 'permalink_structure', $provided );
+               $errors = get_settings_errors( 'permalink_structure' );
+
+               // Clear errors.
+               $wp_settings_errors = $old_wp_settings_errors;
+
+               if ( $valid ) {
+                       $this->assertEmpty( $errors );
+               } else {
+                       $this->assertNotEmpty( $errors );
+                       $this->assertSame( 'invalid_permalink_structure', $errors[0]['code'] );
+               }
+
+               $this->assertEquals( $expected, $actual );
+       }
+
+       public function permalink_structure_provider() {
+               return array(
+                       array( '', '', true ),
+                       array( '%postname', false, false ),
+                       array( '%/%', false, false ),
+                       array( '%%%', false, false ),
+                       array( '%a%', '%a%', true ),
+                       array( '%postname%', '%postname%', true ),
+                       array( '/%postname%/', '/%postname%/', true ),
+                       array( '/%year%/%monthnum%/%day%/%postname%/', '/%year%/%monthnum%/%day%/%postname%/', true ),
+                       array( '/%year/%postname%/', '/%year/%postname%/', true ),
+                       array( new WP_Error( 'wpdb_get_table_charset_failure' ), false, false ), // @ticket 53986
+               );
+       }
+
+}
</ins></span></pre></div>
<a id="trunktestsphpunittestsoptionthemeModsphp"></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/option/themeMods.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/themeMods.php    2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/themeMods.php      2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * @group option
</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_Option_Theme_Mods extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Option_ThemeMods 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_theme_mod_default() {
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertFalse( get_theme_mod( 'non_existent' ) );
</span></span></pre></div>
<a id="trunktestsphpunittestsoptionuserSettingsphp"></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/option/userSettings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/userSettings.php 2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/userSettings.php   2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,8 +1,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?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">- * @group 123456
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @group option
+ * @group user
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-class Tests_User_Settings extends WP_UnitTestCase {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+class Tests_Option_UserSettings extends WP_UnitTestCase {
</ins><span class="cx" style="display: block; padding: 0 10px">         protected $user_id;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function set_up() {
</span></span></pre></div>
<a id="trunktestsphpunittestsoptionwpLoadAllOptionsphp"></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/option/wpLoadAllOptions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/wpLoadAllOptions.php     2022-06-13 15:20:02 UTC (rev 53493)
+++ trunk/tests/phpunit/tests/option/wpLoadAllOptions.php       2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,110 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Test wp_load_alloptions().
- *
- * @group option
- */
-class Tests_Option_WP_Load_Alloptions extends WP_UnitTestCase {
-       protected $alloptions = null;
-
-       public function tear_down() {
-               $this->alloptions = null;
-               parent::tear_down();
-       }
-
-       public function test_if_alloptions_is_cached() {
-               $this->assertNotEmpty( wp_cache_get( 'alloptions', 'options' ) );
-       }
-
-       /**
-        * @depends test_if_alloptions_is_cached
-        */
-       public function test_if_cached_alloptions_is_deleted() {
-               $this->assertTrue( wp_cache_delete( 'alloptions', 'options' ) );
-       }
-
-       /**
-        * @depends test_if_alloptions_is_cached
-        */
-       public function test_if_alloptions_are_retrieved_from_cache() {
-               global $wpdb;
-               $before = $wpdb->num_queries;
-               wp_load_alloptions();
-               $after = $wpdb->num_queries;
-
-               // Database has not been hit.
-               $this->assertSame( $before, $after );
-       }
-
-       /**
-        * @depends test_if_cached_alloptions_is_deleted
-        */
-       public function test_if_alloptions_are_retrieved_from_database() {
-               global $wpdb;
-
-               // Delete the existing cache first.
-               wp_cache_delete( 'alloptions', 'options' );
-
-               $before = $wpdb->num_queries;
-               wp_load_alloptions();
-               $after = $wpdb->num_queries;
-
-               // Database has been hit.
-               $this->assertSame( $before + 1, $after );
-       }
-
-       /**
-        * @depends test_if_cached_alloptions_is_deleted
-        */
-       public function test_filter_pre_cache_alloptions_is_called() {
-               $temp = wp_installing();
-
-               /**
-                * Set wp_installing() to false.
-                *
-                * If wp_installing is false and the cache is empty, the filter is called regardless if it's multisite or not.
-                */
-               wp_installing( false );
-
-               // Delete the existing cache first.
-               wp_cache_delete( 'alloptions', 'options' );
-
-               add_filter( 'pre_cache_alloptions', array( $this, 'return_pre_cache_filter' ) );
-               $all_options = wp_load_alloptions();
-
-               // Value could leak to other tests if not reset.
-               wp_installing( $temp );
-
-               // Filter was called.
-               $this->assertSame( $this->alloptions, $all_options );
-       }
-
-       /**
-        * @depends test_if_alloptions_is_cached
-        */
-       public function test_filter_pre_cache_alloptions_is_not_called() {
-               $temp = wp_installing();
-
-               /**
-                * Set wp_installing() to true.
-                *
-                * If wp_installing is true and it's multisite, the cache and filter are not used.
-                * If wp_installing is true and it's not multisite, the cache is used (if not empty), and the filter not.
-                */
-               wp_installing( true );
-
-               add_filter( 'pre_cache_alloptions', array( $this, 'return_pre_cache_filter' ) );
-               wp_load_alloptions();
-
-               // Value could leak to other tests if not reset.
-               wp_installing( $temp );
-
-               // Filter was not called.
-               $this->assertNull( $this->alloptions );
-       }
-
-       public function return_pre_cache_filter( $alloptions ) {
-               $this->alloptions = $alloptions;
-               return $this->alloptions;
-       }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsoptionwpLoadAlloptionsphpfromrev53493trunktestsphpunittestsoptionwpLoadAllOptionsphp"></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/option/wpLoadAlloptions.php (from rev 53493, trunk/tests/phpunit/tests/option/wpLoadAllOptions.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/option/wpLoadAlloptions.php                             (rev 0)
+++ trunk/tests/phpunit/tests/option/wpLoadAlloptions.php       2022-06-13 15:24:11 UTC (rev 53494)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,110 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Test wp_load_alloptions().
+ *
+ * @group option
+ */
+class Tests_Option_wpLoadAlloptions extends WP_UnitTestCase {
+       protected $alloptions = null;
+
+       public function tear_down() {
+               $this->alloptions = null;
+               parent::tear_down();
+       }
+
+       public function test_if_alloptions_is_cached() {
+               $this->assertNotEmpty( wp_cache_get( 'alloptions', 'options' ) );
+       }
+
+       /**
+        * @depends test_if_alloptions_is_cached
+        */
+       public function test_if_cached_alloptions_is_deleted() {
+               $this->assertTrue( wp_cache_delete( 'alloptions', 'options' ) );
+       }
+
+       /**
+        * @depends test_if_alloptions_is_cached
+        */
+       public function test_if_alloptions_are_retrieved_from_cache() {
+               global $wpdb;
+               $before = $wpdb->num_queries;
+               wp_load_alloptions();
+               $after = $wpdb->num_queries;
+
+               // Database has not been hit.
+               $this->assertSame( $before, $after );
+       }
+
+       /**
+        * @depends test_if_cached_alloptions_is_deleted
+        */
+       public function test_if_alloptions_are_retrieved_from_database() {
+               global $wpdb;
+
+               // Delete the existing cache first.
+               wp_cache_delete( 'alloptions', 'options' );
+
+               $before = $wpdb->num_queries;
+               wp_load_alloptions();
+               $after = $wpdb->num_queries;
+
+               // Database has been hit.
+               $this->assertSame( $before + 1, $after );
+       }
+
+       /**
+        * @depends test_if_cached_alloptions_is_deleted
+        */
+       public function test_filter_pre_cache_alloptions_is_called() {
+               $temp = wp_installing();
+
+               /**
+                * Set wp_installing() to false.
+                *
+                * If wp_installing is false and the cache is empty, the filter is called regardless if it's multisite or not.
+                */
+               wp_installing( false );
+
+               // Delete the existing cache first.
+               wp_cache_delete( 'alloptions', 'options' );
+
+               add_filter( 'pre_cache_alloptions', array( $this, 'return_pre_cache_filter' ) );
+               $all_options = wp_load_alloptions();
+
+               // Value could leak to other tests if not reset.
+               wp_installing( $temp );
+
+               // Filter was called.
+               $this->assertSame( $this->alloptions, $all_options );
+       }
+
+       /**
+        * @depends test_if_alloptions_is_cached
+        */
+       public function test_filter_pre_cache_alloptions_is_not_called() {
+               $temp = wp_installing();
+
+               /**
+                * Set wp_installing() to true.
+                *
+                * If wp_installing is true and it's multisite, the cache and filter are not used.
+                * If wp_installing is true and it's not multisite, the cache is used (if not empty), and the filter not.
+                */
+               wp_installing( true );
+
+               add_filter( 'pre_cache_alloptions', array( $this, 'return_pre_cache_filter' ) );
+               wp_load_alloptions();
+
+               // Value could leak to other tests if not reset.
+               wp_installing( $temp );
+
+               // Filter was not called.
+               $this->assertNull( $this->alloptions );
+       }
+
+       public function return_pre_cache_filter( $alloptions ) {
+               $this->alloptions = $alloptions;
+               return $this->alloptions;
+       }
+}
</ins></span></pre>
</div>
</div>

</body>
</html>