Page MenuHomePhabricator

Adapt MW-CS test framework to support testing sniffs that support auto-fixing (phpcbf)
Closed, ResolvedPublic

Description

Our test framework doesn't allow to add tests for sniffs that can auto-fix stuff. addshore was going to look into fixing it :)

Event Timeline

Legoktm created this task.Aug 8 2015, 9:07 AM
Legoktm assigned this task to Addshore.
Legoktm raised the priority of this task from to Needs Triage.
Legoktm updated the task description. (Show Details)
Legoktm added a project: MediaWiki-Codesniffer.
Legoktm added a subscriber: Legoktm.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 8 2015, 9:07 AM
Legoktm removed Addshore as the assignee of this task.Sep 9 2015, 8:09 PM
Legoktm set Security to None.
Legoktm added subscribers: Addshore, polybuildr.

I have addressed this issue in https://gerrit.wikimedia.org/r/#/c/237899/ - but have not tested it out yet. Would like a review before I work more on it, so that I know that the approach is fine.

I used the same method that phpcs is using in it's git repository. It has a "AbstractSnifTest" which is inherited by a Test class for each sniff and it runs phpcs only with that sniff and disables the others. It runs phpcs on a file and verifies whether the number of warnings and errors per line are the same. After running the analysis, it can also take the diff from the PHP_CodeSniff_File class and check that it's the same as the *.fixed file of the input being tested.

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 20 2015, 9:16 AM
Legoktm closed this task as Resolved.May 28 2016, 12:03 AM