Skip to content

Commit

Permalink
add test for between validation rule (#42596)
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 authored May 31, 2022
1 parent 7326882 commit 6fb604f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2389,6 +2389,24 @@ public function testValidateBetween()
$v = new Validator($trans, ['foo' => '123'], ['foo' => 'Numeric|Between:50,100']);
$this->assertFalse($v->passes());

// inclusive on min
$v = new Validator($trans, ['foo' => '123'], ['foo' => 'Numeric|Between:123,200']);
$this->assertTrue($v->passes());

// inclusive on max
$v = new Validator($trans, ['foo' => '123'], ['foo' => 'Numeric|Between:0,123']);
$this->assertTrue($v->passes());

// can work with float
$v = new Validator($trans, ['foo' => '0.02'], ['foo' => 'Numeric|Between:0.01,0.02']);
$this->assertTrue($v->passes());

$v = new Validator($trans, ['foo' => '0.02'], ['foo' => 'Numeric|Between:0.01,0.03']);
$this->assertTrue($v->passes());

$v = new Validator($trans, ['foo' => '0.001'], ['foo' => 'Numeric|Between:0.01,0.03']);
$this->assertFalse($v->passes());

$v = new Validator($trans, ['foo' => '3'], ['foo' => 'Numeric|Between:1,5']);
$this->assertTrue($v->passes());

Expand Down

0 comments on commit 6fb604f

Please sign in to comment.