Completed
Push — master ( 5c5dde...08bd4f )
by Alejandro
17s queued 10s
created

EmptyIpLocationResolverTest::alwaysReturnsAnEmptyResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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