[wp-trac] [WordPress Trac] #53119: Tests: introduce naming conventions for data providers and use named test cases
WordPress Trac
noreply at wordpress.org
Fri Apr 30 21:18:46 UTC 2021
#53119: Tests: introduce naming conventions for data providers and use named test
cases
------------------------------+------------------------------
Reporter: jrf | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Resolution:
Keywords: | Focuses: docs
------------------------------+------------------------------
Comment (by SergeyBiryukov):
Replying to [comment:7 jrf]:
> Another thing which comes to my mind while reading though this
discussion, is: what about test helper functions ? Should we set a
convention for the placement of those ?
>
> In my ''opinion'', test ''helper'' functions should always be at the
bottom of a test class (or in an abstract test case). What do you think ?
I think I would apply the same logic as for data providers here. If the
helper function is only used in one or two tests, e.g. an `add_filter()`
callback, I would expect to see it directly after the test.
If the helper is used for multiple tests that do not necessarily belong
together as a group, then I would expect to find the helper function after
the `::setUp()`/`::tearDown()` methods, or at the bottom.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53119#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list