IntegrationTest::createProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Geocoder package.
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @license    MIT License
9
 */
10
11
namespace Geocoder\Provider\IP2Location\Tests;
12
13
use Geocoder\IntegrationTest\ProviderIntegrationTest;
14
use Geocoder\Provider\IP2Location\IP2Location;
15
use Http\Client\HttpClient;
16
17
/**
18
 * @author IP2Location <[email protected]>
19
 */
20
class IntegrationTest extends ProviderIntegrationTest
21
{
22
    protected $testAddress = false;
23
24
    protected $testReverse = false;
25
26
    protected function createProvider(HttpClient $httpClient)
27
    {
28
        return new IP2Location($httpClient, $this->getApiKey());
29
    }
30
31
    protected function getCacheDir()
32
    {
33
        return __DIR__.'/.cached_responses';
34
    }
35
36
    protected function getApiKey()
37
    {
38
        if (!isset($_SERVER['IP2Location_API_KEY'])) {
39
            $this->markTestSkipped('No IP2Location API key');
40
        }
41
42
        return $_SERVER['IP2Location_API_KEY'];
43
    }
44
}
45