Page MenuHomePhabricator

AbuseFilter needs regression tests
Closed, ResolvedPublic

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:08 AM
bzimport added a project: AbuseFilter.
bzimport set Reference to bz40478.
bzimport added a subscriber: Unknown Object (MLST).

Would this kind of test help us prevent unwanted side effects of changes such as T52107?

(In reply to comment #1)

Would this kind of test help us prevent unwanted side effects of changes such
as T52107?

and T54053...

He7d3r added a project: MediaWiki-Core-Tests.
He7d3r set Security to None.
He7d3r updated the task description. (Show Details)
matej_suchanek raised the priority of this task from Low to High.Apr 6 2018, 9:36 AM
matej_suchanek added a project: Test-Coverage.

Yeah, definitely time to think about this. I'm not familiar with phpunit but I'd love to give some help.

I think this needs a (much needed) overhaul of the way AbuseFilter is coded. Quoting @matej_suchanek from an email, the plan could be to split it to a new class (say, AbuseFilterRunner) and cover it with tests.

Change 443520 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] [WIP] Add phpunit tests for creating filters

https://gerrit.wikimedia.org/r/443520

Change 444191 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] [WIP] Add PHPUnit tests for various generic functions

https://gerrit.wikimedia.org/r/444191

This is what I'm progressively try to add as tests:

  1. Tests for all AFPUserVisibleException exceptions
  2. Tests for filter validation
  3. Tests for generic functions in AbuseFilter class
  4. Complete tests where filters are created, actions are executed and consequences must be taken.

Apart from the latter, everything is under review right now.

Change 444442 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] [WIP] Add tests for filter consequences

https://gerrit.wikimedia.org/r/444442

I think the above patches will provide a really good test background to start with, and should accomplish the goal of this task. Then, they may be expanded progressively.

Change 444442 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add tests for filter consequences

https://gerrit.wikimedia.org/r/444442

Change 443520 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add phpunit tests for creating and editing filters

https://gerrit.wikimedia.org/r/443520

Change 444191 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add PHPUnit tests for various generic functions

https://gerrit.wikimedia.org/r/444191

Daimona removed a project: Patch-For-Review.
Daimona updated the task description. (Show Details)

Now we have the base. The parent task is here to track further improvements.