Ensure that a min/max arg count is available for all built-in functions

This is especially useful for old patches, created before the
introduction of FUNC_ARG_COUNT, where a rebase may break the parser.

Change-Id: Ib142438626a7305f102dc3e4cc9cb07ad33902b8
This commit is contained in:
Daimona Eaytoy 2019-11-22 17:59:00 +01:00
parent a8c50150d6
commit 0672a8eb8a

View file

@ -1172,4 +1172,16 @@ class AbuseFilterParserTest extends AbuseFilterParserTestCase {
[ 'timestamp / 0.0', 'dividebyzero' ],
];
}
/**
* Ensure that every function in AbuseFilterParser::FUNCTIONS is also listed in
* AbuseFilterParser::FUNC_ARG_COUNT
*/
public function testAllFunctionsHaveArgCount() {
$funcs = array_keys( AbuseFilterParser::FUNCTIONS );
sort( $funcs );
$argsCount = array_keys( AbuseFilterParser::FUNC_ARG_COUNT );
sort( $argsCount );
$this->assertSame( $funcs, $argsCount );
}
}