[wp-trac] [WordPress Trac] #38688: Tests Audit: some tests can fail when the date changes
WordPress Trac
noreply at wordpress.org
Sat Nov 12 13:58:59 UTC 2016
#38688: Tests Audit: some tests can fail when the date changes
---------------------------------------------+-----------------------------
Reporter: pento | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: Future Release
Component: Build/Test Tools | Version:
Severity: minor | Resolution:
Keywords: good-first-bug needs-unit-tests | Focuses:
---------------------------------------------+-----------------------------
Changes (by johnbillion):
* keywords: good-first-bug has-patch => good-first-bug needs-unit-tests
Comment:
Thanks for the patch, @xrmx! After checking this further today, after our
talk at the Torino contributor evening, I don't think your patch
''completely'' fixes the issue.
The underlying problem is that 12 posts are created in the `setUp()`
method each time a test runs, and if the date ticks over to the next day
in between the first post being created and the last post being created,
then not all of the posts will have the same date.
In addition to the fixes in [attachment:0001-tests-call-date-once-per-
test.patch], the `post_date` property should be specified when creating
the posts in the `setUp()` method, and the same date can be used in each
test instead of calling `date()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38688#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list