Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 4 days ago

#60305 closed enhancement (fixed)

Ensure that `Tests_Theme_wpThemeJson::test_set_spacing_sizes_should_detect_invalid_spacing_scale` is compatible with PHPUnit 10

Reported by: antonvlasenko's profile antonvlasenko Owned by: youknowriad's profile youknowriad
Milestone: 6.5 Priority: normal
Severity: minor Version: 6.5
Component: Editor Keywords: has-patch has-unit-tests dev-feedback
Focuses: Cc:

Description

The test_set_spacing_sizes_should_detect_invalid_spacing_scale() test method is incompatible with PHPUnit 10 because the TestCase::expectNotice() method is deprecated.
The changes from https://github.com/WordPress/gutenberg/pull/55354 need to be backported for that test method to Core to ensure compatibility with PHP 10.

Change History (11)

#1 @antonvlasenko
3 months ago

I'm working on a PR for this ticket.

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


3 months ago
#2

  • Keywords has-patch has-unit-tests added; needs-patch removed

This PR aims to backport https://github.com/WordPress/gutenberg/pull/55354 to Core to ensure that Tests_Theme_wpThemeJson::test_set_spacing_sizes_should_detect_invalid_spacing_scale is compatible with PHPUnit 10

Trac ticket: https://core.trac.wordpress.org/ticket/60305#comment:1

#3 @youknowriad
3 months ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from new to closed

In 57332:

Editor: Ensure PHPUnit10 compatibility for ThemeJson unit test.

Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE errors is deprecated in PHPUnit 10.
This updates the test to rely on an exception instead.

Props antonvlasenko.
Fixes #60305.

#5 @kebbet
3 months ago

Please milestone the ticket to 6.5 @youknowriad, thanks!

#6 @youknowriad
3 months ago

  • Milestone changed from Awaiting Review to 6.5

#7 @youknowriad
3 months ago

Good call thanks @kebbet

#8 @desrosj
3 months ago

Related: #59486.

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


3 months ago
#9

set_error_handler is a global change that should be cleaned up

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

#10 @jorbin
3 months ago

In 57361:

Build/Tests: Ensure set_error_handler is cleaned up.

Follow up to: [57332].

Fixes #60305.

#11 @antonvlasenko
4 days ago

  • Keywords dev-feedback added

@jorbin I believe it might be worth considering a revert of https://core.trac.wordpress.org/changeset/57361, as it appears that its code does not get executed.
The handler is already being cleaned up within the new error handler itself:

		set_error_handler(
			static function ( $errno, $errstr ) {
				restore_error_handler(); // <-- This is where it's cleaned up.
				throw new Exception( $errstr, $errno );
			},
			E_ALL
		);
Last edited 4 days ago by antonvlasenko (previous) (diff)
Note: See TracTickets for help on using tickets.