Skip to content

Commit 2edc274

Browse files
committed
laravel-5.5 の integer バリデータの結果を追加
1 parent 3f03b1e commit 2edc274

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/PositiveIntegerTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function testCtypeDigit($a, $ex) {
6060
* スペース含みが許可される
6161
* 正の整数に+符号が許可される
6262
* -1が許可される
63-
* PHP_INT_MAX +1, PHP_INT_MIN がおかしい
63+
* INT範囲外がNG
6464
* @dataProvider provideParams
6565
*/
6666
function testFilterVar($a, $ex) {
@@ -86,4 +86,21 @@ function testCake3($a, $ex) {
8686
function testIsGteZeroInteger($a, $ex) {
8787
$this->assertSame($ex, \Puyo\Util\Strings::isGteZeroInteger($a), "'$a'");
8888
}
89+
90+
/**
91+
* Laravel5.5 integer
92+
*
93+
* +-符号やスペースが許可される
94+
* INT範囲外がNG
95+
* @dataProvider provideParams
96+
*/
97+
function testLaravelInteger($a, $ex) {
98+
$loader = new \Illuminate\Translation\ArrayLoader();
99+
$translator = new \Illuminate\Translation\Translator($loader, 'ja');
100+
101+
$inputs = ['a' => $a];
102+
$rules = ['a' => 'integer'];
103+
$validator = new \Illuminate\Validation\Validator($translator, $inputs, $rules);
104+
$this->assertSame($ex, !$validator->fails(), "'$a'");
105+
}
89106
}

0 commit comments

Comments
 (0)