Completed
Push — master ( 4a3e49...406f94 )
by Alejandro
16s queued 12s
created

alwaysReturnsAnEmptyLocation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\IpGeolocation\Resolver;
5
6
use PHPUnit\Framework\TestCase;
7
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
8
use Shlinkio\Shlink\IpGeolocation\Model\Location;
9
use Shlinkio\Shlink\IpGeolocation\Resolver\EmptyIpLocationResolver;
10
11
use function Functional\map;
12
use function range;
13
14
class EmptyIpLocationResolverTest extends TestCase
15
{
16
    use StringUtilsTrait;
17
18
    /** @var EmptyIpLocationResolver */
19
    private $resolver;
20
21
    public function setUp(): void
22
    {
23
        $this->resolver = new EmptyIpLocationResolver();
24
    }
25
26
    /**
27
     * @test
28
     * @dataProvider provideEmptyResponses
29
     */
30
    public function alwaysReturnsAnEmptyLocation(string $ipAddress): void
31
    {
32
        $this->assertEquals(Location::emptyInstance(), $this->resolver->resolveIpLocation($ipAddress));
33
    }
34
35
    public function provideEmptyResponses(): array
36
    {
37
        return map(range(0, 5), function () {
38
            return [$this->generateRandomString(15)];
39
        });
40
    }
41
}
42