|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class MappableDataObjectSetTest extends SapphireTest |
|
4
|
|
|
{ |
|
5
|
|
|
public function setUpOnce() |
|
6
|
|
|
{ |
|
7
|
|
|
$this->requiredExtensions = array( |
|
8
|
|
|
'Member' => array('MapExtension'), |
|
9
|
|
|
); |
|
10
|
|
|
|
|
11
|
|
|
parent::setupOnce(); |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
1 |
|
public function setUp() |
|
15
|
|
|
{ |
|
16
|
1 |
|
MapUtil::reset(); |
|
17
|
1 |
|
parent::setUp(); |
|
18
|
1 |
|
} |
|
19
|
|
|
|
|
20
|
1 |
|
public function testSetMarkerTemplateValues() |
|
21
|
|
|
{ |
|
22
|
1 |
|
$instance1 = $this->getInstance(); |
|
23
|
1 |
|
$instance1->MapPinEdited = true; |
|
24
|
1 |
|
$instance1->write(); |
|
25
|
|
|
|
|
26
|
1 |
|
$instance2 = $this->getInstance(); |
|
27
|
1 |
|
$instance2->Lat = 7.12; |
|
28
|
1 |
|
$instance2->Lon = 23.4; |
|
29
|
1 |
|
$instance2->MapPinEdited = true; |
|
30
|
1 |
|
$instance2->write(); |
|
31
|
|
|
|
|
32
|
|
|
// Mappable list has MappableDataObjectSet enabled by default |
|
33
|
|
|
// Items in the list are Mappable via the MapExtension |
|
34
|
1 |
|
$mappableList = new ArrayList(); |
|
35
|
1 |
|
$mappableList->push($instance1); |
|
36
|
1 |
|
$mappableList->push($instance2); |
|
37
|
|
|
|
|
38
|
1 |
|
$vals = array('TestKey' => ' TestKeyValMDOS'); |
|
39
|
1 |
|
$mappableList->setMarkerTemplateValues($vals); |
|
40
|
|
|
|
|
41
|
1 |
|
$html = $mappableList->getRenderableMap(300, 800, 2)->setDivId('testmap')->forTemplate()->getValue(); |
|
42
|
|
|
$expected = <<<HTML |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
<div id="testmap" data-google-map-lang="en" style="width:300; height: 800;" |
|
46
|
|
|
class=" mappable" |
|
47
|
|
|
data-map |
|
48
|
|
|
data-centre='{"lat":48.856614,"lng":2.3522219}' |
|
49
|
|
|
data-zoom=9 |
|
50
|
|
|
data-maptype='road' |
|
51
|
|
|
data-allowfullscreen='1' |
|
52
|
|
|
data-clusterergridsize=50, |
|
53
|
|
|
data-clusterermaxzoom=17, |
|
54
|
|
|
data-enableautocentrezoom=1 |
|
55
|
|
|
data-enablewindowzoom=false |
|
56
|
|
|
data-infowindowzoom=13 |
|
57
|
|
|
data-mapmarkers='[{"latitude":13.8188931,"longitude":100.5005558,"html":"MEMBER: Test User TestKeyValMDOS","category":"default","icon":false},{"latitude":7.12,"longitude":23.4,"html":"MEMBER: Test User TestKeyValMDOS","category":"default","icon":false}]' |
|
58
|
|
|
data-defaulthidemarker=false |
|
59
|
|
|
data-lines='[]' |
|
60
|
|
|
data-kmlfiles='[]' |
|
61
|
|
|
data-mapstyles='[]' |
|
62
|
|
|
data-useclusterer=false |
|
63
|
|
|
> |
|
64
|
|
|
</div> |
|
65
|
|
|
|
|
66
|
1 |
|
HTML; |
|
67
|
1 |
|
$this->assertEquals($expected, $html); |
|
|
|
|
|
|
68
|
1 |
|
} |
|
69
|
|
|
|
|
70
|
1 |
View Code Duplication |
private function getInstance() |
|
|
|
|
|
|
71
|
|
|
{ |
|
72
|
1 |
|
$instance = new Member(); |
|
73
|
1 |
|
$instance->Lat = 13.8188931; |
|
74
|
1 |
|
$instance->Lon = 100.5005558; |
|
75
|
1 |
|
$instance->FirstName = 'Test'; |
|
76
|
1 |
|
$instance->Surname = 'User'; |
|
77
|
|
|
|
|
78
|
1 |
|
return $instance; |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
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.