[wp-trac] [WordPress Trac] #59881: Incorrect check for block theme in legacy PHPUnit test
WordPress Trac
noreply at wordpress.org
Fri Nov 10 18:57:14 UTC 2023
#59881: Incorrect check for block theme in legacy PHPUnit test
------------------------------+--------------------------------------
Reporter: flixos90 | Owner: flixos90
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.5
Component: Build/Test Tools | Version: trunk
Severity: normal | Keywords: has-unit-tests has-patch
Focuses: |
------------------------------+--------------------------------------
The very old `test_switch_theme()` recently required updates, and at the
same time was updated to not cover block themes, as the test is overly
complex and not up to date with how PHPUnit tests should be written as of
today. Still, simply removing is probably not a good idea. Ideally it
could be refactored, but that's also a very low hanging fruit.
In any case, it was recently noticed that the test unintentionally was
still covering block themes in certain conditions, due to a bug in the
condition. Here's the problem and solution:
* The `block-templates` theme support for block themes is added
dynamically via `wp_enable_block_templates()`, so checking for that isn't
reliable.
* The conditions used in `wp_enable_block_templates()` should be used
instead.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59881>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list