GeodistanceTest::processingProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 9.408
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Tests\Integration\ParserHooks;
6
7
use DataValues\Geo\Values\LatLongValue;
8
use Maps\LegacyModel\Location;
9
use Maps\ParserHooks\GeoDistanceFunction;
10
11
/**
12
 * @covers GeoDistanceFunction
13
 *
14
 * @licence GNU GPL v2+
15
 * @author Jeroen De Dauw < [email protected] >
16
 */
17
class GeodistanceTest extends ParserHookTest {
18
19
	/**
20
	 * @see ParserHookTest::parametersProvider
21
	 */
22
	public function parametersProvider() {
23
		$paramLists = [];
24
25
		$paramLists[] = [
26
			'location1' => '4,2',
27
			'location2' => '42,0',
28
		];
29
30
		$paramLists[] = [
31
			'4,2',
32
			'42,0',
33
		];
34
35
		return $this->arrayWrap( $paramLists );
36
	}
37
38
	/**
39
	 * @see ParserHookTest::processingProvider
40
	 * @since 3.0
41
	 * @return array
42
	 */
43
	public function processingProvider() {
44
		$argLists = [];
45
46
		$values = [
47
			'location1' => '4,2',
48
			'location2' => '42,0',
49
		];
50
51
		$expected = [
52
			'location1' => new Location( new LatLongValue( 4, 2 ) ),
53
			'location2' => new Location( new LatLongValue( 42, 0 ) ),
54
		];
55
56
		$argLists[] = [ $values, $expected ];
57
58
		$values = [
59
			'location1' => '4,2',
60
			'location2' => '42,0',
61
			'unit' => '~=[,,_,,]:3',
62
			'decimals' => '1',
63
		];
64
65
		$expected = [
66
			'location1' => new Location( new LatLongValue( 4, 2 ) ),
67
			'location2' => new Location( new LatLongValue( 42, 0 ) ),
68
			'decimals' => 1,
69
		];
70
71
		$argLists[] = [ $values, $expected ];
72
73
		return $argLists;
74
	}
75
76
	/**
77
	 * @see ParserHookTest::getInstance
78
	 */
79
	protected function getInstance() {
80
		return new \Maps\ParserHooks\GeoDistanceFunction();
81
	}
82
83
}
84