[wp-trac] [WordPress Trac] #46149: PHPUnit 8.x support

WordPress Trac noreply at wordpress.org
Fri Aug 6 00:44:16 UTC 2021


#46149: PHPUnit 8.x support
-------------------------------------------------+-------------------------
 Reporter:  SergeyBiryukov                       |       Owner:  netweb
     Type:  task (blessed)                       |      Status:  assigned
 Priority:  high                                 |   Milestone:  5.9
Component:  Build/Test Tools                     |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests early php8  |     Focuses:
  needs-dev-note                                 |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 In [changeset:"51561" 51561]:
 {{{
 #!CommitTicketReference repository="" revision="51561"
 Build/Test Tools: Change the inheritance order of the abstract test
 classes.

 As things were, the inheritance order of the abstract test classes was as
 follows:
 {{{
 WP_UnitTestCase (PHPUnit adapter layer)
     extends WP_UnitTestCase_Base (base test class)
         extends PHPUnit\Framework\TestCase (PHPUnit native class)
 }}}

 Concrete (child) test classes, as well as more specific abstract
 TestCases, are/were expected to extend the `WP_UnitTestCase`.

 This order is not optimal as it means that the `WP_UnitTestCase_Base`
 class would not be able to benefit from any polyfills and/or shims in the
 PHPUnit adapter layer.

 With that in mind, this commit changes the inheritance to:
 {{{
 WP_UnitTestCase (empty class, left in place to not break BC for
 plugin/theme integration tests)
     extends WP_UnitTestCase_Base (base test class)
         extends PHPUnit_Adapter_TestCase (PHPUnit adapter layer)
             extends PHPUnit\Framework\TestCase (PHPUnit native class)
 }}}

 The new order allows for the `WP_UnitTestCase_Base` to also benefit from
 the PHPUnit adapter layer.

 For backward compatibility reasons the `WP_UnitTestCase`, which all test
 classes are (were) expected to extend, is left in place, though it is now
 an empty class and explicitly `abstract`.

 Follow-up to [51559], [51560].

 Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov.
 See #46149.
 }}}

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


More information about the wp-trac mailing list