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

WordPress Trac noreply at wordpress.org
Thu Jul 28 22:37:15 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:"53790" 53790]:
 {{{
 #!CommitTicketReference repository="" revision="53790"
 Tests: Simplify some assertions in `Tests_Media`.

 A number of assertions are checking for the number of times a hard-coded
 substring existed in a larger `$haystack`.

 These assertions were using `preg_match_all()` to do so, but without
 actually using a regex.

 In these cases, it is more performant (and simpler) to use the PHP native
 `substr_count()` function, which will yield the same result, without the
 overhead of regex parsing.

 Reference: [https://www.php.net/manual/en/function.substr-count.php PHP
 Manual: substr_count()]

 Follow-up to [711/tests], [38838], [42694], [53558].

 Props jrf.
 See #55652.
 }}}

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


More information about the wp-trac mailing list