Completed
Push — AUTOMATED_TESTING ( 4cfed4...8e1a94 )
by Gordon
18:08
created

MappableDataObjectSetTest::getInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4286
cc 1
eloc 7
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 testsetMarkerTemplateValues() {
14
15
		$instance1 = $this->getInstance();
16
		$instance1->MapPinEdited = true;
17
		$instance1->write();
18
19
		$instance2 = $this->getInstance();
20
		$instance2->Lat = 7.12;
21
		$instance2->Lon = 23.4;
22
		$instance2->MapPinEdited = true;
23
		$instance2->write();
24
25
		// Mappable list has MappableDataObjectSet enabled by default
26
		// Items in the list are Mappable via the MapExtension
27
		$mappableList = new ArrayList();
28
		$mappableList->push($instance1);
29
		$mappableList->push($instance2);
30
31
		$vals = array('TestKey' => ' TestKeyValMDOS');
32
		$mappableList->setMarkerTemplateValues($vals);
33
34
		$html = $mappableList->getRenderableMap(300,800,2)->setDivId('testmap')->forTemplate()->getValue();
35
		$expected = <<<HTML
36
37
38
<div id="testmap" style="width:300; height: 800;"
39
 class=" mappable"
40
data-map
41
data-centre='{"lat":48.856614,"lng":2.3522219}'
42
data-zoom=9
43
data-maptype='road'
44
data-allowfullscreen='1'
45
data-clusterergridsize=50,
46
data-clusterermaxzoom=17,
47
data-enableautocentrezoom=1
48
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}]'
49
data-lines='[]'
50
data-kmlfiles='[]'
51
data-mapstyles='[]'
52
data-useclusterer=false
53
>
54
</div>
55
56
HTML;
57
		$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...
58
	}
59
60
61
62
	private function getInstance() {
63
		$instance = new Member();
64
		$instance->Lat = 13.8188931;
65
		$instance->Lon = 100.5005558;
66
		$instance->FirstName = 'Test';
67
		$instance->Surname = 'User';
68
		return $instance;
69
	}
70
71
}
72