@@ -57,9 +57,9 @@ |
||
| 57 | 57 | public function compareFormatProvider() |
| 58 | 58 | { |
| 59 | 59 | return [ |
| 60 | - [false, true, false, false], |
|
| 61 | - [123, false, true, false], |
|
| 62 | - ['abc', false, false, true], |
|
| 60 | + [false, true, false, false], |
|
| 61 | + [123, false, true, false], |
|
| 62 | + ['abc', false, false, true], |
|
| 63 | 63 | [new \stdClass(), false, false, false], |
| 64 | 64 | ]; |
| 65 | 65 | } |
@@ -18,7 +18,9 @@ discard block |
||
| 18 | 18 | { |
| 19 | 19 | $data = new Rules\IsBool(); |
| 20 | 20 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 21 | - if (!$resultBool) $this->expectException(RuleException::class); |
|
| 21 | + if (!$resultBool) { |
|
| 22 | + $this->expectException(RuleException::class); |
|
| 23 | + } |
|
| 22 | 24 | $data->validate(MockEntry::init('foo', $value)); |
| 23 | 25 | } |
| 24 | 26 | |
@@ -34,7 +36,9 @@ discard block |
||
| 34 | 36 | { |
| 35 | 37 | $data = new Rules\IsNumeric(); |
| 36 | 38 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 37 | - if (!$resultNum) $this->expectException(RuleException::class); |
|
| 39 | + if (!$resultNum) { |
|
| 40 | + $this->expectException(RuleException::class); |
|
| 41 | + } |
|
| 38 | 42 | $data->validate(MockEntry::init('foo', $value)); |
| 39 | 43 | } |
| 40 | 44 | |
@@ -50,7 +54,9 @@ discard block |
||
| 50 | 54 | { |
| 51 | 55 | $data = new Rules\IsString(); |
| 52 | 56 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 53 | - if (!$resultStr) $this->expectException(RuleException::class); |
|
| 57 | + if (!$resultStr) { |
|
| 58 | + $this->expectException(RuleException::class); |
|
| 59 | + } |
|
| 54 | 60 | $data->validate(MockEntry::init('foo', $value)); |
| 55 | 61 | } |
| 56 | 62 | |
@@ -63,9 +63,9 @@ |
||
| 63 | 63 | public function compareLenProvider() |
| 64 | 64 | { |
| 65 | 65 | return [ |
| 66 | - ['yxcvbnm', 8, false, false, true ], |
|
| 67 | - ['asdfghjk', 8, true, true, true ], |
|
| 68 | - ['qwertutop', 8, true, false, false], |
|
| 66 | + ['yxcvbnm', 8, false, false, true], |
|
| 67 | + ['asdfghjk', 8, true, true, true], |
|
| 68 | + ['qwertutop', 8, true, false, false], |
|
| 69 | 69 | ]; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $data = new Rules\LengthMin(); |
| 21 | 21 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 22 | 22 | $data->setAgainstValue($length); |
| 23 | - if (!$passMin) $this->expectException(RuleException::class); |
|
| 23 | + if (!$passMin) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate(MockEntry::init('foo', $value)); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $data = new Rules\LengthEquals(); |
| 39 | 41 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 40 | 42 | $data->setAgainstValue($length); |
| 41 | - if (!$passEq) $this->expectException(RuleException::class); |
|
| 43 | + if (!$passEq) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate(MockEntry::init('foo', $value)); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -56,7 +60,9 @@ discard block |
||
| 56 | 60 | $data = new Rules\LengthMax(); |
| 57 | 61 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 58 | 62 | $data->setAgainstValue($length); |
| 59 | - if (!$passMax) $this->expectException(RuleException::class); |
|
| 63 | + if (!$passMax) { |
|
| 64 | + $this->expectException(RuleException::class); |
|
| 65 | + } |
|
| 60 | 66 | $data->validate(MockEntry::init('foo', $value)); |
| 61 | 67 | } |
| 62 | 68 | |
@@ -91,11 +91,11 @@ |
||
| 91 | 91 | return [ |
| 92 | 92 | ['5', '7', true, false], |
| 93 | 93 | [[new \stdClass()], '7', true, false], |
| 94 | - [[1,3,5,9], '7', false, false], |
|
| 95 | - [[1,3,5,9], '5', false, true], |
|
| 96 | - [['2','4','6','8'], 6, false, true], |
|
| 97 | - [['abc','def','ghi','jkl'], 'mno', false, false], |
|
| 98 | - [['abc','def','ghi','jkl'], 'def', false, true], |
|
| 94 | + [[1, 3, 5, 9], '7', false, false], |
|
| 95 | + [[1, 3, 5, 9], '5', false, true], |
|
| 96 | + [['2', '4', '6', '8'], 6, false, true], |
|
| 97 | + [['abc', 'def', 'ghi', 'jkl'], 'mno', false, false], |
|
| 98 | + [['abc', 'def', 'ghi', 'jkl'], 'def', false, true], |
|
| 99 | 99 | ]; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 23 | 23 | |
| 24 | 24 | $mock = MockEntry::init($key, $checkValue); |
| 25 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 25 | + if (!$gotResult) { |
|
| 26 | + $this->expectException(RuleException::class); |
|
| 27 | + } |
|
| 26 | 28 | $data->validate($mock); |
| 27 | 29 | } |
| 28 | 30 | |
@@ -40,7 +42,9 @@ discard block |
||
| 40 | 42 | $data->setAgainstValue($expectedValue); |
| 41 | 43 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 42 | 44 | $mock = MockEntry::init($key, $checkValue); |
| 43 | - if ($gotResult) $this->expectException(RuleException::class); |
|
| 45 | + if ($gotResult) { |
|
| 46 | + $this->expectException(RuleException::class); |
|
| 47 | + } |
|
| 44 | 48 | $data->validate($mock); |
| 45 | 49 | } |
| 46 | 50 | |
@@ -56,11 +60,15 @@ discard block |
||
| 56 | 60 | { |
| 57 | 61 | $data = new Rules\IsInArray(); |
| 58 | 62 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 59 | - if ($gotError) $this->expectException(RuleException::class); |
|
| 63 | + if ($gotError) { |
|
| 64 | + $this->expectException(RuleException::class); |
|
| 65 | + } |
|
| 60 | 66 | $data->setAgainstValue($expectedValues); |
| 61 | 67 | if (!$gotError) { |
| 62 | 68 | $mock = MockEntry::init('foo', $checkValue); |
| 63 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 69 | + if (!$gotResult) { |
|
| 70 | + $this->expectException(RuleException::class); |
|
| 71 | + } |
|
| 64 | 72 | $data->validate($mock); |
| 65 | 73 | } |
| 66 | 74 | } |
@@ -77,11 +85,15 @@ discard block |
||
| 77 | 85 | { |
| 78 | 86 | $data = new Rules\IsNotInArray(); |
| 79 | 87 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 80 | - if ($gotError) $this->expectException(RuleException::class); |
|
| 88 | + if ($gotError) { |
|
| 89 | + $this->expectException(RuleException::class); |
|
| 90 | + } |
|
| 81 | 91 | $data->setAgainstValue($expectedValues); |
| 82 | 92 | if (!$gotError) { |
| 83 | 93 | $mock = MockEntry::init('foo', $checkValue); |
| 84 | - if ($gotResult) $this->expectException(RuleException::class); |
|
| 94 | + if ($gotResult) { |
|
| 95 | + $this->expectException(RuleException::class); |
|
| 96 | + } |
|
| 85 | 97 | $data->validate($mock); |
| 86 | 98 | } |
| 87 | 99 | } |
@@ -112,7 +124,9 @@ discard block |
||
| 112 | 124 | $data->setAgainstValue($expectedValue); |
| 113 | 125 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 114 | 126 | $mock = MockEntry::init('foo', $checkValue); |
| 115 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 127 | + if (!$gotResult) { |
|
| 128 | + $this->expectException(RuleException::class); |
|
| 129 | + } |
|
| 116 | 130 | $data->validate($mock); |
| 117 | 131 | } |
| 118 | 132 | |
@@ -129,7 +143,9 @@ discard block |
||
| 129 | 143 | $data->setAgainstValue($expectedValue); |
| 130 | 144 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 131 | 145 | $mock = MockEntry::init('foo', $checkValue); |
| 132 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 146 | + if (!$gotResult) { |
|
| 147 | + $this->expectException(RuleException::class); |
|
| 148 | + } |
|
| 133 | 149 | $data->validate($mock); |
| 134 | 150 | } |
| 135 | 151 | |
@@ -146,7 +162,9 @@ discard block |
||
| 146 | 162 | $data->setAgainstValue($expectedValue); |
| 147 | 163 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 148 | 164 | $mock = MockEntry::init('foo', $checkValue); |
| 149 | - if ($gotResult) $this->expectException(RuleException::class); |
|
| 165 | + if ($gotResult) { |
|
| 166 | + $this->expectException(RuleException::class); |
|
| 167 | + } |
|
| 150 | 168 | $data->validate($mock); |
| 151 | 169 | } |
| 152 | 170 | |
@@ -163,7 +181,9 @@ discard block |
||
| 163 | 181 | $data->setAgainstValue($expectedValue); |
| 164 | 182 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 165 | 183 | $mock = MockEntry::init('foo', $checkValue); |
| 166 | - if ($gotResult) $this->expectException(RuleException::class); |
|
| 184 | + if ($gotResult) { |
|
| 185 | + $this->expectException(RuleException::class); |
|
| 186 | + } |
|
| 167 | 187 | $data->validate($mock); |
| 168 | 188 | } |
| 169 | 189 | |
@@ -211,7 +231,9 @@ discard block |
||
| 211 | 231 | $data = new Rules\IsEmpty(); |
| 212 | 232 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 213 | 233 | $mock = MockEntry::init('foo', $checkValue); |
| 214 | - if ($gotResult) $this->expectException(RuleException::class); |
|
| 234 | + if ($gotResult) { |
|
| 235 | + $this->expectException(RuleException::class); |
|
| 236 | + } |
|
| 215 | 237 | $data->validate($mock); |
| 216 | 238 | } |
| 217 | 239 | |
@@ -226,7 +248,9 @@ discard block |
||
| 226 | 248 | $data = new Rules\IsFilled(); |
| 227 | 249 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 228 | 250 | $mock = MockEntry::init('foo', $checkValue); |
| 229 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 251 | + if (!$gotResult) { |
|
| 252 | + $this->expectException(RuleException::class); |
|
| 253 | + } |
|
| 230 | 254 | $data->validate($mock); |
| 231 | 255 | } |
| 232 | 256 | |
@@ -252,7 +276,9 @@ discard block |
||
| 252 | 276 | $data = new Rules\IsJsonString(); |
| 253 | 277 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 254 | 278 | $mock = MockEntry::init('foo', $checkValue); |
| 255 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 279 | + if (!$gotResult) { |
|
| 280 | + $this->expectException(RuleException::class); |
|
| 281 | + } |
|
| 256 | 282 | $data->validate($mock); |
| 257 | 283 | } |
| 258 | 284 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\File\AFileRule', $data); |
| 80 | 80 | $data->setAgainstValue($maxSize); |
| 81 | 81 | $mock = MockFile::init('foo', 'text0.txt', 'text/plain', |
| 82 | - '', $fileSize, UPLOAD_ERR_OK ); |
|
| 82 | + '', $fileSize, UPLOAD_ERR_OK); |
|
| 83 | 83 | if (!$match) $this->expectException(RuleException::class); |
| 84 | 84 | $data->validate($mock); |
| 85 | 85 | } |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | public function sizeMatchProvider() |
| 88 | 88 | { |
| 89 | 89 | return [ |
| 90 | - ['32', 128, false], |
|
| 90 | + ['32', 128, false], |
|
| 91 | 91 | ['10g', 46843, true], |
| 92 | 92 | ['15m', 84641, true], |
| 93 | - ['30k', 3534, true], |
|
| 93 | + ['30k', 3534, true], |
|
| 94 | 94 | ['30k', 35534, false], |
| 95 | 95 | ]; |
| 96 | 96 | } |
@@ -80,7 +80,9 @@ |
||
| 80 | 80 | $data->setAgainstValue($maxSize); |
| 81 | 81 | $mock = MockFile::init('foo', 'text0.txt', 'text/plain', |
| 82 | 82 | '', $fileSize, UPLOAD_ERR_OK ); |
| 83 | - if (!$match) $this->expectException(RuleException::class); |
|
| 83 | + if (!$match) { |
|
| 84 | + $this->expectException(RuleException::class); |
|
| 85 | + } |
|
| 84 | 86 | $data->validate($mock); |
| 85 | 87 | } |
| 86 | 88 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | public function stringsProvider() |
| 46 | 46 | { |
| 47 | 47 | return [ |
| 48 | - ['[email protected]', true, false], |
|
| 49 | - ['[email protected]', true, false], |
|
| 48 | + ['[email protected]', true, false], |
|
| 49 | + ['[email protected]', true, false], |
|
| 50 | 50 | ['foo@[email protected]', false, false], |
| 51 | - ['6', false, false], |
|
| 52 | - ['bar.example', false, true ], |
|
| 51 | + ['6', false, false], |
|
| 52 | + ['bar.example', false, true], |
|
| 53 | 53 | ['foo.bar.baz.example', false, false], |
| 54 | 54 | ]; |
| 55 | 55 | } |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 21 | 21 | |
| 22 | 22 | $mock = MockEntry::init('foo', $checkValue); |
| 23 | - if (!$isEmail) $this->expectException(RuleException::class); |
|
| 23 | + if (!$isEmail) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate($mock); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 39 | 41 | |
| 40 | 42 | $mock = MockEntry::init('foo', $checkValue); |
| 41 | - if (!$isDomain) $this->expectException(RuleException::class); |
|
| 43 | + if (!$isDomain) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate($mock); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -20,7 +20,9 @@ discard block |
||
| 20 | 20 | $data->setAgainstValue($expectedValue); |
| 21 | 21 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 22 | 22 | $mock = MockEntry::init($key, $checkValue); |
| 23 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 23 | + if (!$gotResult) { |
|
| 24 | + $this->expectException(RuleException::class); |
|
| 25 | + } |
|
| 24 | 26 | $data->validate($mock); |
| 25 | 27 | } |
| 26 | 28 | |
@@ -38,7 +40,9 @@ discard block |
||
| 38 | 40 | $data->setAgainstValue($expectedValue); |
| 39 | 41 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 40 | 42 | $mock = MockEntry::init($key, $checkValue); |
| 41 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 43 | + if (!$gotResult) { |
|
| 44 | + $this->expectException(RuleException::class); |
|
| 45 | + } |
|
| 42 | 46 | $data->validate($mock); |
| 43 | 47 | } |
| 44 | 48 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | [123, '', false, false], |
| 36 | 36 | ['asdf', '', false, false], |
| 37 | 37 | ['CallbackRulesTest::callMeStatic', null, true, false], |
| 38 | - ['CallbackRulesTest::callMeStatic', 1, true, true ], |
|
| 38 | + ['CallbackRulesTest::callMeStatic', 1, true, true], |
|
| 39 | 39 | [[$this, 'callMeDynamic'], null, true, false], |
| 40 | 40 | [[$this, 'callMeDynamic'], 1, true, true], |
| 41 | 41 | ]; |
@@ -18,11 +18,15 @@ |
||
| 18 | 18 | { |
| 19 | 19 | $data = new Rules\ProcessCallback(); |
| 20 | 20 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 21 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 21 | + if (!$gotResult) { |
|
| 22 | + $this->expectException(RuleException::class); |
|
| 23 | + } |
|
| 22 | 24 | $data->setAgainstValue($expectedCall); |
| 23 | 25 | if ($gotResult) { |
| 24 | 26 | $mock = MockEntry::init('foo', $checkValue); |
| 25 | - if (!$pass) $this->expectException(RuleException::class); |
|
| 27 | + if (!$pass) { |
|
| 28 | + $this->expectException(RuleException::class); |
|
| 29 | + } |
|
| 26 | 30 | $data->validate($mock); |
| 27 | 31 | } |
| 28 | 32 | } |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 70 | 70 | |
| 71 | 71 | $mock = MockEntry::init('foo', 'bar'); |
| 72 | - if (!$matchAll) $this->expectException(RuleException::class); |
|
| 72 | + if (!$matchAll) { |
|
| 73 | + $this->expectException(RuleException::class); |
|
| 74 | + } |
|
| 73 | 75 | $data->validate($mock); |
| 74 | 76 | } |
| 75 | 77 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | $data->setAgainstValue($expectedValue); |
| 87 | 89 | $this->assertInstanceOf('\kalanis\kw_rules\Rules\ARule', $data); |
| 88 | 90 | $mock = MockEntry::init('foo', 'bar'); |
| 89 | - if (!$matchAny) $this->expectException(RuleException::class); |
|
| 91 | + if (!$matchAny) { |
|
| 92 | + $this->expectException(RuleException::class); |
|
| 93 | + } |
|
| 90 | 94 | $data->validate($mock); |
| 91 | 95 | } |
| 92 | 96 | |
@@ -25,9 +25,13 @@ |
||
| 25 | 25 | public function testFileFactoryAvailability(string $rule, bool $gotResult) |
| 26 | 26 | { |
| 27 | 27 | $factory = new Rules\File\Factory(); |
| 28 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
| 28 | + if (!$gotResult) { |
|
| 29 | + $this->expectException(RuleException::class); |
|
| 30 | + } |
|
| 29 | 31 | $data = $factory->getRule($rule); |
| 30 | - if ($data) $this->assertInstanceOf('\kalanis\kw_rules\Rules\File\AFileRule', $data); |
|
| 32 | + if ($data) { |
|
| 33 | + $this->assertInstanceOf('\kalanis\kw_rules\Rules\File\AFileRule', $data); |
|
| 34 | + } |
|
| 31 | 35 | } |
| 32 | 36 | |
| 33 | 37 | public function inputFilesProvider() |