[wp-trac] [WordPress Trac] #58006: Final classes & testing

WordPress Trac noreply at wordpress.org
Tue Mar 28 20:19:38 UTC 2023


#58006: Final classes & testing
------------------------------+-----------------------------
 Reporter:  neblabs           |      Owner:  (none)
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:  6.1.1
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 Sorry if this is not the place to post.

 All (or most AFAIK) WordPress classes WP_* are declared final.

 This is an issue when unit testing since final classes can't be mocked so
 unit testing a class that relies on a WP_Post instance is hard.

 If I may ask, is there a reason why these classes are final? Have there
 been any talks to make them non-final, at least in the official testing
 environment that uses phpunit?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58006>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list