Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / ParamValidator / TypeDef / LimitDefTest.php
1 <?php
2
3 namespace Wikimedia\ParamValidator\TypeDef;
4
5 require_once __DIR__ . '/IntegerDefTest.php';
6
7 /**
8 * @covers Wikimedia\ParamValidator\TypeDef\LimitDef
9 */
10 class LimitDefTest extends IntegerDefTest {
11
12 protected static $testClass = LimitDef::class;
13
14 public function provideValidate() {
15 yield from parent::provideValidate();
16
17 $useHigh = [ 'useHighLimits' => true ];
18 $max = [ IntegerDef::PARAM_MAX => 2 ];
19 $max2 = [ IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MAX2 => 4 ];
20
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 ];
25 }
26
27 public function provideNormalizeSettings() {
28 return [
29 [ [], [ IntegerDef::PARAM_MIN => 0 ] ],
30 [
31 [ IntegerDef::PARAM_MAX => 2 ],
32 [ IntegerDef::PARAM_MAX => 2, IntegerDef::PARAM_MIN => 0 ],
33 ],
34 [
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 ],
37 ],
38 [
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 ],
41 ],
42 [
43 [ IntegerDef::PARAM_MAX2 => 2 ],
44 [ IntegerDef::PARAM_MIN => 0 ],
45 ],
46 ];
47 }
48
49 }