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
|
|
|
public function setUp() { |
16
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) { |
17
|
|
|
$this->markTestSkipped( 'MediaWiki is not available' ); |
18
|
|
|
} |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @return string |
23
|
|
|
*/ |
24
|
|
|
protected function getParserClass() { |
25
|
|
|
return WmsOverlayParser::class; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @see ValueParserTestBase::validInputProvider |
30
|
|
|
* |
31
|
|
|
* @return array |
32
|
|
|
*/ |
33
|
|
|
public function validInputProvider() { |
34
|
|
|
$argLists = []; |
35
|
|
|
|
36
|
|
|
$valid = [ |
37
|
|
|
"http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi? Foundation.GTOPO30" => |
38
|
|
|
[ "http://demo.cubewerx.com/demo/cubeserv/cubeserv.cgi?", "Foundation.GTOPO30" ], |
39
|
|
|
"http://maps.imr.no:80/geoserver/wms? vulnerable_areas:Identified_coral_area coral_identified_areas" => |
40
|
|
|
[ "http://maps.imr.no:80/geoserver/wms?", "vulnerable_areas:Identified_coral_area", "coral_identified_areas" ] |
41
|
|
|
]; |
42
|
|
|
|
43
|
|
|
foreach ( $valid as $value => $expected ) { |
44
|
|
|
$expectedOverlay = new WmsOverlay( $expected[0], $expected[1] ); |
45
|
|
|
|
46
|
|
|
if ( count( $expected ) == 3 ) { |
47
|
|
|
$expectedOverlay->setWmsStyleName( $expected[2] ); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
$argLists[] = [ (string)$value, $expectedOverlay ]; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return $argLists; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @see ValueParserTestBase::requireDataValue |
58
|
|
|
* |
59
|
|
|
* @return boolean |
60
|
|
|
*/ |
61
|
|
|
protected function requireDataValue() { |
62
|
|
|
return false; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
protected function getInstance() { |
66
|
|
|
return new WmsOverlayParser(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
} |
70
|
|
|
|