3 namespace Wikimedia\ParamValidator\TypeDef
;
5 require_once __DIR__
. '/IntegerDefTest.php';
8 * @covers Wikimedia\ParamValidator\TypeDef\LimitDef
10 class LimitDefTest
extends IntegerDefTest
{
12 protected static $testClass = LimitDef
::class;
14 public function provideValidate() {
15 yield from parent
::provideValidate();
17 $useHigh = [ 'useHighLimits' => true ];
18 $max = [ IntegerDef
::PARAM_MAX
=> 2 ];
19 $max2 = [ IntegerDef
::PARAM_MAX
=> 2, IntegerDef
::PARAM_MAX2
=> 4 ];
21 yield
'Max' => [ 'max', 2, $max ];
22 yield
'Max, use high' => [ 'max', 2, $max, $useHigh ];
23 yield
'Max2' => [ 'max', 2, $max2 ];
24 yield
'Max2, use high' => [ 'max', 4, $max2, $useHigh ];
27 public function provideNormalizeSettings() {
29 [ [], [ IntegerDef
::PARAM_MIN
=> 0 ] ],
31 [ IntegerDef
::PARAM_MAX
=> 2 ],
32 [ IntegerDef
::PARAM_MAX
=> 2, IntegerDef
::PARAM_MIN
=> 0 ],
35 [ IntegerDef
::PARAM_MIN
=> 1, IntegerDef
::PARAM_MAX
=> 2, IntegerDef
::PARAM_MAX2
=> 4 ],
36 [ IntegerDef
::PARAM_MIN
=> 1, IntegerDef
::PARAM_MAX
=> 2, IntegerDef
::PARAM_MAX2
=> 4 ],
39 [ IntegerDef
::PARAM_MIN
=> 1, IntegerDef
::PARAM_MAX
=> 4, IntegerDef
::PARAM_MAX2
=> 2 ],
40 [ IntegerDef
::PARAM_MIN
=> 1, IntegerDef
::PARAM_MAX
=> 4, IntegerDef
::PARAM_MAX2
=> 4 ],
43 [ IntegerDef
::PARAM_MAX2
=> 2 ],
44 [ IntegerDef
::PARAM_MIN
=> 0 ],