ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PCMapTest.php
Go to the documentation of this file.
1 <?php
2 
20 
25 {
26  public function testConstruction(): void
27  {
28  $page = $this->getEmptyPageWithDom();
29  $pc = new ilPCMap($page);
30  $this->assertEquals(
31  ilPCMap::class,
32  get_class($pc)
33  );
34  }
35 
36  public function testCreate(): void
37  {
38  $page = $this->getEmptyPageWithDom();
39  $pc = new ilPCMap($page);
40  $pc->create($page, "pg");
41  $this->assertXmlEquals(
42  '<PageObject HierId="pg"><PageContent><Map Latitude="0" Longitude="0" Zoom="3"></Map></PageContent></PageObject>',
43  $page->getXMLFromDom()
44  );
45  }
46 
47  public function testLatitude(): void
48  {
49  $page = $this->getEmptyPageWithDom();
50  $pc = new ilPCMap($page);
51  $pc->create($page, "pg");
52  $pc->setLatitude(23.24);
53 
54  $this->assertEquals(
55  23.24,
56  $pc->getLatitude()
57  );
58 
59  $page->stripHierIDs();
60 
61  $expected = <<<EOT
62 <PageObject><PageContent><Map Latitude="23.24" Longitude="0" Zoom="3"></Map></PageContent></PageObject>
63 EOT;
64  $this->assertXmlEquals(
65  $expected,
66  $page->getXMLFromDom()
67  );
68  }
69 
70  public function testLongitude(): void
71  {
72  $page = $this->getEmptyPageWithDom();
73  $pc = new ilPCMap($page);
74  $pc->create($page, "pg");
75  $pc->setLongitude(44.24);
76 
77  $this->assertEquals(
78  44.24,
79  $pc->getLongitude()
80  );
81 
82  $page->stripHierIDs();
83 
84  $expected = <<<EOT
85 <PageObject><PageContent><Map Latitude="0" Longitude="44.24" Zoom="3"></Map></PageContent></PageObject>
86 EOT;
87  $this->assertXmlEquals(
88  $expected,
89  $page->getXMLFromDom()
90  );
91  }
92 
93  public function testZoom(): void
94  {
95  $page = $this->getEmptyPageWithDom();
96  $pc = new ilPCMap($page);
97  $pc->create($page, "pg");
98  $pc->setZoom(7);
99 
100  $this->assertEquals(
101  7,
102  $pc->getZoom()
103  );
104 
105  $page->stripHierIDs();
106 
107  $expected = <<<EOT
108 <PageObject><PageContent><Map Latitude="0" Longitude="0" Zoom="7"></Map></PageContent></PageObject>
109 EOT;
110  $this->assertXmlEquals(
111  $expected,
112  $page->getXMLFromDom()
113  );
114  }
115 
116  public function testLayout(): void
117  {
118  $page = $this->getEmptyPageWithDom();
119  $pc = new ilPCMap($page);
120  $pc->create($page, "pg");
121  $pc->setLayout("200", "100", "Right");
122 
123  $this->assertEquals(
124  "200",
125  $pc->getWidth()
126  );
127 
128  $this->assertEquals(
129  "100",
130  $pc->getHeight()
131  );
132 
133  $this->assertEquals(
134  "Right",
135  $pc->getHorizontalAlign()
136  );
137 
138  $page->stripHierIDs();
139 
140  $expected = <<<EOT
141 <PageObject><PageContent><Map Latitude="0" Longitude="0" Zoom="3"><Layout Width="200" Height="100" HorizontalAlign="Right"/></Map></PageContent></PageObject>
142 EOT;
143  $this->assertXmlEquals(
144  $expected,
145  $page->getXMLFromDom()
146  );
147  }
148 
149  public function testCaption(): void
150  {
151  $page = $this->getEmptyPageWithDom();
152  $pc = new ilPCMap($page);
153  $pc->create($page, "pg");
154  $pc->setCaption("Moin");
155 
156  $this->assertEquals(
157  "Moin",
158  $pc->getCaption()
159  );
160 
161  $page->stripHierIDs();
162 
163  $expected = <<<EOT
164 <PageObject><PageContent><Map Latitude="0" Longitude="0" Zoom="3"><MapCaption>Moin</MapCaption></Map></PageContent></PageObject>
165 EOT;
166  $this->assertXmlEquals(
167  $expected,
168  $page->getXMLFromDom()
169  );
170  }
171 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testCreate()
Definition: PCMapTest.php:36
testConstruction()
Definition: PCMapTest.php:26
testLatitude()
Definition: PCMapTest.php:47
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
testLongitude()
Definition: PCMapTest.php:70