Completed
Push — master ( a85d22...dabb22 )
by Tobias
06:15
created

IntegrationTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 31.58 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 12
loc 38
rs 10
c 0
b 0
f 0

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Geocoder package.
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license    MIT License
11
 */
12
13
namespace Geocoder\Provider\MaxMindBinary\Tests;
14
15
use Geocoder\IntegrationTest\ProviderIntegrationTest;
16
use Geocoder\Provider\MaxMindBinary\MaxMindBinary;
17
use Http\Client\HttpClient;
18
19
/**
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
class IntegrationTest extends ProviderIntegrationTest
23
{
24
    protected $skippedTests = [
25
    ];
26
27
    protected $testAddress = false;
28
    protected $testReverse = false;
29
    protected $testIpv6 = false;
30
    protected $testHttpProvider = false;
31
32
    public static function setUpBeforeClass()
33
    {
34
        if (false == function_exists('geoip_open')) {
35
            self::markTestSkipped('The maxmind\'s official lib required to run these tests.');
36
        }
37
38
        if (false == function_exists('GeoIP_record_by_addr')) {
39
            self::markTestSkipped('The maxmind\'s official lib required to run these tests.');
40
        }
41
42
        parent::setUpBeforeClass();
43
    }
44
45
    protected function createProvider(HttpClient $httpClient)
46
    {
47
        return new MaxMindBinary(__DIR__.'/fixtures/GeoLiteCity.dat');
48
    }
49
50
    protected function getCacheDir()
51
    {
52
        return __DIR__.'/.cached_responses';
53
    }
54
55
    protected function getApiKey()
56
    {
57
        return null;
58
    }
59
}
60