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

Sha256Test   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A itShouldReturnSha256() 0 8 1
A invalidSha256Provider() 0 8 1
A itShouldThrowsException() 0 6 1
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