Improve code coverage

Add some parser tests, improve existing ones, and add missing @covers.

Bug: T201193
Change-Id: I9c0d2d83560baa4a3e1d4465b7919a48c4e26ac1
This commit is contained in:
Daimona Eaytoy 2018-08-22 18:50:15 +02:00
parent 46d78623f4
commit 447d434e2a
10 changed files with 29 additions and 3 deletions

View file

@ -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

View file

@ -0,0 +1 @@
MATCH

View 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'

View file

@ -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

View file

@ -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") &

View file

@ -30,6 +30,7 @@
* @covers AbuseFilterTokenizer
* @covers AFPToken
* @covers AFPUserVisibleException
* @covers AFPException
* @covers AbuseFilterParser
*/
class AFPDataTest extends MediaWikiTestCase {

View file

@ -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',

View file

@ -35,7 +35,10 @@
* @covers AbuseFilterTokenizer
* @covers AFPToken
* @covers AFPUserVisibleException
* @covers AFPException
* @covers AFPData
* @covers AbuseFilterVariableHolder
* @covers AFComputedVariable
*/
class AbuseFilterParserTest extends MediaWikiTestCase {
/**

View file

@ -29,6 +29,9 @@
* @group Database
*
* @covers AbuseFilter
* @covers AFPData
* @covers AbuseFilterVariableHolder
* @covers AFComputedVariable
*/
class AbuseFilterTest extends MediaWikiTestCase {
protected static $mUser, $mTitle, $mPage, $mVariables;

View file

@ -30,6 +30,7 @@
* @covers AFPToken
* @covers AbuseFilterParser
* @covers AFPUserVisibleException
* @covers AFPException
*/
class AbuseFilterTokenizerTest extends MediaWikiTestCase {
/**