Completed
Push — dvtest ( a10768 )
by Jeroen De
05:04
created

LineParserTest::getInstance()   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
c 1
b 1
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
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
	 * @see ValueParserTestBase::validInputProvider
19
	 *
20
	 * @since 3.0
21
	 *
22
	 * @return array
23
	 */
24
	public function validInputProvider() {
25
		$argLists = array();
26
27
		$valid = array();
28
29
		$valid[] = array(
30
			array(
31
				42,
32
				4.2
33
			),
34
		);
35
36
		$valid[] = array(
37
			array(
38
				49.83798245308486,
39
				2.724609375
40
			),
41
			array(
42
				52.05249047600102,
43
				8.26171875
44
			),
45
			array(
46
				46.37725420510031,
47
				6.15234375
48
			),
49
			array(
50
				49.83798245308486,
51
				2.724609375
52
			),
53
		);
54
55
		foreach ( $valid as $values ) {
56
			$input = array();
57
			$output = array();
58
59
			foreach ( $values as $value ) {
60
				$input[] = implode( ',', $value );
61
				$output[] = new LatLongValue( $value[0], $value[1] );
62
			}
63
64
			$input = implode( ':', $input );
65
66
			$argLists[] = array( $input, new Line( $output ) );
67
		}
68
69
		return $argLists;
70
	}
71
72
	/**
73
	 * @see ValueParserTestBase::requireDataValue
74
	 *
75
	 * @since 3.0
76
	 *
77
	 * @return boolean
78
	 */
79
	protected function requireDataValue() {
80
		return false;
81
	}
82
83
	/**
84
	 * @since 0.1
85
	 *
86
	 * @return ValueParser
87
	 */
88
	protected function getInstance() {
89
		return new LineParser();
90
	}
91
92
}
93