Skip to content

Explore running PHPUnit tests with WordPress Playground#2

Open
bgrgicak wants to merge 1 commit into
trunkfrom
explore/run-phpunit-tests-with-playground
Open

Explore running PHPUnit tests with WordPress Playground#2
bgrgicak wants to merge 1 commit into
trunkfrom
explore/run-phpunit-tests-with-playground

Conversation

@bgrgicak
Copy link
Copy Markdown
Owner

@bgrgicak bgrgicak commented Jan 19, 2026

This PR explores running WordPress unit tests with Playground using WP Tester and PHPUnit.

The goal of this PR is to understand the limitations of Playground and WP Tester and it shouldn't be merged.

Testing instructions

  • Checkout this PR
  • Install dependencies composer install
  • Run tests npx @wp-tester/cli test

Notes

  • There are some warnings at the start of the run related to extracting WordPress. They are a bug in WP Tester and are unrelated to the tests.
  • This PR skips multisite tests.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 19, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props berislavgrgicak, zieladam, janjakes.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@bgrgicak
Copy link
Copy Markdown
Owner Author

Test run errors:

 WordPress Core Tests - PHPUnit unit tests
      default
        Tests
        ✗ test_wp_new_comment_respects_comment_field_lengths 63ms
          Failed asserting that 65536 is identical to 65535.
           /project/tests/phpunit/tests/comment.php:977

          Re-run only this test by appending:
          -- --filter 'test_wp_new_comment_respects_comment_field_lengths'
        ✗ test_get_weekday_undefined_index 3ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Warning" is thrown.

          Re-run only this test by appending:
          -- --filter 'test_get_weekday_undefined_index'
        ✗ test_should_throw_deprecation_when_getting_dynamic_property 4ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.

          Re-run only this test by appending:
          -- --filter 'test_should_throw_deprecation_when_getting_dynamic_property'
        ✗ test_should_throw_deprecation_when_setting_dynamic_property 5ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.

          Re-run only this test by appending:
          -- --filter 'test_should_throw_deprecation_when_setting_dynamic_property'
        ✗ test_should_throw_deprecation_when_isset_of_dynamic_property 3ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.

          Re-run only this test by appending:
          -- --filter 'test_should_throw_deprecation_when_isset_of_dynamic_property'
        ✗ test_should_throw_deprecation_when_unset_of_dynamic_property 4ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.

          Re-run only this test by appending:
          -- --filter 'test_should_throw_deprecation_when_unset_of_dynamic_property'
        Tests_Comment
        ✗ test_wp_update_comment 115ms
          Failed asserting that 1 is identical to 0.
           /project/tests/phpunit/tests/comment.php:75

          Re-run only this test by appending:
          -- --filter 'Tests_Comment::test_wp_update_comment'
        Tests_Comment_CheckComment
        ✗ test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment 6ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:34

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment'
        ✗ test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment 51ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:59

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment'
        ✗ test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email 47ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:206

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email'
        Tests_Functions_DoEnclose
          test_function_with_explicit_content_input
          ✗ test_function_with_explicit_content_input with data set "single-relative-movie" 50ms
            Test code or tested code printed unexpected output: 
            Deprecated: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated in /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-token.php on line 221
            

            Re-run only this test by appending:
            -- --filter 'test_function_with_explicit_content_input::test_function_with_explicit_content_input with data set "single-relative-movie"'
        Tests_Meta_Query
        ✗ test_null_value_sql 3ms
          Test code or tested code printed unexpected output: 
          Deprecated: addslashes(): Passing null to parameter #1 ($string) of type string is deprecated in /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php on line 107
          

          Re-run only this test by appending:
          -- --filter 'Tests_Meta_Query::test_null_value_sql'
        Tests_Option_WpSetOptionAutoloadValues
        ✗ test_wp_set_option_autoload_values_with_sql_query_failure 12ms
          Test code or tested code printed unexpected output: <div id="error"><p class="wpdberror">WordPress database error: [&lt;div style=&quot;clear:both&quot;&gt;&amp;nbsp;&lt;/div&gt;
          &lt;div class=&quot;queries&quot; style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot;&gt;
          &lt;p&gt;MySQL query:&lt;/p&gt;
          &lt;p&gt;&lt;/p&gt;
          &lt;p&gt;Queries made or created this session were:&lt;/p&gt;
          &lt;ol&gt;
          &lt;li&gt;Executing: SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;li&gt;Executing: ROLLBACK TO SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;/ol&gt;
          &lt;/div&gt;
          &lt;div style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot; class=&quot;error_message&quot; style=&quot;border-bottom:dotted blue thin;&quot;&gt;
          Error occurred at line 3786 in Function &lt;code&gt;handle_error&lt;/code&gt;. Error message was: Unknown query type: .
          &lt;/div&gt;
          &lt;p&gt;Backtrace:&lt;/p&gt;
          &lt;pre&gt;#0 /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator-&gt;get_error_message()
          #1 /wordpress/wp-includes/option.php(461): WP_SQLite_DB-&gt;query(&#039;&#039;)
          #2 /project/tests/phpunit/tests/option/wpSetOptionAutoloadValues.php(207): wp_set_option_autoload_values(Array)
          #3 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1617): Tests_Option_WpSetOptionAutoloadValues-&gt;test_wp_set_option_autoload_values_with_sql_query_failure()
          #4 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1223): PHPUnit\Framework\TestCase-&gt;runTest()
          #5 /project/vendor/phpunit/phpunit/src/Framework/TestResult.php(729): PHPUnit\Framework\TestCase-&gt;runBare()
          #6 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(973): PHPUnit\Framework\TestResult-&gt;run(Object(Tests_Option_WpSetOptionAutoloadValues))
          #7 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestCase-&gt;run(Object(PHPUnit\Framework\TestResult))
          #8 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #9 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #10 /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(651): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #11 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(146): PHPUnit\TextUI\TestRunner-&gt;run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
          #12 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(99): PHPUnit\TextUI\Command-&gt;run(Array, true)
          #13 /project/vendor/phpunit/phpunit/phpunit(107): PHPUnit\TextUI\Command::main()
          #14 /project/vendor/bin/phpunit(122): include(&#039;/project/vendor...&#039;)
          #15 {main}&lt;/pre&gt;
          ] <code></code></p></div>

          Re-run only this test by appending:
          -- --filter 'Tests_Option_WpSetOptionAutoloadValues::test_wp_set_option_autoload_values_with_sql_query_failure'
        Tests_Option_wpUserSettings
        ✗ test_wp_user_settings_does_not_throw_deprecation_notice_for_setcookie 41ms
          Failed asserting that exception of type "PHPUnit\Framework\Error\Warning" is thrown.

          Re-run only this test by appending:
          -- --filter 'Tests_Option_wpUserSettings::test_wp_user_settings_does_not_throw_deprecation_notice_for_setcookie'
        Tests_User_CountUserPosts
        ✗ test_count_user_posts_for_user_created_after_being_assigned_posts 81ms
          User ID should match calculated value
          Failed asserting that 90 is identical to 0.
           /project/tests/phpunit/tests/user/countUserPosts.php:179

          Re-run only this test by appending:
          -- --filter 'Tests_User_CountUserPosts::test_count_user_posts_for_user_created_after_being_assigned_posts'

  ✗ 15 failed

  5745 tests in 236.26s

  Legend: ✗ failed

@adamziel
Copy link
Copy Markdown

cc @JanJakes, you're probably aware of these from your sqlite-database-integration work but maybe there's still something surprising here.

@bgrgicak
Copy link
Copy Markdown
Owner Author

@JanJakes check out test_wp_new_comment_respects_comment_field_lengths. The comment_content field is a TEXT in MySQL, which can store 65535 characters, but I guess that SQLite has a different field size.

@bgrgicak
Copy link
Copy Markdown
Owner Author

I fould out that tests like deprication checks fail due to PHPUnit being unable to override Playground's error handler. Disabling Playground's error handler, removed a few more issues from the list.

 WordPress Core Tests - PHPUnit unit tests
      default
        Tests
        ✗ test_wp_new_comment_respects_comment_field_lengths 56ms
          Failed asserting that 65536 is identical to 65535.
           /project/tests/phpunit/tests/comment.php:977

          Re-run only this test by appending:
          -- --filter 'test_wp_new_comment_respects_comment_field_lengths'
        Tests_Comment
        ✗ test_wp_update_comment 91ms
          Failed asserting that 1 is identical to 0.
           /project/tests/phpunit/tests/comment.php:75

          Re-run only this test by appending:
          -- --filter 'Tests_Comment::test_wp_update_comment'
        Tests_Comment_CheckComment
        ✗ test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment 5ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:34

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment'
        ✗ test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment 44ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:59

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment'
        ✗ test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email 37ms
          Failed asserting that true is false.
           /project/tests/phpunit/tests/comment/checkComment.php:206

          Re-run only this test by appending:
          -- --filter 'Tests_Comment_CheckComment::test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email'
        Tests_Functions_DoEnclose
          test_function_with_explicit_content_input
          ✗ test_function_with_explicit_content_input with data set "single-relative-movie" 43ms
            Test code or tested code printed unexpected output: <div id="error"><p class="wpdberror">WordPress database error: [&lt;div style=&quot;clear:both&quot;&gt;&amp;nbsp;&lt;/div&gt;
            &lt;div class=&quot;queries&quot; style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot;&gt;
            &lt;p&gt;MySQL query:&lt;/p&gt;
            &lt;p&gt;SELECT post_id FROM wptests_postmeta WHERE post_id = 759 AND meta_key = &#039;enclosure&#039; AND meta_value LIKE &#039;/movie.mp4%&#039;&lt;/p&gt;
            &lt;p&gt;Queries made or created this session were:&lt;/p&gt;
            &lt;ol&gt;
            &lt;li&gt;Executing: SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
            &lt;li&gt;Executing: ROLLBACK TO SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
            &lt;/ol&gt;
            &lt;/div&gt;
            &lt;div style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot; class=&quot;error_message&quot; style=&quot;border-bottom:dotted blue thin;&quot;&gt;
            Error occurred at line 3786 in Function &lt;code&gt;handle_error&lt;/code&gt;. Error message was: strtoupper(): Passing null to parameter #1 ($string) of type string is deprecated.
            &lt;/div&gt;
            &lt;p&gt;Backtrace:&lt;/p&gt;
            &lt;pre&gt;#0 /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator-&gt;get_error_message()
            #1 /wordpress/wp-includes/class-wpdb.php(3035): WP_SQLite_DB-&gt;query(&#039;SELECT post_id ...&#039;)
            #2 /wordpress/wp-includes/functions.php(950): wpdb-&gt;get_var(&#039;SELECT post_id ...&#039;)
            #3 /project/tests/phpunit/tests/functions/doEnclose.php(37): do_enclose(&#039;/movie.mp4&#039;, Object(WP_Post))
            #4 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1617): Tests_Functions_DoEnclose-&gt;test_function_with_explicit_content_input(&#039;/movie.mp4&#039;, &#039;/movie.mp4\n123\n...&#039;)
            #5 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1223): PHPUnit\Framework\TestCase-&gt;runTest()
          ✗ test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions with data set "null" 3ms
            addslashes(): Passing null to parameter #1 ($string) of type string is deprecated
             /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php:107
             /wordpress/wp-includes/class-wpdb.php:1753
          ✗ test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions with data set "null" 4ms
            addslashes(): Passing null to parameter #1 ($string) of type string is deprecated
             /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php:107
             /wordpress/wp-includes/class-wpdb.php:1753
             /wordpress/wp-includes/option.php:1140
             /project/tests/phpunit/tests/option/wpPrimeOptionCaches.php:372

            Re-run only this test by appending:
            -- --filter 'test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions::test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions with data set "null"'
        Tests_Option_WpSetOptionAutoloadValues
        ✗ test_wp_set_option_autoload_values_with_sql_query_failure 8ms
          Test code or tested code printed unexpected output: <div id="error"><p class="wpdberror">WordPress database error: [&lt;div style=&quot;clear:both&quot;&gt;&amp;nbsp;&lt;/div&gt;
          &lt;div class=&quot;queries&quot; style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot;&gt;
          &lt;p&gt;MySQL query:&lt;/p&gt;
          &lt;p&gt;&lt;/p&gt;
          &lt;p&gt;Queries made or created this session were:&lt;/p&gt;
          &lt;ol&gt;
          &lt;li&gt;Executing: SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;li&gt;Executing: ROLLBACK TO SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;/ol&gt;
          &lt;/div&gt;
          &lt;div style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot; class=&quot;error_message&quot; style=&quot;border-bottom:dotted blue thin;&quot;&gt;
          Error occurred at line 3786 in Function &lt;code&gt;handle_error&lt;/code&gt;. Error message was: Unknown query type: .
          &lt;/div&gt;
          &lt;p&gt;Backtrace:&lt;/p&gt;
          &lt;pre&gt;#0 /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator-&gt;get_error_message()
          #1 /wordpress/wp-includes/option.php(461): WP_SQLite_DB-&gt;query(&#039;&#039;)
          #2 /project/tests/phpunit/tests/option/wpSetOptionAutoloadValues.php(207): wp_set_option_autoload_values(Array)
          #3 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1617): Tests_Option_WpSetOptionAutoloadValues-&gt;test_wp_set_option_autoload_values_with_sql_query_failure()
          #4 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1223): PHPUnit\Framework\TestCase-&gt;runTest()
          #5 /project/vendor/phpunit/phpunit/src/Framework/TestResult.php(729): PHPUnit\Framework\TestCase-&gt;runBare()
          #6 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(973): PHPUnit\Framework\TestResult-&gt;run(Object(Tests_Option_WpSetOptionAutoloadValues))
          #7 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestCase-&gt;run(Object(PHPUnit\Framework\TestResult))
          #8 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #9 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #10 /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(651): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #11 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(146): PHPUnit\TextUI\TestRunner-&gt;run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
          #12 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(99): PHPUnit\TextUI\Command-&gt;run(Array, true)
          #13 /project/vendor/phpunit/phpunit/phpunit(107): PHPUnit\TextUI\Command::main()
          #14 /project/vendor/bin/phpunit(122): include(&#039;/project/vendor...&#039;)
          #15 {main}&lt;/pre&gt;
          ] <code></code></p></div>

          Re-run only this test by appending:
          -- --filter 'Tests_Option_WpSetOptionAutoloadValues::test_wp_set_option_autoload_values_with_sql_query_failure'
        Tests_User_CountUserPosts
        ✗ test_count_user_posts_for_user_created_after_being_assigned_posts 62ms
          User ID should match calculated value
          Failed asserting that 90 is identical to 0.
           /project/tests/phpunit/tests/user/countUserPosts.php:179

          Re-run only this test by appending:
          -- --filter 'Tests_User_CountUserPosts::test_count_user_posts_for_user_created_after_being_assigned_posts'

@bgrgicak
Copy link
Copy Markdown
Owner Author

@JanJakes check out this error related to using SAVEPOINT.

✗ test_wp_set_option_autoload_values_with_sql_query_failure 8ms
          Test code or tested code printed unexpected output: <div id="error"><p class="wpdberror">WordPress database error: [&lt;div style=&quot;clear:both&quot;&gt;&amp;nbsp;&lt;/div&gt;
          &lt;div class=&quot;queries&quot; style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot;&gt;
          &lt;p&gt;MySQL query:&lt;/p&gt;
          &lt;p&gt;&lt;/p&gt;
          &lt;p&gt;Queries made or created this session were:&lt;/p&gt;
          &lt;ol&gt;
          &lt;li&gt;Executing: SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;li&gt;Executing: ROLLBACK TO SAVEPOINT LEVEL1 | (no parameters)&lt;/li&gt;
          &lt;/ol&gt;
          &lt;/div&gt;
          &lt;div style=&quot;clear:both;margin-bottom:2px;border:red dotted thin;&quot; class=&quot;error_message&quot; style=&quot;border-bottom:dotted blue thin;&quot;&gt;
          Error occurred at line 3786 in Function &lt;code&gt;handle_error&lt;/code&gt;. Error message was: Unknown query type: .
          &lt;/div&gt;
          &lt;p&gt;Backtrace:&lt;/p&gt;
          &lt;pre&gt;#0 /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php(287): WP_SQLite_Translator-&gt;get_error_message()
          #1 /wordpress/wp-includes/option.php(461): WP_SQLite_DB-&gt;query(&#039;&#039;)
          #2 /project/tests/phpunit/tests/option/wpSetOptionAutoloadValues.php(207): wp_set_option_autoload_values(Array)
          #3 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1617): Tests_Option_WpSetOptionAutoloadValues-&gt;test_wp_set_option_autoload_values_with_sql_query_failure()
          #4 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(1223): PHPUnit\Framework\TestCase-&gt;runTest()
          #5 /project/vendor/phpunit/phpunit/src/Framework/TestResult.php(729): PHPUnit\Framework\TestCase-&gt;runBare()
          #6 /project/vendor/phpunit/phpunit/src/Framework/TestCase.php(973): PHPUnit\Framework\TestResult-&gt;run(Object(Tests_Option_WpSetOptionAutoloadValues))
          #7 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestCase-&gt;run(Object(PHPUnit\Framework\TestResult))
          #8 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #9 /project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(685): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #10 /project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(651): PHPUnit\Framework\TestSuite-&gt;run(Object(PHPUnit\Framework\TestResult))
          #11 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(146): PHPUnit\TextUI\TestRunner-&gt;run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
          #12 /project/vendor/phpunit/phpunit/src/TextUI/Command.php(99): PHPUnit\TextUI\Command-&gt;run(Array, true)
          #13 /project/vendor/phpunit/phpunit/phpunit(107): PHPUnit\TextUI\Command::main()
          #14 /project/vendor/bin/phpunit(122): include(&#039;/project/vendor...&#039;)
          #15 {main}&lt;/pre&gt;
          ] <code></code></p></div>

          Re-run only this test by appending:
          -- --filter 'Tests_Option_WpSetOptionAutoloadValues::test_wp_set_option_autoload_values_with_sql_query_failure'
        

@bgrgicak
Copy link
Copy Markdown
Owner Author

There are also some errors related to using deprecated syntax in the SQLite plugin.

 ✗ test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions with data set "null" 4ms
            addslashes(): Passing null to parameter #1 ($string) of type string is deprecated
             /internal/shared/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php:107
             /wordpress/wp-includes/class-wpdb.php:1753
             /wordpress/wp-includes/option.php:1140
             /project/tests/phpunit/tests/option/wpPrimeOptionCaches.php:372

@JanJakes
Copy link
Copy Markdown

@bgrgicak https://github.com/WordPress/sqlite-database-integration/ runs WP PHPUnit tests, and the known failures are listed here.

We should cross-check the differences, but at first sight, it seems to me the list also contains some tests that are not listed here. I wonder why that is 🤔

@bgrgicak
Copy link
Copy Markdown
Owner Author

bgrgicak commented Jan 21, 2026

WordPress/sqlite-database-integration runs WP PHPUnit tests, and the known failures are listed here.

Thanks, I haven't seen that list! The two errors I mentioned today aren't on the list. I will check what's happening there, they seem like SQLite issues, but could be WP-tester quirks.

@JanJakes
Copy link
Copy Markdown

JanJakes commented Jan 21, 2026

A quick try to compare them:

Tests failing here:

test_count_user_posts_for_user_created_after_being_assigned_posts
test_function_with_explicit_content_input
test_should_return_false_when_comment_previously_approved_is_enabled_and_author_does_not_have_approved_comment
test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email
test_should_return_true_when_comment_previously_approved_is_enabled_and_author_has_approved_comment
test_wp_new_comment_respects_comment_field_lengths
test_wp_prime_option_caches_does_not_trigger_db_queries_for_alloptions
test_wp_set_option_autoload_values_with_sql_query_failure
test_wp_update_comment

Tests failing in the SQLite CI:

Tests_Admin_wpSiteHealth::test_object_cache_thresholds
Tests_Admin_wpSiteHealth::test_object_cache_thresholds
Tests_Comment::test_wp_new_comment_respects_comment_field_lengths
Tests_Comment::test_wp_update_comment
Tests_DB::test_charset_switched_to_utf8mb4
Tests_DB::test_close
Tests_DB::test_delete_value_too_long_for_field
Tests_DB::test_has_cap
Tests_DB::test_insert_value_too_long_for_field
Tests_DB::test_mysqli_flush_sync
Tests_DB::test_non_unicode_collations
Tests_DB::test_pre_get_col_charset_filter
Tests_DB::test_process_fields_on_nonexistent_table
Tests_DB::test_process_fields_value_too_long_for_field
Tests_DB::test_query_value_contains_invalid_chars
Tests_DB::test_replace
Tests_DB::test_replace_value_too_long_for_field
Tests_DB::test_supports_collation
Tests_DB::test_update_value_too_long_for_field
Tests_DB_Charset::test_get_column_charset
Tests_DB_Charset::test_get_column_charset_is_mysql_undefined
Tests_DB_Charset::test_get_column_charset_non_mysql
Tests_DB_Charset::test_invalid_characters_in_query
Tests_DB_Charset::test_process_field_charsets_on_nonexistent_table
Tests_DB_Charset::test_set_charset_changes_the_connection_collation
Tests_DB_Charset::test_strip_invalid_text
Tests_DB_Charset::test_strip_invalid_text_for_column_bails_if_ascii_input_too_long
Tests_DB_dbDelta::test_spatial_indices
Tests_Menu_Walker_Nav_Menu::test_start_el_with_empty_attributes
Tests_Menu_wpNavMenu::test_wp_nav_menu_should_not_have_has_children_class_with_custom_depth
WP_Test_REST_Posts_Controller::test_get_items_orderby_modified_query

Overlap:

Tests_Comment::test_wp_new_comment_respects_comment_field_lengths
Tests_Comment::test_wp_update_comment

That's strange. We need to figure out why the results differ so much. Is it possible that some tests are marked skipped on one side or the other, depending on which PHP extensions are available?

There's also an idea for a small improvement—maybe we could add the test class name to the output so that it's more visible which exact test failed?

@JanJakes
Copy link
Copy Markdown

There's also an idea for a small improvement—maybe we could add the test class name to the output so that it's more visible which exact test failed?

Ahh, the class name is there above the whole section. I missed that when parsing out the test names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants