Page MenuHomePhabricator

Improve test suite for mediawiki phpcs standard
Closed, ResolvedPublic


Right now our test system just checks that if a file ends with _fail.php, it triggers an error/warning, and if it ends with _pass.php, it doesn't. Now that we're writing more sniffs, this testing system doesn't scale as it doesn't verify that _fail.php is failing due to that specific sniff, and same with _pass.php.

So we should be able to specify a specific sniff (possibly inferred via filename?) does or does not trigger an error.

Event Timeline

Legoktm created this task.Mar 15 2015, 12:11 AM
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 subscribers: Legoktm, Addshore.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 15 2015, 12:11 AM
Krinkle renamed this task from Improve phpcs testing framework to Improve test suite for mediawiki phpcs standard.Apr 1 2015, 4:00 AM
Krinkle set Security to None.

It may be better to go towards class based unittesting (example : and use assertEquals and so on to test whether functions perform correctly.

Each Unittest can supply specific chunks of text and give ti to phpcs through stdin.
This makes sense because each test you'd want smaller tests, to make sure each thing is working. So, something like printf "<?php\nif ( 0 ) {\n}" | phpcs can be run and checked

Change 237899 had a related patch set uploaded (by TasneemLo):
Tests: Revamp tests to UnitTests for each Sniff

Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 20 2015, 9:12 AM
TasneemLo removed TasneemLo as the assignee of this task.Dec 20 2015, 9:17 AM
Legoktm closed this task as Resolved.Nov 4 2017, 7:03 AM
Legoktm assigned this task to EBernhardson.

This was done a long time ago.

Change 237899 abandoned by Addshore:
Tests: Revamp tests to UnitTests for each Sniff