Completed
Push — master ( ecb243...bb1b22 )
by Pablo
03:58
created

Md5Test::itShouldReturnMd5Hash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpValueObjects\Tests\Identity;
6
7
use PhpValueObjects\Tests\BaseUnitTestCase;
8
9
final class Md5Test extends BaseUnitTestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function itShouldReturnMd5Hash(): void
15
    {
16
        $md5Hash = $this->faker()->md5;
17
18
        $md5VO = new Md5($md5Hash);
19
20
        $this->assertSame($md5Hash, $md5VO->value());
21
    }
22
23
    public function invalidMd5HashProvider(): array
24
    {
25
        return [
26
            [$this->faker()->sha1],
27
            [$this->faker()->sha256],
28
            [$this->faker()->text],
29
        ];
30
    }
31
32
    /**
33
     * @test
34
     *
35
     * @dataProvider invalidMd5HashProvider
36
     */
37
    public function itShouldThrowsException(string $data): void
38
    {
39
        $this->expectException(\Exception::class);
40
41
        new Md5($data);
42
    }
43
}
44