LanguageCodeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A itShouldReturnLanguageCode() 0 8 1
A invalidLanguageCodeProvider() 0 7 1
A isShouldThrowsException() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpValueObjects\Tests\Geography;
6
7
use PhpValueObjects\Tests\BaseUnitTestCase;
8
9
final class LanguageCodeTest extends BaseUnitTestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function itShouldReturnLanguageCode(): void
15
    {
16
        $language = $this->faker()->languageCode;
17
18
        $langVO = new LanguageCode($language);
19
20
        $this->assertSame($language, $langVO->value());
21
    }
22
23
    public function invalidLanguageCodeProvider(): array
24
    {
25
        return [
26
            [$this->faker()->address],
27
            [$this->faker()->numberBetween()],
28
        ];
29
    }
30
31
    /**
32
     * @test
33
     * @dataProvider invalidLanguageCodeProvider
34
     */
35
    public function isShouldThrowsException(string $data): void
36
    {
37
        $this->expectException(\Exception::class);
38
39
        new LanguageCode($data);
40
    }
41
}
42