Completed
Push — address-as-title ( 601934...feca68 )
by Peter
09:00
created

LineParserTest::getParserClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Maps\Test;
4
5
use DataValues\Geo\Values\LatLongValue;
6
use Maps\Elements\Line;
7
use Maps\LineParser;
8
use ValueParsers\ValueParser;
9
10
/**
11
 * @covers Maps\LineParser
12
 * @licence GNU GPL v2+
13
 * @author Jeroen De Dauw < [email protected] >
14
 */
15
class LineParserTest extends \ValueParsers\Test\StringValueParserTest {
16
17
	/**
18
	 * @return string
19
	 */
20
	protected function getParserClass() {
21
		return LineParser::class;
22
	}
23
24
	/**
25
	 * @see ValueParserTestBase::validInputProvider
26
	 *
27
	 * @since 3.0
28
	 *
29
	 * @return array
30
	 */
31
	public function validInputProvider() {
32
		$argLists = [];
33
34
		$valid = [];
35
36
		$valid[] = [
37
			[
38
				42,
39
				4.2
40
			],
41
		];
42
43
		$valid[] = [
44
			[
45
				49.83798245308486,
46
				2.724609375
47
			],
48
			[
49
				52.05249047600102,
50
				8.26171875
51
			],
52
			[
53
				46.37725420510031,
54
				6.15234375
55
			],
56
			[
57
				49.83798245308486,
58
				2.724609375
59
			],
60
		];
61
62
		foreach ( $valid as $values ) {
63
			$input = [];
64
			$output = [];
65
66
			foreach ( $values as $value ) {
67
				$input[] = implode( ',', $value );
68
				$output[] = new LatLongValue( $value[0], $value[1] );
69
			}
70
71
			$input = implode( ':', $input );
72
73
			$argLists[] = [ $input, new Line( $output ) ];
74
		}
75
76
		return $argLists;
77
	}
78
79
	/**
80
	 * @see ValueParserTestBase::requireDataValue
81
	 *
82
	 * @since 3.0
83
	 *
84
	 * @return boolean
85
	 */
86
	protected function requireDataValue() {
87
		return false;
88
	}
89
90
	/**
91
	 * @since 0.1
92
	 *
93
	 * @return ValueParser
94
	 */
95
	protected function getInstance() {
96
		return new LineParser();
97
	}
98
99
}
100