[wp-trac] [WordPress Trac] #53363: Test tool and unit test improvements for 5.9

WordPress Trac noreply at wordpress.org
Sun Aug 8 16:11:35 UTC 2021


#53363: Test tool and unit test improvements for 5.9
--------------------------------------+---------------------
 Reporter:  desrosj                   |       Owner:  (none)
     Type:  task (blessed)            |      Status:  new
 Priority:  normal                    |   Milestone:  5.9
Component:  Build/Test Tools          |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------

Comment (by SergeyBiryukov):

 Just noting that I was confused by [attachment:"53363-07-add-schema-to-
 config.patch"] at first, as I still see a deprecated schema warning in
 PHPUnit 9.3+ with this patch, both locally and
 [https://github.com/SergeyBiryukov/wordpress-
 develop/runs/3271296325?check_suite_focus=true#step:20:31 on GitHub]:
 {{{
 Warning:       Your XML configuration validates against a deprecated
 schema.
 Suggestion:    Migrate your XML configuration using "--migrate-
 configuration"!
 }}}

 It looks like either this message or a more detailed one:
 {{{
 Warning - The configuration file did not pass validation!
 The following problems have been detected:
 ...
 Test results may not be as expected.
 }}}
 is displayed in `TestRunner::run()`, depending on
 [https://github.com/sebastianbergmann/phpunit/blob/d599f6e25cc939f13c6dcfe00028b6e8d275ad55/src/TextUI/TestRunner.php#L385
 whether a schema is detected].

 Per discussion with @jrf, the first warning will remain and is fine. Only
 when PHPUnit 10 comes into play we should look into adding a run step to
 CI to call the `--migrate-configuration` command. The patch is supposed to
 silence the second, more detailed warning, displayed in PHPUnit 9.3+ when
 an old configuration file is used.

 Looking at the `SchemaDetector` class, it attempts to
 [https://github.com/sebastianbergmann/phpunit/blob/d599f6e25cc939f13c6dcfe00028b6e8d275ad55/src/Util/Xml/SchemaDetector.php#L29
 validate the configuration file] against the
 [https://github.com/sebastianbergmann/phpunit/tree/d599f6e25cc939f13c6dcfe00028b6e8d275ad55/schema
 available schema files], as per the
 [https://github.com/sebastianbergmann/phpunit/blob/d599f6e25cc939f13c6dcfe00028b6e8d275ad55/src/Util/Xml/SchemaFinder.php#L33
 SchemaFinder class].

 In my testing with PHPUnit 9.5.8, the configuration file successfully
 validates against the PHPUnit 9.2 schema with or without it being
 explicitly declared, so the detailed message is never displayed and the
 patch does not seem to make a difference. Still, I guess it's better to
 declare the schema explicitly for clarity.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53363#comment:54>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list