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

WordPress Trac noreply at wordpress.org
Wed Aug 31 16:02:20 UTC 2022


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

Comment (by SergeyBiryukov):

 In [changeset:"54040" 54040]:
 {{{
 #!CommitTicketReference repository="" revision="54040"
 Tests: Correctly back up and restore theme directories in `Tests_Theme`.

 In the `set_up()` method, a copy would be made of the original value of
 the global `$wp_theme_directories` variable, with the intention to restore
 that original value in the `tear_down()` method after running each test.
 Unfortunately, this was not implemented correctly.

 * The backup is made to a function local variable in `set_up()` and not
 stored somewhere where it is accessible from the `tear_down()` method.
 * The restoring then references a non-existent property to restore, which
 would effectively set the `$wp_theme_directories` global to `null`.

 Fixed by declaring and using a private property to store the original
 `$wp_theme_directories` value.

 This bug was discovered while fixing (removing) the magic methods in the
 `WP_UnitTestCase_Base` class in an effort to improve compatibility with
 PHP 8.2.

 Follow-up to [38907].

 Props jrf, costdev, johnbillion, swissspidy.
 See #55652.
 }}}

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


More information about the wp-trac mailing list