Completed
Push — AUTOMATED_TESTING ( 6591ac...6229f9 )
by Gordon
15:27
created

MappableDataObjectSetTest::setUpOnce()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
class MappableDataObjectSetTest extends SapphireTest {
4
5
	public function setUpOnce() {
6
		$this->requiredExtensions = array(
7
			'Member' => array('MapExtension')
8
		);
9
10
		parent::setupOnce();
11
	}
12
13
	public function setUp() {
14
		MapUtil::reset();
15
		parent::setUp();
16
	}
17
18
	public function testSetMarkerTemplateValues() {
19
		$instance1 = $this->getInstance();
20
		$instance1->MapPinEdited = true;
21
		$instance1->write();
22
23
		$instance2 = $this->getInstance();
24
		$instance2->Lat = 7.12;
25
		$instance2->Lon = 23.4;
26
		$instance2->MapPinEdited = true;
27
		$instance2->write();
28
29
		// Mappable list has MappableDataObjectSet enabled by default
30
		// Items in the list are Mappable via the MapExtension
31
		$mappableList = new ArrayList();
32
		$mappableList->push($instance1);
33
		$mappableList->push($instance2);
34
35
		$vals = array('TestKey' => ' TestKeyValMDOS');
36
		$mappableList->setMarkerTemplateValues($vals);
37
38
		$html = $mappableList->getRenderableMap(300, 800, 2)->setDivId('testmap')->forTemplate()->getValue();
39
		$expected = <<<HTML
40
41
42
<div id="testmap" style="width:300; height: 800;"
43
 class=" mappable"
44
data-map
45
data-centre='{"lat":48.856614,"lng":2.3522219}'
46
data-zoom=9
47
data-maptype='road'
48
data-allowfullscreen='1'
49
data-clusterergridsize=50,
50
data-clusterermaxzoom=17,
51
data-enableautocentrezoom=1
52
data-enablewindowzoom=false
53
data-infowindowzoom=13
54
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}]'
55
data-defaulthidemarker=false
56
data-lines='[]'
57
data-kmlfiles='[]'
58
data-mapstyles='[]'
59
data-useclusterer=false
60
>
61
</div>
62
63
HTML;
64
		$this->assertEquals($expected, $html);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<MappableDataObjectSetTest>.

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.

Loading history...
65
	}
66
67
68
69
	private function getInstance() {
70
		$instance = new Member();
71
		$instance->Lat = 13.8188931;
72
		$instance->Lon = 100.5005558;
73
		$instance->FirstName = 'Test';
74
		$instance->Surname = 'User';
75
		return $instance;
76
	}
77
78
}
79