[wp-trac] [WordPress Trac] #40293: Comment template - warning
WordPress Trac
noreply at wordpress.org
Wed Oct 11 11:27:13 UTC 2017
#40293: Comment template - warning
-------------------------------------------------+-------------------------
Reporter: victorfreitas | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Comments | Review
Severity: normal | Version: 4.8
Keywords: has-patch has-unit-tests has- | Resolution:
screenshots | Focuses:
-------------------------------------------------+-------------------------
Changes (by birgire):
* keywords: has-patch needs-unit-tests reporter-feedback => has-patch has-
unit-tests has-screenshots
Comment:
In [attachment:40293-how-to-reproduce-divide-by-zero.jpg] we see how to
replicate the "Division by zero" PHP error.
It's attempting to write a test to check if there's no "Division by zero"
PHP error.
But there's no {{{assertExceptionNotThrown()}}} and there's some
discussion on [https://github.com/sebastianbergmann/phpunit-
documentation/issues/171 PHPUnit-Doc:Testing an exception is not thrown]
that it could be an anti-pattern.
There's a way to add a {{{comments_template_query_args}}} filter with an
assertion to check if offset is zero, but I don't think that's the way
here.
So in [attachment:40293.2.diff] I try instead to display comments, with
the problematic setup of:
- {{{default_comments_page}}} as 'newest'
- {{{comments_per_page}}} as '0'
- {{{page_comments}}} as '1'
in a similar way as previous tests in
{{{Tests_Comment_CommentsTemplate}}}.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40293#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list