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

Sha256Test::itShouldReturnSha256()   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 Sha256Test extends BaseUnitTestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function itShouldReturnSha256(): void
15
    {
16
        $sha256 = $this->faker()->sha256;
17
18
        $sha256VO = new Sha256($sha256);
19
20
        $this->assertSame($sha256, $sha256VO->value());
21
    }
22
23
    public function invalidSha256Provider(): array
24
    {
25
        return [
26
            [$this->faker()->md5],
27
            [$this->faker()->sha1],
28
            [$this->faker()->text],
29
        ];
30
    }
31
32
    /**
33
     * @test
34
     * @dataProvider invalidSha256Provider
35
     */
36
    public function itShouldThrowsException(string $data): void
37
    {
38
        $this->expectException(\Exception::class);
39
40
        new Sha256($data);
41
    }
42
}
43