mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 13:46:48 +00:00
Improve code coverage
Add some parser tests, improve existing ones, and add missing @covers. Bug: T201193 Change-Id: I9c0d2d83560baa4a3e1d4465b7919a48c4e26ac1
This commit is contained in:
parent
46d78623f4
commit
447d434e2a
|
@ -11,4 +11,5 @@ j := [1];
|
|||
k := ['1'];
|
||||
l := [];
|
||||
|
||||
a == b & a === b & a != c & b != d & a == e & a !== e & f == g & f !== g & h == i & h !== i & e != i & j != 1 & k != '1' & l == false & l == null
|
||||
a == b & a === b & a != c & b != d & a == e & a !== e & f == g & f !== g & h == i & h !== i & e != i & j != 1 &
|
||||
k != '1' & l == false & l == null & l !== false & l !== null & false == l & null == l & false !== l & null !== l
|
||||
|
|
1
tests/parserTests/concatenation.r
Normal file
1
tests/parserTests/concatenation.r
Normal file
|
@ -0,0 +1 @@
|
|||
MATCH
|
7
tests/parserTests/concatenation.t
Normal file
7
tests/parserTests/concatenation.t
Normal file
|
@ -0,0 +1,7 @@
|
|||
'foo' + 'bar' === 'foobar' &
|
||||
'' + 'foo' + '' === 'foo' &
|
||||
'foo' + ' ' + 'bar' === 'foo bar' &
|
||||
'foo' + 234 === 'foo234' &
|
||||
452 + 'foo' === '452foo' &
|
||||
'foo' + false === 'foo' &
|
||||
'foo' + [ 'bar', 'foo' ] === 'foobar\nfoo\n'
|
|
@ -1 +1,7 @@
|
|||
"quux" contains "ux" & ['1', 'foo'] contains '1' & !('fo obar' contains 'foo') & ['foo'] contains 'f'
|
||||
"quux" contains "ux" &
|
||||
['1', 'foo'] contains '1' &
|
||||
'fo obar' contains 'foo' === false &
|
||||
['foo'] contains 'f' &
|
||||
'' contains 'a' === false &
|
||||
'a' contains '' === false &
|
||||
'' contains '' === false
|
|
@ -3,6 +3,7 @@
|
|||
("1234" like "12?4") &
|
||||
("1234" like "12*") &
|
||||
("foo" in "foobar") &
|
||||
("foobar" contains "foo") &
|
||||
("o" in ["foo", "bar"]) &
|
||||
("foo" regex "\w+") &
|
||||
("a\b" regex "a\\\\b") &
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
* @covers AbuseFilterTokenizer
|
||||
* @covers AFPToken
|
||||
* @covers AFPUserVisibleException
|
||||
* @covers AFPException
|
||||
* @covers AbuseFilterParser
|
||||
*/
|
||||
class AFPDataTest extends MediaWikiTestCase {
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
* @covers AFPData
|
||||
* @covers AbuseFilterTokenizer
|
||||
* @covers AFPToken
|
||||
* @covers AbuseFilterVariableHolder
|
||||
* @covers AFComputedVariable
|
||||
*/
|
||||
class AbuseFilterConsequencesTest extends MediaWikiTestCase {
|
||||
protected static $mUser;
|
||||
|
@ -763,7 +765,7 @@ class AbuseFilterConsequencesTest extends MediaWikiTestCase {
|
|||
[ 'block' => [ 12 ], 'degroup' => [ 7, 12 ] ]
|
||||
],
|
||||
[
|
||||
'Test to check that every throttled filter only execute "safe" actions.',
|
||||
'Test to check that every throttled filter only executes "safe" actions.',
|
||||
[ 10, 13 ],
|
||||
[
|
||||
'edit',
|
||||
|
|
|
@ -35,7 +35,10 @@
|
|||
* @covers AbuseFilterTokenizer
|
||||
* @covers AFPToken
|
||||
* @covers AFPUserVisibleException
|
||||
* @covers AFPException
|
||||
* @covers AFPData
|
||||
* @covers AbuseFilterVariableHolder
|
||||
* @covers AFComputedVariable
|
||||
*/
|
||||
class AbuseFilterParserTest extends MediaWikiTestCase {
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
* @group Database
|
||||
*
|
||||
* @covers AbuseFilter
|
||||
* @covers AFPData
|
||||
* @covers AbuseFilterVariableHolder
|
||||
* @covers AFComputedVariable
|
||||
*/
|
||||
class AbuseFilterTest extends MediaWikiTestCase {
|
||||
protected static $mUser, $mTitle, $mPage, $mVariables;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
* @covers AFPToken
|
||||
* @covers AbuseFilterParser
|
||||
* @covers AFPUserVisibleException
|
||||
* @covers AFPException
|
||||
*/
|
||||
class AbuseFilterTokenizerTest extends MediaWikiTestCase {
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue