1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class MappableDataTest extends SapphireTest { |
4
|
|
|
|
5
|
|
|
public function setUpOnce() { |
6
|
|
|
$this->requiredExtensions = array( |
7
|
|
|
'Member' => array('MapExtension') |
8
|
|
|
); |
9
|
|
|
parent::setupOnce(); |
10
|
|
|
} |
11
|
|
|
|
12
|
|
|
|
13
|
|
|
|
14
|
|
|
public function testGetRenderableMap() { |
15
|
|
|
$this->markTestSkipped('TODO'); |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
public function testSetMarkerTemplateValues() { |
20
|
|
|
$instance = $this->getInstance(); |
21
|
|
|
$vals = array('TestKey' => 'TestVal'); |
22
|
|
|
$instance->setMarkerTemplateValues($vals); |
23
|
|
|
$html = $instance->getRenderableMap(300,800,2)->forTemplate(); |
24
|
|
|
$expected = ''; |
25
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
|
30
|
|
|
public function testStaticMapChangeLocation() { |
31
|
|
|
$instance = $this->getInstance(); |
32
|
|
|
$instance->Lat = 13.84; |
33
|
|
|
$instance->Lon = 100.52; |
34
|
|
|
$html = $instance->StaticMap(300,800); |
35
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
36
|
|
|
. '13.84%2C100.52&markers=13.84%2C100.52' |
37
|
|
|
. '&zoom=13&size=300x800&sensor=false&mapt' |
38
|
|
|
. 'ype=roadmap" width="300" height="800" alt="" />'; |
39
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testStaticMapVarySize() { |
43
|
|
|
$instance = $this->getInstance(); |
44
|
|
|
$instance->Lat = 13.8188931; |
45
|
|
|
$instance->Lon = 100.5005558; |
46
|
|
|
$html = $instance->StaticMap(300,800); |
47
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
48
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
49
|
|
|
. '558&zoom=13&size=300x800&sensor=false&mapt' |
50
|
|
|
. 'ype=roadmap" width="300" height="800" alt="" />'; |
51
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
52
|
|
|
|
53
|
|
|
$html = $instance->StaticMap(310,810); |
54
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
55
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
56
|
|
|
. '558&zoom=13&size=310x810&sensor=false&mapt' |
57
|
|
|
. 'ype=roadmap" width="310" height="810" alt="" />'; |
58
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
public function testStaticMapVaryTerrain() { |
63
|
|
|
$instance = $this->getInstance(); |
64
|
|
|
$instance->Lat = 13.8188931; |
65
|
|
|
$instance->Lon = 100.5005558; |
66
|
|
|
$html = $instance->StaticMap(300,800, null, 'satellite'); |
67
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
68
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
69
|
|
|
. '558&zoom=13&size=300x800&sensor=false&mapt' |
70
|
|
|
. 'ype=satellite" width="300" height="800" alt="" />'; |
71
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
72
|
|
|
|
73
|
|
|
$html = $instance->StaticMap(300,800,null, 'terrain'); |
|
|
|
|
74
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
|
|
|
|
75
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
76
|
|
|
. '558&zoom=13&size=300x800&sensor=false&mapt' |
77
|
|
|
. 'ype=terrain" width="300" height="800" alt="" />'; |
78
|
|
|
|
79
|
|
|
$html = $instance->StaticMap(300,800,null, 'hybrid'); |
80
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
81
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
82
|
|
|
. '558&zoom=13&size=300x800&sensor=false&mapt' |
83
|
|
|
. 'ype=hybrid" width="300" height="800" alt="" />'; |
84
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
public function testStaticMapVaryZoom() { |
89
|
|
|
$instance = $this->getInstance(); |
90
|
|
|
|
91
|
|
|
$html = $instance->StaticMap(300,800,2); |
92
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
93
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
94
|
|
|
. '558&zoom=2&size=300x800&sensor=false&mapt' |
95
|
|
|
. 'ype=roadmap" width="300" height="800" alt="" />'; |
96
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
97
|
|
|
|
98
|
|
|
$html = $instance->StaticMap(300,800,12); |
99
|
|
|
$expected = '<img src="//maps.googleapis.com/maps/api/staticmap?center=' |
100
|
|
|
. '13.8188931%2C100.5005558&markers=13.8188931%2C100.5005' |
101
|
|
|
. '558&zoom=12&size=300x800&sensor=false&mapt' |
102
|
|
|
. 'ype=roadmap" width="300" height="800" alt="" />'; |
103
|
|
|
$this->assertEquals($expected, $html); |
|
|
|
|
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
private function getInstance() { |
107
|
|
|
$instance = new Member(); |
108
|
|
|
$instance->Lat = 13.8188931; |
109
|
|
|
$instance->Lon = 100.5005558; |
110
|
|
|
return $instance; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
} |
114
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.