Opened 22 months ago
Closed 21 months ago
#61238 closed defect (bug) (fixed)
Tests: Ticket annotations should not include any trailing characters
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.6 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
PHPUnit tests use the @ticket 1234 annotation to reference tickets, but are also used as a PHPUnit group so that tests can be filtered like this:
phpunit --group 1234
Where only tests with the @ticket 1234 will run (or a 1234 group).
Some annotations include additional characters, such as a full stop "." or other details on the ticket line. This breaks the group-based ticket filtering.
Some changes would improve things:
- Trailing characters should be removed from the ticket numbers.
- The ticket to group matching should trim the ticket number from the annotation to match only the initial digits (something like
/^\d+/). - A PHP code sniff could prevent adding extra characters to the ticket number.
Change History (12)
#1
in reply to:
↑ description
@
22 months ago
This ticket was mentioned in PR #6564 on WordPress/wordpress-develop by @jonsurrell.
22 months ago
#3
- Keywords has-patch has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/61238
@jonsurrell commented on PR #6564:
22 months ago
#4
There's one ticket annotation in an inline comment in a data provider from https://core.trac.wordpress.org/ticket/56468:
(Line 243 here)
I'm not quite sure what to do with that one.
#5
@
22 months ago
The ticket matching behavior is well documented:
https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/#groups
@SergeyBiryukov commented on PR #6564:
22 months ago
#8
Thanks for the PR! Merged in r58164.
#9
@
22 months ago
Does anyone know where the @ticket annotations are processed? I found this function, but my changes to that file didn't seem to have any impact:
I'd like to see if we could implement this idea:
The ticket to group matching should trim the ticket number from the annotation to match only the initial digits (something like
/^\d+/).
Then this would be less likely to break in the future and tickets could include notes:
/** * @ticket 123 Make sure the thing isn't broken. */
This ticket was mentioned in Slack in #core by jonsurrell. View the logs.
22 months ago
#11
@
22 months ago
`@ticket` is a PHPUnit annotation. I thought it was something special.
It doesn't look like something to change at the annotation-handling level.
This seems like something that could have a sniff. I think this ticket can be closed.
Tests with tickets that will not currently match
--groupfiltering as expected: