Skip to content

Commit 5e93f7c

Browse files
committed
Test DivisibleBy
1 parent b1c145c commit 5e93f7c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/Rules/DivisibleByTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Arifszn\AdvancedValidation\Tests\Rules;
4+
5+
use Arifszn\AdvancedValidation\Rules\DivisibleBy;
6+
use Arifszn\AdvancedValidation\Tests\TestCase;
7+
8+
class DivisibleByTest extends TestCase
9+
{
10+
/**
11+
* @dataProvider provider
12+
*/
13+
public function testValidation($result, $value)
14+
{
15+
$this->assertEquals($result, (new DivisibleBy(2))->passes('foo', $value));
16+
}
17+
18+
public function provider()
19+
{
20+
return [
21+
[true, '2'],
22+
[true, '4'],
23+
[true, '100'],
24+
[true, '1000'],
25+
26+
[false, '1'],
27+
[false, '2.5'],
28+
[false, '101'],
29+
[false, 'foo'],
30+
[false, ''],
31+
[false, '2020-01-06T14:31:00.135Z'],
32+
];
33+
}
34+
}

0 commit comments

Comments
 (0)