Make WordPress Core

Opened 6 months ago

Closed 5 weeks ago

#62280 closed task (blessed) (fixed)

Test tool and unit test improvements for 6.8

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

Description

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 (44)

#1 @desrosj
6 months ago

In 59282:

Build/Test Tools: Test against MySQL 9.0.

Version 9.0 is the latest short-term innovation release of MySQL.

See #62280.

#2 @SergeyBiryukov
5 months ago

In 59408:

Tests: Add missing @covers tag for fetch_feed() tests.

Includes correcting the test class name as per the naming conventions.

Follow-up to [59382].

See #62280.

#3 @SergeyBiryukov
4 months ago

In 59579:

Tests: Improve the test for the copyright year in bundled themes' readme.txt.

This aims to catch entries like (C) 2024 WordPress.org in addition to Copyright 2024 WordPress.org.

Includes converting the test to use a data provider, so that messages could be displayed for each individual theme.

Follow-up to [46719], [59569].

See #62280.

#4 @desrosj
4 months ago

In 59583:

Tests: Fix explode() error for old DB versions on PHP 8.1+.

On MySQL/MariaDB 5.5, the default value for sql_mode was a blank string. By itself this is not a problem. However, $wpdb->get_var() returns null when a variable has an empty value.

One test method currently passes the result of $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' ) to explode() in order to reset the database to the pre-test method state. This causes an error when running PHP 8.1+, which deprecated the ability to pass null as a parameter of explode().

This edge case was undiscovered because these versions are not currently included in the automated testing matrix.

See #62280.

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


4 months ago
#5

  • Keywords has-patch added

See 5267e4a40cb4e63e6a0855b137cb0a3092544da9

Needs backporting because svn isn't available anymore on newer GitHub Actions runners

Needs to be done for 5.4-5.7 as well.

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

@swissspidy commented on PR #8116:


4 months ago
#6

Not sure why the QUnit tests fail in this branch and not elsewhere 🤔

#7 @swissspidy
4 months ago

In 59601:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.3 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#8 @SergeyBiryukov
3 months ago

In 59604:

Tests: Restore the environment before performing assertions in download_url() tests.

This aims to avoid affecting other tests in case of failure.

Follow-up to [42773], [51939].

See #62280.

#9 in reply to: ↑ description @medikur
3 months ago

  • Keywords changes-requested added
  • Version set to trunk

Replying to desrosj:

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.

#10 @swissspidy
3 months ago

In 59608:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.4 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#11 @swissspidy
3 months ago

In 59609:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.5 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#12 @swissspidy
3 months ago

In 59610:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.6 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#13 @swissspidy
3 months ago

In 59611:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.7 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#14 @swissspidy
3 months ago

In 59612:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.2 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#15 @desrosj
3 months ago

In 59614:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.2 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#16 @swissspidy
3 months ago

In 59615:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.1 branch.
Reviewed by desrosj.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#17 @desrosj
3 months ago

In 59616:

Build/Test Tools: Fix bad merge in [59614].

Unprops desrosj.
See #52909.
See #62280.

#18 @desrosj
3 months ago

In 59617:

Build/Test Tools: Fix bad merge in [59614].

Unprops desrosj.
See #52909.
See #62280.

#19 @desrosj
3 months ago

In 59618:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.3 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#21 @desrosj
3 months ago

In 59619:

Build/Test Tools: Pin specific Importer version.

This pins the last version compatible with WordPress 4.1 to that branch.

Follow up to [59612], [59616].
Reviewed by swissspidy.

See #52909.
See #62280.

#23 @desrosj
3 months ago

In 59620:

Build/Test Tools: Pin specific Importer version.

This pins the last version compatible with WordPress 4.2 to that branch.

Follow up to [59614], [59617].
Reviewed by swissspidy.

See #52909.
See #62280.

#24 @desrosj
3 months ago

In 59621:

Build/Test Tools: Pin specific Importer version.

This pins the last version compatible with WordPress 4.3 to that branch.

Follow up to [59618].
Reviewed by swissspidy.

See #52909.
See #62280.

#25 @desrosj
3 months ago

In 59623:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.5 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#26 @desrosj
3 months ago

In 59624:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.6 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#27 @desrosj
3 months ago

In 59625:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.7 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#28 @desrosj
3 months ago

In 59626:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.8 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#29 @desrosj
3 months ago

In 59627:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 4.9 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#30 @desrosj
3 months ago

In 59628:

Build/Test Tools: Use Git when fetching the WordPress Importer for use in tests.

This switches to using Git in the local Docker environment install script to check out a copy of the WordPress Importer plugin for use in unit tests.

Previously, SVN was used and the commands were not correctly run within the Docker container. The container does not actually have SVN installed, and the script was only working when the machine running the command had SVN present.

Merges [51179] to the 5.0 branch.
Reviewed by swissspidy.

Props czapla, alexstine, jnylen0, francina, desrosj.
See #52909.
See #62280.

#31 @desrosj
3 months ago

In 59629:

Build/Test Tools: Pin specific Importer version.

This pins the last version compatible with WordPress 5.1 to that branch.

Follow up to [59615].
Reviewed by swissspidy.

See #52909.
See #62280.

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


3 months ago
#32

This reduces the noise of the output -- both locally and on CI -- when first pulling containers during local environment installation and the first time the cli container is pulled for WP-CLI commands.

#33 @johnbillion
3 months ago

In 59658:

Build/Test Tools: Use quiet pulls during local environment installation and WP-CLI commands.

This reduces the noise of the output -- both locally and on CI -- when first pulling containers during local environment installation and the first time the cli container is pulled for WP-CLI commands.

See #62280

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


3 months ago
#35

#36 @johnbillion
3 months ago

In 59725:

Build/Test Tools: Add some more paths restrictions to GitHub Actions workflow files to minimise unnecessary workflow runs.

Props mukesh27, johnbillion

See #62280

#38 @peterwilsoncc
2 months ago

In 59820:

Tests: Rename rest-api group to restapi for consistency.

Rename the group in tests/phpunit/tests/rest-api/wpIsRestEndpoint.php to restapi for consistency with the group name used by other REST API related tests.

Follow up to [57312].

See #62280.

#39 @SergeyBiryukov
2 months ago

In 59822:

Tests: Correct failure messages for some tests.

Follow-up to [54176], [57548], [58328].

Props poena, SergeyBiryukov.
See #62280.

#40 @desrosj
8 weeks ago

  • Owner set to desrosj
  • Status changed from new to assigned

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


7 weeks ago
#41

Generate packagehash.txt on first install to prevent grunt triggering a reinstall during build step.

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

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


7 weeks ago
#42

  • Keywords has-unit-tests added

admin.visitAdminPage() requires users be logged in to prevent it from throwing an error. For some tests this is causing misbehaviour depending on the order in which the tests run.

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

@peterwilsoncc commented on PR #8474:


7 weeks ago
#43

Instead of changing these GHA commands, it would be great to solve this anytime npm install is run for wordpress-develop because this same bug exists locally. To confirm just delete the packagehash.txt file and run build.

I looked in to this with a postinstall script but it appears that the --hash-only switch added in the repo never got released to the npm package.

I guess we could fork it and publish as @wordpress/install-changed but I am not that concerned.

#44 @desrosj
5 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

I've gone and opened #63167 for 6.9. I'm closing this out.

@peterwilsoncc I think the install-changed PR needs more thought, but if you feel the admin.visitAdminPage() one is ready during RC and should be backported, feel free to reopen this ticket and commit.

Note: See TracTickets for help on using tickets.