Skip to content

Commit 26a3e75

Browse files
committed
test: add tests for exact_length
1 parent 8b1d9fc commit 26a3e75

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/system/Validation/RulesTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,10 @@ public function testMaxLengthReturnsFalseWithNonNumericVal(): void
398398

399399
/**
400400
* @dataProvider provideExactLength
401+
*
402+
* @param int|string|null $data
401403
*/
402-
public function testExactLength(?string $data, bool $expected): void
404+
public function testExactLength($data, bool $expected): void
403405
{
404406
$this->validation->setRules(['foo' => 'exact_length[3]']);
405407
$this->assertSame($expected, $this->validation->run(['foo' => $data]));
@@ -408,10 +410,13 @@ public function testExactLength(?string $data, bool $expected): void
408410
public static function provideExactLength(): iterable
409411
{
410412
yield from [
411-
'null' => [null, false],
412-
'exact' => ['bar', true],
413-
'less' => ['ba', false],
414-
'greater' => ['bars', false],
413+
'null' => [null, false],
414+
'exact' => ['bar', true],
415+
'exact_int' => [123, true],
416+
'less' => ['ba', false],
417+
'less_int' => [12, false],
418+
'greater' => ['bars', false],
419+
'greater_int' => [1234, false],
415420
];
416421
}
417422

0 commit comments

Comments
 (0)