Completed
Push — master ( f0faac...5bd571 )
by Pablo
02:41
created

Sha1ValueObjectTest::itShouldReturnSha1()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 9
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace PhpValueObjects\Tests\Identity;
4
5
use PhpValueObjects\Identity\Exception\InvalidSha1Exception;
6
use PhpValueObjects\Tests\BaseUnitTestCase;
7
8 View Code Duplication
class Sha1ValueObjectTest extends BaseUnitTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @test
12
     */
13
    public function itShouldReturnSha1()
14
    {
15
        $sha1 = $this->faker()->sha1;
16
17
        $sha1VO = new Sha1ValueObject($sha1);
18
19
        $this->assertSame($sha1, $sha1VO->value());
20
        $this->assertSame($sha1, $sha1VO->__toString());
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function invalidSha1Provider()
27
    {
28
        return [
29
            [null],
30
            [$this->faker()->md5],
31
            [$this->faker()->sha256],
32
            [$this->faker()->text],
33
        ];
34
    }
35
36
    /**
37
     * @test
38
     *
39
     * @dataProvider invalidSha1Provider
40
     */
41
    public function itShouldThrowsException($data)
42
    {
43
        $this->expectException(InvalidSha1Exception::class);
44
45
        new Sha1ValueObject($data);
46
    }
47
}
48