[wp-trac] [WordPress Trac] #54177: Add visibility to test class methods

WordPress Trac noreply at wordpress.org
Fri Sep 24 10:03:41 UTC 2021


#54177: Add visibility to test class methods
--------------------------------------+-------------------------------
 Reporter:  costdev                   |       Owner:  (none)
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Build/Test Tools          |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  coding-standards
--------------------------------------+-------------------------------

Comment (by costdev):

 ~~This ticket proposes to add public visibility to all test classes except
 those that begin with an underscore, suggesting private/protected
 visibility. This ticket proposes that these methods are given private
 visibility.~~

 As `private` causes failures, this ticket instead proposes to add public
 visibility to all test classes including those that begin with an
 underscore. All tests pass.


 ----


 There were new tests committed upstream that didn't identify their
 visibility just prior to me creating the initial PR.

 We should try to find a way to ensure that all tests going forward have
 their visibility identified prior to commit. Ideally this would be added
 to the PHP coding standards, if they can detect class methods vs nested
 methods, so that committers don't have to spend the time to communicate
 this to contributors, which could create quite a delay.

 If the standards can be updated to check for `public`, `protected` or
 `private` visibility, then leave it to the contributor to decide which to
 use (unit tests will fail if they choose wrong anyway), that would be
 great.

 Pinging @hellofromTonya for PR review.

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


More information about the wp-trac mailing list