Completed
Push — MediaWikiFileUrlFinderTest ( d58bee...394f02 )
by Jeroen De
08:48
created

GeocodeTest   A

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