Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31718 closed defect (bug) (invalid)

Each unit test in /query/conditionals.php is being called twice.

Reported by: tyxla's profile tyxla Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.2
Component: Build/Test Tools Keywords: has-patch close
Focuses: Cc:

Description

When testing a particular test under /tests/phpunit/tests/query/conditionals.php, that test is being called twice. For example, you can try the following command:

phpunit --filter "test_post_comments_feed_with_no_comments"

(the test_post_comments_feed_with_no_comments test is defined under Tests_Query_Conditionals in /tests/phpunit/tests/query/conditionals.php).

Attachments (1)

31718.patch (721 bytes) - added by tyxla 9 years ago.
Removing tests/phpunit/tests/query/verboseRewriteRules.php to avoid duplicate calling of query/conditional tests.

Download all attachments as: .zip

Change History (6)

#1 @tyxla
9 years ago

After investigating I discovered that this has is caused by tests/phpunit/tests/query/verboseRewriteRules.php. Extending Tests_Query_Conditionals causes its tests to be called twice.

This file appears to have been created in 915/tests.

Since this file contains no tests, it does nothing so it can be removed.

Not sure if a patch is needed for that, but attaching one anyway.

@tyxla
9 years ago

Removing tests/phpunit/tests/query/verboseRewriteRules.php to avoid duplicate calling of query/conditional tests.

#2 @tyxla
9 years ago

  • Keywords has-patch added

#3 @boonebgorges
9 years ago

  • Keywords close added

it does nothing so it can be removed.

This is not correct. Tests_Query_VerbosePageRules extends Tests_Query_Conditionals, which means it runs all the test methods of the latter class. And the two are not redundant, since they run with different permalink structures. I'm not sure what the original purpose of testing these specific permalink structures was - maybe @dd32 can chime in - but I don't think we're looking at a bug.

#4 @tyxla
9 years ago

Makes sense to me, thanks for shedding light on that.
Guess this is done intentionally, so that ticket can be closed indeed.

#5 @dd32
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Indeed this is by design.

Different permalink formats could act differently to one another, so it's testing various angles.

I suspect this might be from prior to our Verbose rewrite rule cleanups, so it might not still apply for the original purpose, but there's no harm in keeping them both IMHO, as it provides better coverage.

Note: See TracTickets for help on using tickets.