Code Duplication    Length = 42-42 lines in 2 locations

src/PhpValueObjects/Tests/Geography/CountryCodeTest.php 1 location

@@ 10-51 (lines=42) @@
7
8
use PhpValueObjects\Tests\BaseUnitTestCase;
9
10
final class CountryCodeTest extends BaseUnitTestCase
11
{
12
    public function countryCodeProvider(): array
13
    {
14
        return [
15
            ['GB'],
16
            ['ES'],
17
            ['BA'],
18
            ['FR'],
19
        ];
20
    }
21
22
    /**
23
     * @test
24
     * @dataProvider countryCodeProvider
25
     */
26
    public function itShouldReturnCountryCode(string $country): void
27
    {
28
        $countryVO = new CountryCode($country);
29
30
        $this->assertSame($country, $countryVO->value());
31
    }
32
33
    public function invalidCountryCodeProvider(): array
34
    {
35
        return [
36
            [$this->faker()->address],
37
            [$this->faker()->numberBetween()]
38
        ];
39
    }
40
41
    /**
42
     * @test
43
     * @dataProvider invalidCountryCodeProvider
44
     */
45
    public function itShouldThrowsException(string $data): void
46
    {
47
        $this->expectException(\Exception::class);
48
49
        new CountryCode($data);
50
    }
51
}
52

src/PhpValueObjects/Tests/Geography/LocaleTest.php 1 location

@@ 9-50 (lines=42) @@
6
7
use PhpValueObjects\Tests\BaseUnitTestCase;
8
9
final class LocaleTest extends BaseUnitTestCase
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