Completed
Push — master ( 4d908f...fa6950 )
by Tobias
07:21
created

AbstractHttpProviderTest::testHttpClientGetter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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\Http\Provider\Tests;
14
15
use Geocoder\Collection;
16
use Geocoder\Http\Provider\AbstractHttpProvider;
17
use Geocoder\Model\AddressCollection;
18
use Geocoder\Query\GeocodeQuery;
19
use Geocoder\Query\ReverseQuery;
20
use Http\Client\HttpClient;
21
use Http\Mock\Client;
22
use PHPUnit\Framework\TestCase;
23
24
class AbstractHttpProviderTest extends TestCase
25
{
26
    public function testHttpClientGetter()
27
    {
28
        $client = $this->getMockBuilder(Client::class)->disableOriginalConstructor()->getMock();
29
        $provider = new DummyProvider($client);
30
        $this->assertSame($client, $provider->getHttpClient());
31
    }
32
}
33
34
class DummyProvider extends AbstractHttpProvider
35
{
36
    public function getHttpClient(): HttpClient
37
    {
38
        return parent::getHttpClient();
39
    }
40
41
    public function geocodeQuery(GeocodeQuery $query): Collection
42
    {
43
        return new AddressCollection([]);
44
    }
45
46
    public function reverseQuery(ReverseQuery $query): Collection
47
    {
48
        return new AddressCollection([]);
49
    }
50
51
    public function getName(): string
52
    {
53
        return 'dummy';
54
    }
55
}
56