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

WordPress Trac noreply at wordpress.org
Wed Aug 31 16:16:01 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:"54041" 54041]:
 {{{
 #!CommitTicketReference repository="" revision="54041"
 Tests: Use correct `post_author` value in
 `WP_Test_REST_Attachments_Controller`.

 The `$editor_id` property is declared as static, so can only be approached
 as static, even when used within the same class in which the property is
 declared.

 Using non-static access will result in `null`. See: https://3v4l.org/93HQL

 This PHP notice was hidden so far, due to the existence of magic methods
 in the `WP_UnitTestCase_Base` class.

 All the same, the magic methods as they were, would also return `null` for
 this property. All in all, the attachment being created for this test
 would never get the correct `post_author`.

 Fixed by using static access to approach the static property.

 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 [38832].

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

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


More information about the wp-trac mailing list