GeocodeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 50
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A parametersProvider() 0 9 1
A processingProvider() 0 16 1
A getInstance() 0 10 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Tests\Integration\ParserHooks;
6
7
use DataValues\Geo\Values\LatLongValue;
8
use Jeroen\SimpleGeocoder\Geocoders\InMemoryGeocoder;
9
use Maps\ParserHooks\GeocodeFunction;
10
11
/**
12
 * @covers GeocodeFunction
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class GeocodeTest extends ParserHookTest {
18
19
	/**
20
	 * @see ParserHookTest::parametersProvider
21
	 */
22
	public function parametersProvider() {
23
		$paramLists = [];
24
25
		$paramLists[] = [ 'location' => 'New York', '4, 2' ];
26
		$paramLists[] = [ 'location' => 'Brussels', '2, 3' ];
27
		$paramLists[] = [ 'location' => 'I am a tomato', 'Geocoding failed' ];
28
29
		return $this->arrayWrap( $paramLists );
30
	}
31
32
	/**
33
	 * @see ParserHookTest::processingProvider
34
	 */
35
	public function processingProvider() {
36
		$argLists = [];
37
38
		$argLists[] = [
39
			[
40
				'location' => '4,2',
41
				'directional' => 'yes',
42
			],
43
			[
44
				'location' => '4,2',
45
				'directional' => true,
46
			]
47
		];
48
49
		return $argLists;
50
	}
51
52
	/**
53
	 * @see ParserHookTest::getInstance
54
	 */
55
	protected function getInstance() {
56
		return new \Maps\ParserHooks\GeocodeFunction(
57
			new InMemoryGeocoder(
58
				[
59
					'New York' => new LatLongValue( 4, 2 ),
60
					'Brussels' => new LatLongValue( 2, 3 ),
61
				]
62
			)
63
		);
64
	}
65
66
}
67