Completed
Pull Request — master (#130)
by None
07:05
created

DistanceParserTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 4
c 2
b 1
f 1
lcom 0
cbo 1
dl 0
loc 50
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A validInputProvider() 0 17 2
A getParserClass() 0 3 1
A requireDataValue() 0 3 1
1
<?php
2
3
namespace Maps\Test;
4
5
/**
6
 * @covers Maps\DistanceParser
7
 * @licence GNU GPL v2+
8
 * @author Jeroen De Dauw < [email protected] >
9
 */
10
class DistanceParserTest extends \ValueParsers\Test\StringValueParserTest {
0 ignored issues
show
Bug introduced by
There is one abstract method getInstance in this class; you could implement it, or declare this class as abstract.
Loading history...
11
12
	/**
13
	 * @see ValueParserTestBase::validInputProvider
14
	 *
15
	 * @since 3.0
16
	 *
17
	 * @return array
18
	 */
19
	public function validInputProvider() {
20
		$argLists = array();
21
22
		$valid = array(
23
			'1' => 1,
24
			'1m' => 1,
25
			'42 km' => 42000,
26
			'4.2 km' => 4200,
27
			'4.2 m' => 4.2,
28
		);
29
30
		foreach ( $valid as $value => $expected ) {
31
			$argLists[] = array( (string)$value, $expected );
32
		}
33
34
		return $argLists;
35
	}
36
37
	/**
38
	 * @see ValueParserTestBase::getParserClass
39
	 *
40
	 * @since 3.0
41
	 *
42
	 * @return string
43
	 */
44
	protected function getParserClass() {
45
		return 'Maps\DistanceParser';
46
	}
47
48
	/**
49
	 * @see ValueParserTestBase::requireDataValue
50
	 *
51
	 * @since 3.0
52
	 *
53
	 * @return boolean
54
	 */
55
	protected function requireDataValue() {
56
		return false;
57
	}
58
59
}
60