[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:44:58 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 pbiron):
Replying to [comment:7 jrf]:
> 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 ?
Whenever possible, I like them in an abstract test case class (e.g.,
[https://core.trac.wordpress.org/browser/trunk/tests/phpunit/includes
/testcase-xml.php#L12 WP_Test_XML_TestCase::loadXML()]), which I wrote
when XML Sitemaps were added to core. Note that that method contains an
assertion, but it is basically a helper for other sitemaps tests (e.g.,
[https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/sitemaps
/sitemaps-renderer.php#L137
Test_WP_Sitemaps_Renderer::test_get_sitemap_index_xml_extra_elements()]).
As @SergeyBiryukov mentioned, for things like `add_{action|filter}()`
callbacks, near where they are used is my preference.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53119#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list