EnumTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A itShouldThrowInvalidEnumException() 0 5 1
A itShouldReturnEnumValue() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace PhpValueObjects\Tests\Identity;
5
6
use PhpValueObjects\Tests\BaseUnitTestCase;
7
8
class EnumTest extends BaseUnitTestCase
9
{
10
    /**
11
     * @test
12
     */
13
    public function itShouldThrowInvalidEnumException(): void
14
    {
15
        $this->expectException(\Exception::class);
16
        new Enum('invalid');
17
    }
18
19
    /**
20
     * @test
21
     */
22
    public function itShouldReturnEnumValue(): void
23
    {
24
        $data = Enum::VALID;
25
        $value = new Enum($data);
26
27
        $this->assertSame($data, $value->value());
28
    }
29
}
30