-
-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathRenavamTest.php
41 lines (33 loc) · 1.1 KB
/
RenavamTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace geekcom\ValidatorDocs\Tests\Rules;
use geekcom\ValidatorDocs\Rules\Renavam;
use geekcom\ValidatorDocs\Tests\ValidatorTestCase;
final class RenavamTest extends ValidatorTestCase
{
/**
* @test
*
* @dataProvider renavamProvider
*/
public function renavamValido($renavam, $esperado): void
{
$instance = new Renavam();
$atual = $instance->validateRenavam('', $renavam);
$this->assertSame($esperado, $atual, $renavam);
}
public function renavamProvider(): array
{
$correctValues = [32094074362, 23478829239, 34145742746, 41833820181, 63988496222];
$wrongValues = [11111111111, 32094074212, 62128843267];
return array_reduce(
array_merge($correctValues, $wrongValues),
function ($acc, $value) use ($correctValues) {
$key = "Renavam " . $value;
$testProperties = ['renavam' => $value, 'esperado' => in_array($value, $correctValues)];
$acc[$key] = $testProperties;
return $acc;
},
[]
);
}
}