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

WmsOverlayParserTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 2 Features 0
Metric Value
c 3
b 2
f 0
dl 0
loc 51
rs 10
wmc 6
lcom 0
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getParserClass() 0 3 1
A validInputProvider() 0 22 3
A requireDataValue() 0 3 1
A getInstance() 0 3 1
1
<?php
2
3
namespace Maps\Test;
4
5
use Maps\Elements\WmsOverlay;
6
use Maps\WmsOverlayParser;
7
8
/**
9
 * @covers Maps\WmsOverlayParser
10
 * @licence GNU GPL v2+
11
 * @author Mathias Mølster Lidal <[email protected]>
12
 */
13
class WmsOverlayParserTest extends \ValueParsers\Test\StringValueParserTest {
14
15
	/**
16
	 * @return string
17
	 */
18
	protected function getParserClass() {
19
		return WmsOverlayParser::class;
20
	}
21
22
	/**
23
	 * @see ValueParserTestBase::validInputProvider
24
	 *
25
	 * @return array
26
	 */
27
	public function validInputProvider() {
28
		$argLists = [];
29
30
		$valid = [
31
			"http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi? Foundation.GTOPO30" =>
32
				[ "http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?", "Foundation.GTOPO30" ],
33
			"http://maps.imr.no:80/geoserver/wms? vulnerable_areas:Identified_coral_area coral_identified_areas" =>
34
				[ "http://maps.imr.no:80/geoserver/wms?", "vulnerable_areas:Identified_coral_area", "coral_identified_areas" ]
35
		];
36
37
		foreach ( $valid as $value => $expected ) {
38
			$expectedOverlay = new WmsOverlay( $expected[0], $expected[1] );
39
40
			if ( count( $expected ) == 3 ) {
41
				$expectedOverlay->setWmsStyleName( $expected[2] );
42
			}
43
44
			$argLists[] = [ (string)$value, $expectedOverlay ];
45
		}
46
47
		return $argLists;
48
	}
49
50
	/**
51
	 * @see ValueParserTestBase::requireDataValue
52
	 *
53
	 * @return boolean
54
	 */
55
	protected function requireDataValue() {
56
		return false;
57
	}
58
59
	protected function getInstance() {
60
		return new WmsOverlayParser();
61
	}
62
63
}
64