[wp-trac] [WordPress Trac] #53010: Tests: introduce namespacing for the test classes

WordPress Trac noreply at wordpress.org
Sun Jun 18 10:25:33 UTC 2023


#53010: Tests: introduce namespacing for the test classes
------------------------------+-------------------------------------
 Reporter:  jrf               |       Owner:  hellofromTonya
     Type:  task (blessed)    |      Status:  assigned
 Priority:  normal            |   Milestone:  Future Release
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  2nd-opinion       |     Focuses:  docs, coding-standards
------------------------------+-------------------------------------

Comment (by azaozz):

 May be missing something but it seems the proposed "File paths" suggest
 that each class should be split in up to 50 separate files, one per
 method. Is that true?

 If yes, could you please explain what are the benefits of having several
 thousands of files instead of 100-200? Seems this would trigger a lot of
 needless disk i/o and slow down running of the tests as most of the files
 will have to be loaded every time the tests are run.

 Also seems this is not recommended (compatible?) by [https://www.php-
 fig.org/psr/psr-4/ PSR4]. It states that:

  A fully qualified class name has the following form:
  `\<NamespaceName>(\<SubNamespaceNames>)*\<ClassName>`

 (where "The terminating class name corresponds to a file name ending in
 `.php`.").

 In any case, thinking that an example of the proposed namespaces, and list
 of the file paths and file names would be great to have. For example: what
 would
 https://core.trac.wordpress.org/browser/tags/6.2.2/tests/phpunit/tests/blocks/register.php
 look like if this proposal is implemented?

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


More information about the wp-trac mailing list