Make WordPress Core

Opened 8 months ago

Last modified 2 days ago

#63167 new task (blessed)

Test tool and unit test improvements for 6.9

Reported by: desrosj's profile desrosj Owned by:
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description (last modified by wildworks)

This ticket is for various fixes and improvements in PHPUnit tests that don't have a more specific ticket, as well as general improvements to the GitHub Actions workflows that run automated testing.

Change History (112)

#1 @peterwilsoncc
8 months ago

In 60100:

Build/Test Tools: Expand tests of paginate_links' format parameter.

Introduces additional tests for custom formatted pagination links to include:

  • plain permalinks
  • html file extensions
  • hyphen separated links
  • URL fragments

See #63167.

#2 @SergeyBiryukov
7 months ago

In 60137:

Tests: Simplify the tests for force_ssl_admin().

Includes:

  • The $forced static variable is reset to false before each test, and the function always returns the previous value on the first call, so there is no need to pass the same value from the data provider.
  • Clarifying data provider keys by removing the “first call” references to avoid confusion, as the test method always calls the function twice for each input value.
  • Replacing unnecessarily redundant test method name for consistency with other tests.
  • Moving the data provider after the test method for consistency with other tests.
  • Adjusting DocBlock formatting as per the documentation standards.

Follow-up to [59830].

See #63167.

#3 @SergeyBiryukov
7 months ago

In 60148:

Tests: Use the ms-required group where appropriate.

This replaces the if ( is_multisite() ) conditional wrapping entire test classes with the ms-required group for more consistency across the test suite.

Follow-up to [40520].

See #63167.

This ticket was mentioned in PR #8701 on WordPress/wordpress-develop by @desrosj.


7 months ago
#4

  • Keywords has-patch added

There are a few errors happening when running npm run env:start:

The repository at "/var/www" does not have the correct ownership and git refuses to use it:

fatal: detected dubious ownership in repository at '/var/www'
To add an exception for this directory, call:

        git config --global --add safe.directory /var/www

Composer could not detect the root package (wordpress/wordpress) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version

It appears that adding a version to the composer.json file fixes both of these errors.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#5 @SirLouen
7 months ago

@desrosj
I would like to add for consideration these two tickets
https://core.trac.wordpress.org/ticket/63135
https://core.trac.wordpress.org/ticket/63172
Adding FTP and Mail support to Docker image.
For mail, Mailhog is pretty obvious.
For ftp, vsftpd for simplicity and speed
It's a little pain to test in env, without so basic tooling. Other virtualization like Chassis seem to have some plugins for all these but with docker we can control this with the start script.

#6 @desrosj
6 months ago

In 60211:

Build/Test Tools: Add version to composer.json.

The lack of a specified version in the composer.json file is causing some unexpected warnings.

Props sirlouen, johnbillion.
See #63167.

#8 follow-up: @jorbin
6 months ago

Should [60211] be done for the 6.8 branch as well?

#9 follow-up: @TobiasBg
6 months ago

@desrosj: Shouldn't it be "version" and not "versions"?

#10 in reply to: ↑ 8 ; follow-up: @desrosj
6 months ago

Replying to jorbin:

Should [60211] be done for the 6.8 branch as well?

The change only fixes warnings locally and in test workflows, but I'm not opposed given it will be at least 8-9 months until 6.9 is released.

#11 in reply to: ↑ 9 @desrosj
6 months ago

Replying to TobiasBg:

@desrosj: Shouldn't it be "version" and not "versions"?

@TobiasBg ah yes. Thank you!

#12 @desrosj
6 months ago

In 60212:

Build/Test Tools: Correct typo in version.

Follow up to [60211].

Props TobiasBg.
Unprops desrosj.
See #63167.

#13 in reply to: ↑ 10 @peterwilsoncc
6 months ago

Replying to desrosj:

Replying to jorbin:

Should [60211] be done for the 6.8 branch as well?

The change only fixes warnings locally and in test workflows, but I'm not opposed given it will be at least 8-9 months until 6.9 is released.

I think it would be good to backport this change too, there will be a few releases (modified for correct version numbers).

Approving [60211] and [60212] for merge to the 6.8 branch.

Last edited 6 months ago by peterwilsoncc (previous) (diff)

This ticket was mentioned in PR #8767 on WordPress/wordpress-develop by @peterwilsoncc.


6 months ago
#14

Trac ticket: https://core.trac.wordpress.org/ticket/63167#comment:13

Backports r60211 and r60212 to 6.8 with the version number modified accordingly.

#15 @peterwilsoncc
6 months ago

In 60218:

Build/Test Tools: Add version to composer.json.

The lack of a specified version in the composer.json file is causing some unexpected warnings.

Reviewed by peterwilsoncc.
Merges [60211], [60212] to the 6.8 branch with appropriate version number modifications.

Props sirlouen, johnbillion, TobiasBg, desrosj, jorbin.
See #63167.

#17 @peterwilsoncc
6 months ago

In 60220:

Build/Test Tools: Adds summaries to each of the Tests_Basic test methods.

See #63167.

#18 @peterwilsoncc
6 months ago

In 60224:

Build/Test Tools: Adds summaries to each of the Tests_Basic test methods.

Reviewed by jorbin.
(See https://core.trac.wordpress.org/ticket/63390#comment:5)
Merges [60220] to the 6.8 branch.

See #63167.

@desrosj commented on PR #8701:


6 months ago
#19

Closing the loop here.

The pages in the handbook listed above have been updated to include composer.json in their checklists. There are no default themes with a composer.json file currently, but I've also updated the page detailing steps for releasing default theme versions in case that comes up in the future.

This ticket was mentioned in PR #8807 on WordPress/wordpress-develop by @johnbillion.


6 months ago
#20

  • Keywords has-unit-tests added

This replaces uses of test.com in tests with the more appropriate example.com which is intended for testing and examples.

#21 @SirLouen
6 months ago

@desrosj @SergeyBiryukov Improvements in unit tests code: #63443

#23 @johnbillion
6 months ago

In 60250:

Build/Test Tools: Replace uses of test.com in tests and the local development environment with the more appropriate example.com which is intended for testing and examples.

See #63167

This ticket was mentioned in PR #1995 on WordPress/wordpress-develop by @johnbillion.


6 months ago
#25

Several tests perform assertions conditionally or iterate dynamic arrays without ensuring they're populated. If the test is faulty and the condition never evaluates to true or the array being iterated is empty then we'll never know about it.

This adds additional assertions that cover these situations.

#26 @johnbillion
6 months ago

In 60251:

Build/Test Tools: Add assertions that test the tests.

Several tests perform assertions conditionally or iterate dynamic arrays without ensuring they're populated. If the test is faulty and the condition never evaluates to true, or the array being iterated is unexpectedly empty, this will now correctly cause the test to fail.

Props johnbillion, jrf.

See #63167

#28 @jorbin
6 months ago

In 60256:

Bump PHP Compat scan to 7.4

WordPress bumped it's minimum version to 7.4 in [57985] but the compatibility scan was still searching for issues that would only happen in 7.2 and 7.3.

See #58719, #63167.

This ticket was mentioned in PR #8490 on WordPress/wordpress-develop by @desrosj.


5 months ago
#29

This updates the MySQL and MariaDB innovation releases to test against.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#30 @desrosj
5 months ago

In 60277:

Build/Test Tools: Test against the latest innovation releases.

The latest MySQL innovation release is now 9.3, and the latest MariaDB innovation release (also known as a “rolling release”) is 11.7.

This updates the test matrices and the .version-support-mysql.json accordingly.

Props peterwilsoncc.
See #63167.

This ticket was mentioned in PR #9012 on WordPress/wordpress-develop by @peterwilsoncc.


5 months ago
#32

Updates the workflow link in the WordPress Playground comment to point to the workflow that currently generates the asset.

I tried finding the history of the wordpress-playground.yml file but I am not sure it's ever existed in this repo.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#33 @peterwilsoncc
5 months ago

In 60327:

Build/Test Tools: Fix playground workflow link in PR comment.

Updates the workflow link in the WordPress Playground comment to point to the test-build-processes.yml workflow that generates the asset.

Props peterwilsoncc, desrosj.
See #63167.

@desrosj commented on PR #9062:


5 months ago
#36

This increases the job count from 198 to 214, an increase of 16. I'm happy with that as long as you are.

More is not always better. But I think 16 is reasonable. MariaDB 10.4 is also hovering right around the 1% threshold (currently at 1.01%). We should be able to trim that form the matrix in the coming months to cut 16 on that side of things.

This ticket was mentioned in PR #9095 on WordPress/wordpress-develop by @jonsurrell.


5 months ago
#38

Trac ticket: https://core.trac.wordpress.org/ticket/63167

Extract the test cases for wp_kses_normalize_entities to a data provider and expand the test cases.

Using a data provider for the individual test cases gives better information and isolates each test case so that a single failure on a test case can be identified instead of manifesting as a more general failure.

The existing test cases are maintained, all for named entities. Test cases have been added for:

  • The examples in the function documentation.
  • Numeric (decimal and hex) entities.
  • Some invalid numeric entities (outside valid unicode range).

Before:

 ✔ Wp kses normalize entities
OK (1 test, 8 assertions)

After:

 ✔ Wp kses normalize entities with AT&T
 ✔ Wp kses normalize entities with :
 ✔ Wp kses normalize entities with &#XYZZY;
 ✔ Wp kses normalize entities with Named·entity:·&
 ✔ Wp kses normalize entities with Named·entity:·&
 ✔ Wp kses normalize entities with Named·entity:·♠
 ✔ Wp kses normalize entities with Named·entity:·¹
 ✔ Wp kses normalize entities with Named·entity:·²
 ✔ Wp kses normalize entities with Named·entity:·³
 ✔ Wp kses normalize entities with Named·entity:·¼
 ✔ Wp kses normalize entities with Named·entity:·½
 ✔ Wp kses normalize entities with Named·entity:·¾
 ✔ Wp kses normalize entities with Named·entity:·∴
 ✔ Wp kses normalize entities with Numeric·entity·	·(·)
 ✔ Wp kses normalize entities with Numeric·entity·"·(")
 ✔ Wp kses normalize entities with Numeric·entity·"·(")
 ✔ Wp kses normalize entities with Numeric·entity·&·(&)
 ✔ Wp kses normalize entities with Numeric·entity·'·(')
 ✔ Wp kses normalize entities with Numeric·entity·😍·(😍)
 ✔ Wp kses normalize entities with Numeric·entity·😍·(😍)
 ✔ Wp kses normalize entities with Hex·entity·	·(·)
 ✔ Wp kses normalize entities with Hex·entity·"·(")
 ✔ Wp kses normalize entities with Hex·entity·"·(")
 ✔ Wp kses normalize entities with Hex·entity·&·(&)
 ✔ Wp kses normalize entities with Hex·entity·'·(')
 ✔ Wp kses normalize entities with Hex·entity·😍·(😍)
 ✔ Wp kses normalize entities with Hex·entity·😍·(😍)
 ✔ Wp kses normalize entities with HEX·ENTITY·"·(")
 ✔ Wp kses normalize entities with HEX·ENTITY·&·(&)
 ✔ Wp kses normalize entities with HEX·ENTITY·'·(')
 ✔ Wp kses normalize entities with HEX·ENTITY·😍·(😍)
 ✔ Wp kses normalize entities with Encoded·named·entity·&
 ✔ Wp kses normalize entities with Encoded·named·entity·&
 ✔ Wp kses normalize entities with Encoded·named·entity·&
 ✔ Wp kses normalize entities with Invalid·numeric·unicode·�
 ✔ Wp kses normalize entities with Invalid·hex·unicode·�
OK (36 tests, 36 assertions)

#39 @SirLouen
4 months ago

@desrosj @SergeyBiryukov little fix that is blocking further Unit Tests #63635

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


4 months ago

#41 @jonsurrell
4 months ago

In 60446:

Build/Test Tools: Expand and improve wp_kses_normalize_entities tests.

Update test to use a data provider for test cases.
Add a variety of HTML character references covering named, decimal, and hexadecimal forms.

Developed in https://github.com/WordPress/wordpress-develop/pull/9095.

Props jonsurrell, cbravobernal.
See #63167.

@jonsurrell commented on PR #9095:


4 months ago
#42

Merged in [60446].

@dmsnell commented on PR #9095:


4 months ago
#43

Very nice change here. Thanks for moving commented tests into real tests, and for using the array key => value form so that the test cases are named when failing.

#44 @SergeyBiryukov
4 months ago

In 60451:

Tests: Re-enable the test for recommended PHP version in readme.html.

This test verifies that the WordPress readme.html file recommends a PHP version that is actively supported.

As of WordPress 6.9, the recommended version of PHP is 8.3 or greater.

Follow-up to [52260], [54074], [60437], [meta14480].

Previously:

Related:

  • #meta6612 Prepare for bumping the recommended PHP version to 8.0+
  • #meta5279 Bump the recommended PHP version to 7.4
  • #meta4009 Manage supported/recommended PHP versions in a central location

References:

See #63167.

This ticket was mentioned in PR #9319 on WordPress/wordpress-develop by @desrosj.


4 months ago
#45

Version 9.4 of MySQL has been released making it the new and only supported innovation release.

With the release of MariaDB 11.8, there are no actively supported rolling innovation releases until 12.0 stable is released.

For more context about the release models for both projects, see this proposal on the Make WordPress Core blog.

See: Core-63167.

Trac ticket:

@westonruter commented on PR #9329:


4 months ago
#47

There is an E2E test failures when I run npm run test:e2e locally:

$ npm run test:e2e

> WordPress@6.9.0 test:e2e
> wp-scripts test-playwright --config tests/e2e/playwright.config.js


Running 25 tests using 1 worker

  ✓  1 [chromium] › tests/e2e/specs/cache-control-headers-directives.test.js:11:6 › Cache Control header directives › No private directive present in cache control when user not logged in. (2.1s)
  ✓  2 [chromium] › tests/e2e/specs/cache-control-headers-directives.test.js:35:6 › Cache Control header directives › Private directive header present in cache control when logged in. (280ms)
  ✓  3 [chromium] › tests/e2e/specs/cache-control-headers-directives.test.js:49:6 › Cache Control header directives › Correct directives present in cache control header when not logged in on 404 page. (526ms)
  ✓  4 [chromium] › tests/e2e/specs/dashboard.test.js:11:6 › Quick Draft › Allows draft to be created with Title and Content (460ms)
  ✓  5 [chromium] › tests/e2e/specs/dashboard.test.js:48:6 › Quick Draft › Allows draft to be created without Title or Content (461ms)
  ✓  6 [chromium] › tests/e2e/specs/edit-posts.test.js:11:6 › Edit Posts › displays a message in the posts table when no posts are present (182ms)
  ✓  7 [chromium] › tests/e2e/specs/edit-posts.test.js:21:6 › Edit Posts › shows a single post after one is published with the correct title (1.2s)
  ✓  8 [chromium] › tests/e2e/specs/edit-posts.test.js:42:6 › Edit Posts › allows an existing post to be edited using the Edit button (2.0s)
  ✓  9 [chromium] › tests/e2e/specs/edit-posts.test.js:72:6 › Edit Posts › allows an existing post to be quick edited using the Quick Edit button (1.4s)
  ✓  10 [chromium] › tests/e2e/specs/edit-posts.test.js:110:6 › Edit Posts › allows an existing post to be deleted using the Trash button (1.3s)
  ✓  11 [chromium] › tests/e2e/specs/empty-trash-restore-trashed-posts.test.js:13:6 › Empty Trash › Empty Trash (1.5s)
  ✓  12 [chromium] › tests/e2e/specs/empty-trash-restore-trashed-posts.test.js:33:6 › Empty Trash › Restore trash post (1.6s)
  ✓  13 [chromium] › tests/e2e/specs/fatal-error-handler.test.js:33:6 › Fatal error handler › should display fatal error notice (63ms)
  ✓  14 [chromium] › tests/e2e/specs/general-settings-invalid-timezone.test.js:7:7 › Settings -> General › Does not allow saving an invalid timezone string with "" (1.1s)
  ✓  15 [chromium] › tests/e2e/specs/general-settings-invalid-timezone.test.js:7:7 › Settings -> General › Does not allow saving an invalid timezone string with "0" (451ms)
  ✓  16 [chromium] › tests/e2e/specs/general-settings-invalid-timezone.test.js:7:7 › Settings -> General › Does not allow saving an invalid timezone string with "Barry/Gary" (438ms)
  ✓  17 [chromium] › tests/e2e/specs/gutenberg-plugin.test.js:25:6 › Gutenberg plugin › should activate (357ms)
  ✓  18 [chromium] › tests/e2e/specs/hello.test.js:7:6 › Hello World › Should load properly (188ms)
  ✘  19 [chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials (5.2s)
  ✓  20 [chromium] › tests/e2e/specs/login-localize-script.test.js:45:6 › Localize Script on wp-login.php › should localize script (165ms)
  ✓  21 [chromium] › tests/e2e/specs/maintenance-mode.test.js:27:6 › Maintenance mode › should display maintenance mode page (82ms)
Failed to load resource: the server responded with a status of 503 (Service Unavailable)
  ✓  22 [chromium] › tests/e2e/specs/media-upload.test.js:11:5 › Test dismissing failed upload works correctly (861ms)
  ✓  23 [chromium] › tests/e2e/specs/profile/applications-passwords.test.js:19:6 › Manage applications passwords › should correctly create a new application password (535ms)
  ✓  24 [chromium] › tests/e2e/specs/profile/applications-passwords.test.js:43:6 › Manage applications passwords › should correctly revoke a single application password (521ms)
  ✓  25 [chromium] › tests/e2e/specs/profile/applications-passwords.test.js:66:6 › Manage applications passwords › should correctly revoke all the application passwords (523ms)


  1) [chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials 

    Error: should redirect to the installation page

    Timed out 5000ms waiting for expect(locator).toHaveURL(expected)

    Locator: locator(':root')
    Expected pattern: /wp-admin\/install\.php$/
    Received string:  "http://localhost:8889/"
    Call log:
      - should redirect to the installation page with timeout 5000ms
      - waiting for locator(':root')
        9 × locator resolved to <html lang="en-US">…</html>
          - unexpected value "http://localhost:8889/"


      38 |                      page,
      39 |                      'should redirect to the installation page'
    > 40 |              ).toHaveURL( /wp-admin\/install\.php$/ );
         |                ^
      41 |
      42 |              await expect(
      43 |                      page.getByText( /WordPress database error/ ),
        at /Users/westonruter/repos/wordpress-develop/tests/e2e/specs/install.test.js:40:5

    attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    artifacts/test-results/install-WordPress-installa-08866-isting-database-credentials-chromium/test-failed-1.png
    ────────────────────────────────────────────────────────────────────────────────────────────────

    attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
    artifacts/test-results/install-WordPress-installa-08866-isting-database-credentials-chromium/trace.zip
    Usage:

        npx playwright show-trace artifacts/test-results/install-WordPress-installa-08866-isting-database-credentials-chromium/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────

  1 failed
    [chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials 
  24 passed (27.9s)

This is also happening in GHA:

https://github.com/user-attachments/assets/4b7df281-f514-4986-a000-86bce0e7c6ab

But this is also happening in trunk for me locally. And it was happening in another recently-committed PR: https://github.com/WordPress/wordpress-develop/pull/9318. So this is no better or worse than E2E tests are at present.

@westonruter commented on PR #9329:


4 months ago
#48

I am able to successfully add constants:

 $ npm run env:cli config set FOO BAR --add
npm info using npm@10.8.2
npm info using node@v20.19.1

> WordPress@6.9.0 env:cli
> node ./tools/local-env/scripts/docker.js exec --user wp_php cli wp config set FOO BAR

Success: Added the constant 'FOO' to the 'wp-config.php' file with the value 'BAR'.
npm info ok

This ticket was mentioned in PR #9333 on WordPress/wordpress-develop by @peterwilsoncc.


4 months ago
#49

This is an attempt to recover if the database server hasn't completed booting when the web server starts.

If the wp db reset command fails, it will be retried a number of times to ensure that the error is permanent rather than temporary.

On the test suite, I've been seeing a lot of failures that are seemingly caused by a race condition rather than an error when docker is started. As a case in point, see this action run.

I've not seen any such errors with this code but that may be dumb luck rather than anything I've fixed.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

@johnbillion commented on PR #9329:


4 months ago
#50

But this is also happening in trunk for me locally.

Yeah it's been there a while now. We've got https://core.trac.wordpress.org/ticket/63024 but no movement so far.

#51 @johnbillion
4 months ago

In 60518:

Build/Test Tools: Don't run WP-CLI commands as root in the local development environment and CI environment.

Props johnbillion, westonruter.

See #63167, #63564

@johnbillion commented on PR #9329:


4 months ago
#52

Committed in r60518.

@peterwilsoncc commented on PR #9333:


3 months ago
#53

Thanks for taking a look John.

I've realized this is the wrong approach. The docker file already has a depends_on config so I suspect it's something else funky going on.

This ticket was mentioned in PR #9361 on WordPress/wordpress-develop by @rollybueno.


3 months ago
#54

Adds comprehensive unit test to verify RSS feed cache transient storage behavior for ticket #63719.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

@rollybueno commented on PR #9361:


3 months ago
#55

As per feedback in ticket #63719

@peterwilsoncc commented on PR #9361:


3 months ago
#56

@rollybueno The tests can be independent of fetch_feed() as there are already tests validating that the data is cached.

For site transients tests, can use simpler tests to gaurentee that the data is stored in the correct table depending on how WordPress is configured. I didn't get to finish them, but I started some experiments yesterday if you want to pick up the code as a startying point.

https://github.com/WordPress/wordpress-develop/pull/9352

@rollybueno commented on PR #9361:


3 months ago
#57

Hey @peterwilsoncc - I checked your PR on https://github.com/WordPress/wordpress-develop/pull/9352. I think it's covering more specific requirements for the site transient storage location and way more cleaner solution than what I have here. I'll close this PR and we can go with your implementation. Appreciate the feedback 👍.

#58 @desrosj
3 months ago

In 60532:

Build/Test Tools: Update the Inovation Releases tested.

This updates the PHPUnit test strategy matrix to test current Innovation Releases.

  • MySQL 9.4 is now the current Innovation Release.
  • With the release of the 11.8 LTS version, MariaDB has no current Innovation Releases.

See #63167.

@peterwilsoncc commented on PR #9361:


3 months ago
#60

@rollybueno Thanks, are you able to post any notes on the other PR so we can a) ensure you get props for the suggestion and b) I can get a logic check on any further use cases that might need to be tested.

#61 @peterwilsoncc
3 months ago

In 60615:

Options, Meta APIs: Test site transients stored correctly.

Adds unit tests to ensure that site transients are stored correctly:

  • in wp_options on single site installs,
  • in wp_sitemeta on multisite installs.

Props peterwilsoncc, rollybueno.
See #63167.

#62 @SergeyBiryukov
2 months ago

In 60689:

Tests: Correct @covers tags for term_exists() tests.

Includes moving the tag to the class DocBlock, as this test class covers a single function.

Follow-up to [52921], [60676].

See #63167.

This ticket was mentioned in PR #9715 on WordPress/wordpress-develop by @johnbillion.


2 months ago
#63

If wp_die() is called during a PHPUnit test run, for example due to invalid credentials in wp-tests-config.php, the output is difficult to grok. This change proposes:

  • Stripping HTML tags
  • Decoding HTML entities
  • Colouring the error message red

## Before

https://github.com/user-attachments/assets/601eff65-843c-480e-be0a-342622fada4f

## After

https://github.com/user-attachments/assets/433cd522-7a3a-4ef1-ab4f-82245ccd7c3d

This ticket was mentioned in PR #9762 on WordPress/wordpress-develop by @johnbillion.


2 months ago
#64

This ticket was mentioned in PR #9866 on WordPress/wordpress-develop by @desrosj.


2 months ago
#65

The WP_Image_UnitTestCase base class already has a filter for wp_image_editors that returns the value of $this->editor_engine, so this is unnecessary here.

Trac ticket: Core-63167.

#66 @johnbillion
2 months ago

In 60737:

Build/Test Tools: Configure PHPUnit to fail on risky tests.

There should be no need for a risky test to go unseen. It usually signifies a problem in the associated test that needs to be addressed.

See #63167, #63932

#68 @desrosj
8 weeks ago

In 60763:

Tests: Remove redundant wp_image_editors filter.

The WP_Tests_Image_Resize_UnitTestCase class extends WP_Image_UnitTestCase, which already has a wp_image_editors filter performing the same action.

This also officially declares $editor_engine as a property in the base class.

Props mukesh27.
See #63167.

@desrosj commented on PR #9866:


8 weeks ago
#69

Fixed in r60763.

#70 @desrosj
8 weeks ago

In 60769:

Tests: Add image editor specific group annotations for resize test classes.

This adds the wp-image-editor-gd and wp-image-editor-imagick group annotation to the Test_Image_Resize_GD and Test_Image_Resize_Imagick test classes, respectively.

See #63167.

#71 @desrosj
8 weeks ago

In 60770:

Tests: Remove @group annotations from abstract classes.

Labelling abstract classes with group annotations is misleading because they are not executed by PHPUnit without an actual test class extending them.

See #63167.

#72 @desrosj
8 weeks ago

In 60772:

Tests: Note image editor class in skipped test note.

When the image editor being used is available, it should be noted in the skipped test message.

See #63167.

#73 @desrosj
8 weeks ago

In 60774:

Build/Test Tools: Run xDebug tests on PHP 8.4.

xDebug was added to the 8.4 image at the end of 2024, so these tests can now be run.

See #63167.

This ticket was mentioned in PR #10014 on WordPress/wordpress-develop by @rollybueno.


7 weeks ago
#74

This test verifies that post meta cache persists (is not invalidated) when a post is updated, which documents the actual WordPress cache behavior.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

This ticket was mentioned in PR #10017 on WordPress/wordpress-develop by @SirLouen.


7 weeks ago
#75

It seems that wp_add_post_meta has not been available for an eternity.
No point on having this any more on the tests
Here I attach a little clean-up patch for this test

#76 @SergeyBiryukov
7 weeks ago

In 60799:

Tests: Clean up calls to the unused wp_add_post_meta() function.

Follow-up to [1041/tests], [23416], [23554].

Props SirLouen, mukesh27, SergeyBiryukov.
See #63167.

@SergeyBiryukov commented on PR #10017:


7 weeks ago
#77

Thanks for the PR! Merged in r60799.

This ticket was mentioned in PR #10060 on WordPress/wordpress-develop by @paulbonneau.


6 weeks ago
#78

Adding PHPUnit tests for get_post_states function

#79 @SirLouen
6 weeks ago

#64026 was marked as a duplicate.

This ticket was mentioned in PR #10137 on WordPress/wordpress-develop by @jorbin.


5 weeks ago
#80

get_my_sites_network_menu_items was essentially being used as a dataprovider before without the benefit of being an actual dataprovider.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

This ticket was mentioned in PR #10138 on WordPress/wordpress-develop by @jorbin.


5 weeks ago
#81

dataproviders allow for the tests to all run rather than stopping at one failure. They also provide for better messages on failure.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#82 @jorbin
5 weeks ago

In 60894:

Tests: Use a dataprovider for some admin-bar tests.

Refactor admin-bar tests to use dataProviers rather than looping through assertions.

See #63167.

#83 @jorbin
5 weeks ago

In 60895:

Tests: Use a dataprovider for some auth tests.

Refactor some auth tests to use dataproviders rather than looping through an array or doing multiple assertions in one test.

See #63167.

#85 @jorbin
5 weeks ago

In 60896:

Build/Test Tools: Update the Inovation Releases tested.

It's not as exciting as The Life of a Showgirl (which is a 10/10 album, no skips), but MariaDB has a new innovation release: https://mariadb.com/docs/release-notes/community-server/release-notes-mariadb-12.0-rolling-releases/mariadb-12.0.2-release-notes

The last innovation release from MariaDB was removed in [60532].

Props jorbin, desrosj.
See #63167.

This ticket was mentioned in PR #10057 on WordPress/wordpress-develop by @jignesh.nakrani.


5 weeks ago
#86

Update unsupported image format tests to use TGA instead of AVIF

Trac ticket: https://core.trac.wordpress.org/ticket/63167

Updated REST API test methods using the unsupported image format to test unsupported logic checks

This ticket was mentioned in PR #10164 on WordPress/wordpress-develop by @mukesh27.


5 weeks ago
#87

Trac ticket: https://core.trac.wordpress.org/ticket/63167

  • Converted the data_custom_post_statuses and data_built_unregistered_in_status_types data provider methods to static, slight performance improvement.
  • Added the @covers is_post_status_viewable annotation to the test class to explicitly declare the function under test.
  • Improved the readability of the test data arrays in data_custom_post_statuses by replacing numeric indexes with descriptive string keys for each test case.

@jorbin commented on PR #10138:


5 weeks ago
#88

This was committed in https://core.trac.wordpress.org/changeset/60895

@mukeshpanchal27 I know that non-static dataProviders are deprecated as of phpunit 10. I think we are best off switching all of them as a part of https://core.trac.wordpress.org/ticket/62004

@jorbin commented on PR #10137:


5 weeks ago
#89

This was committed in https://core.trac.wordpress.org/changeset/60894

@mukeshpanchal27 If you want to a new PR for those I can commit it but I think in general we are a lot more slack with docs for unit test related things

This ticket was mentioned in PR #10166 on WordPress/wordpress-develop by @desrosj.


5 weeks ago
#91

This version now supports less than 1% of all WordPress installs.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

@jorbin commented on PR #10166:


5 weeks ago
#92

Unless we are dropping support for this, I think it should still be included in the matrix, but perhaps cut down to only be the oldest and newest PHP?

@desrosj commented on PR #10166:


5 weeks ago
#93

Unless we are dropping support for this, I think it should still be included in the matrix, but perhaps cut down to only be the oldest and newest PHP?

In r59587 we implemented the 1% usage policy. If the goal is to include all supported versions, then versions 10.0, 10.1, and 10.2 would also need to be added.

This ticket was mentioned in PR #10372 on WordPress/wordpress-develop by @jorbin.


3 weeks ago
#94

Slack Discussion: https://wordpress.slack.com/archives/C02RQBWTW/p1761040717220989

This changes the matrix for phpunit so that each version of PHP is only tested once vs each type of db rather than against every combination of database version

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#95 @jorbin
3 weeks ago

In 61018:

Build/Test: Limit PHPUnit Matrix for Pull Requests.

Instead of Pull Requests initiating 300+ actions, this brings it down closer to 50. This should allow more concurrent pull requests and speed up the flow.

Relevant Slack Discussion: https://wordpress.slack.com/archives/C02RQBWTW/p1761040717220989

Props youknowriad, ellatrix.
See #63167

This ticket was mentioned in PR #10404 on WordPress/wordpress-develop by @Rahmohn.


3 weeks ago
#96

This PR adds tests to the WP_Block_Styles_Registry class.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#97 @Rahmohn
3 weeks ago

In #52592, I've sent some unit tests (https://core.trac.wordpress.org/ticket/52592#comment:8). However, these tests weren't included in [59760].

I've created a PR to add these tests: https://github.com/WordPress/wordpress-develop/pull/10404

#99 @johnbillion
13 days ago

In 61083:

Build/Test Tools: Apply formatting to wp_die() output during PHPUnit test runs.

This makes the output more legible in the terminal.

See #63167

#101 @desrosj
6 days ago

In 61132:

Build/Test Tools: Remove MariaDB 10.4 from the test matrix.

MariaDB 10.4 has fallen below 1% usage across all WordPress sites, according to wordpress.org/stats.

This 1% threshold was established as the minimum percentage of installs required to be included in the PHPUnit testing matrix in [59587].

Props jorbin.
See #63167.

@desrosj commented on PR #10166:


6 days ago
#102

Because this adheres to the 1% policy that was followed for r59587, I've gone and merged this.

Leading up to 6.9 beta 1, there were very long queues that amassed causing long wait times requiring a temporary fix in r61018. Let's re-evaluate this rule when we consider what the test matrix should and should not include after 6.9 goes out.

Merged in r61132.

This ticket was mentioned in PR #10466 on WordPress/wordpress-develop by @jorbin.


6 days ago
#103

dataproviders allow for the tests to all run rather than stopping at one failure. They also provide for better messages on failure.

Trac ticket: https://core.trac.wordpress.org/ticket/63167

#104 @SergeyBiryukov
4 days ago

In 61170:

Tests: Improve unit tests for is_post_status_viewable().

Includes:

  • Adding the missing @covers annotation.
  • Converting data provider methods to static for a slight performance improvement.
  • Using named data providers.

Follow-up to [50130].

Props mukesh27, swissspidy, SergeyBiryukov.
See #63167.

This ticket was mentioned in PR #10478 on WordPress/wordpress-develop by @westonruter.


4 days ago
#105

Trac ticket: https://core.trac.wordpress.org/ticket/63167

This is a follow-up to r61170. It fixes a unit test failure in PHP 8.5:

1) Tests_Post_IsPostStatusViewable::test_built_in_and_unregistered_status_types with data set "null" (null, false)
Using null as an array offset is deprecated, use an empty string instead

/var/www/src/wp-includes/post.php:1515
/var/www/tests/phpunit/tests/post/isPostStatusViewable.php:111
/var/www/vendor/bin/phpunit:122

#106 @westonruter
4 days ago

In 61171:

Tests: Fix unit test failure in PHP 8.5 due using null as an array offset.

This adds is_string() type checks for the $post_status arg passed to both get_post_status_object() and is_post_status_viewable(). This was triggered by Tests_Post_IsPostStatusViewable::test_built_in_and_unregistered_status_types() for the null data set.

Follow-up to [61170].

See #63167, #63061.

@westonruter commented on PR #10478:


4 days ago
#107

Committed in r61171

#108 @wildworks
3 days ago

  • Description modified (diff)

@SergeyBiryukov commented on PR #10164:


3 days ago
#109

Thanks for the PR! Merged in r61170.

#110 @SergeyBiryukov
3 days ago

In 61185:

Tests: Improve unit tests for feed_links_extra().

Includes:

  • Converting data provider methods to static for a slight performance improvement.
  • Correcting annotations for consistency.

Follow-up to [53033], [53125], [54161].

Props mukesh27, SergeyBiryukov.
See #63167.

@SergeyBiryukov commented on PR #10416:


2 days ago
#111

Thanks for the PR! Merged in r61185.

#112 @SergeyBiryukov
2 days ago

In 61186:

Tests: Add unit tests for a label fallback in WP_Block_Styles_Registry::register().

Follow-up to [59760].

Props Rahmohn, mukesh27, SergeyBiryukov.
See #63167.

Note: See TracTickets for help on using tickets.