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

LocaleTest::localeProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
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\Geography;
6
7
use PhpValueObjects\Tests\BaseUnitTestCase;
8
9 View Code Duplication
final class LocaleTest 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...
10
{
11
    public function localeProvider(): array
12
    {
13
        return [
14
            ['es_ES'],
15
            ['es_AR'],
16
            ['en_GB'],
17
            ['en_US'],
18
19
        ];
20
    }
21
    /**
22
     * @test
23
     * @dataProvider localeProvider
24
     */
25
    public function itShouldReturnLocale(string $locale): void
26
    {
27
        $localeVO = new Locale($locale);
28
29
        $this->assertSame($locale, $localeVO->value());
30
    }
31
32
    public function invalidLocaleProvider(): array
33
    {
34
        return [
35
            [$this->faker()->address],
36
            [$this->faker()->numberBetween()],
37
        ];
38
    }
39
40
    /**
41
     * @test
42
     * @dataProvider invalidLocaleProvider
43
     */
44
    public function itShouldThrowsException(string $locale): void
45
    {
46
        $this->expectException(\Exception::class);
47
48
        new Locale($locale);
49
    }
50
}
51