ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PCGridTest Class Reference
+ Inheritance diagram for PCGridTest:
+ Collaboration diagram for PCGridTest:

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testApplyTemplateTwoColumn ()
 
 testApplyTemplateManual ()
 
 testPositions ()
 
 testWidths ()
 
 testDelete ()
 
 testAddGridCell ()
 
 testAddCell ()
 
 testCellData ()
 
 testMoveRight ()
 
 testMoveLeft ()
 

Protected Member Functions

 getPageWithGrid ()
 
 getCellForHierId (ilPageObject $page, string $hier_id)
 
- Protected Member Functions inherited from COPageTestBase
 setGlobalVariable (string $name, $value)
 
 setUp ()
 
 getIdGeneratorMock ()
 
 getPCDefinition ()
 
 setPCIdCnt (int $cnt)
 
 getIDManager (\ilPageObject $page)
 
 insertParagraphAt (\ilPageObject $page, string $hier_id, string $text="")
 
 tearDown ()
 
 normalize (string $html)
 
 assertXmlEquals (string $expected_xml_as_string, string $html_xml_string)
 
 getEmptyPageWithDom ()
 
 legacyHtmlToXml (string $content)
 
 getMediaObjectMock ()
 

Additional Inherited Members

- Protected Attributes inherited from COPageTestBase
int $pc_cnt
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file PCGridTest.php.

Member Function Documentation

◆ getCellForHierId()

PCGridTest::getCellForHierId ( ilPageObject  $page,
string  $hier_id 
)
protected

Definition at line 312 of file PCGridTest.php.

313 {
314 $pc_id = $page->getPCIdForHierId($hier_id);
315 $cont_node = $page->getContentDomNode($hier_id);
316 $pc = new ilPCGridCell($page);
317 $pc->setDomNode($cont_node);
318 $pc->setHierId($hier_id);
319 $pc->setPcId($pc_id);
320 return $pc;
321 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContentDomNode(string $a_hier_id, string $a_pc_id="")
getPCIdForHierId(string $hier_id)

References ilPageObject\getContentDomNode(), and ilPageObject\getPCIdForHierId().

Referenced by testMoveLeft(), and testMoveRight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPageWithGrid()

PCGridTest::getPageWithGrid ( )
protected

Definition at line 293 of file PCGridTest.php.

294 {
295 $page = $this->getEmptyPageWithDom();
296 $pc = new ilPCGrid($page);
297 $pc->create($page, "pg");
298 $pc->applyTemplate(
300 0,
301 0,
302 0,
303 0,
304 0
305 );
306 $page->addHierIDs();
307 $page->insertPCIds();
308 $pc->setHierId("1");
309 return $page;
310 }
const TEMPLATE_MAIN_SIDE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)

References COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MAIN_SIDE.

Referenced by testMoveLeft(), and testMoveRight().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testAddCell()

PCGridTest::testAddCell ( )

Definition at line 221 of file PCGridTest.php.

221 : void
222 {
223 $page = $this->getEmptyPageWithDom();
224 $pc = new ilPCGrid($page);
225 $pc->create($page, "pg");
226 $pc->applyTemplate(
228 1,
229 12,
230 6,
231 3,
232 3
233 );
234 $pc->addCell();
235
236 $expected = <<<EOT
237<PageObject HierId="pg"><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="" WIDTH_M="" WIDTH_L="" WIDTH_XL=""/></Grid></PageContent></PageObject>
238EOT;
239
240 $this->assertXmlEquals(
241 $expected,
242 $page->getXMLFromDom()
243 );
244 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MANUAL.

+ Here is the call graph for this function:

◆ testAddGridCell()

PCGridTest::testAddGridCell ( )

Definition at line 196 of file PCGridTest.php.

196 : void
197 {
198 $page = $this->getEmptyPageWithDom();
199 $pc = new ilPCGrid($page);
200 $pc->create($page, "pg");
201 $pc->applyTemplate(
203 1,
204 12,
205 6,
206 3,
207 3
208 );
209 $pc->addGridCell(12, 12, 12, 6);
210
211 $expected = <<<EOT
212<PageObject HierId="pg"><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="12" WIDTH_L="12" WIDTH_XL="6"/></Grid></PageContent></PageObject>
213EOT;
214
215 $this->assertXmlEquals(
216 $expected,
217 $page->getXMLFromDom()
218 );
219 }

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MANUAL.

+ Here is the call graph for this function:

◆ testApplyTemplateManual()

PCGridTest::testApplyTemplateManual ( )

Definition at line 71 of file PCGridTest.php.

71 : void
72 {
73 $page = $this->getEmptyPageWithDom();
74 $pc = new ilPCGrid($page);
75 $pc->create($page, "pg");
76 $pc->applyTemplate(
78 4,
79 12,
80 6,
81 3,
82 3
83 );
84
85 $expected = <<<EOT
86<PageObject HierId="pg"><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="3" WIDTH_XL="3"/></Grid></PageContent></PageObject>
87EOT;
88
89 $this->assertXmlEquals(
90 $expected,
91 $page->getXMLFromDom()
92 );
93 }

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MANUAL.

+ Here is the call graph for this function:

◆ testApplyTemplateTwoColumn()

PCGridTest::testApplyTemplateTwoColumn ( )

Definition at line 47 of file PCGridTest.php.

47 : void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc = new ilPCGrid($page);
51 $pc->create($page, "pg");
52 $pc->applyTemplate(
54 0,
55 0,
56 0,
57 0,
58 0
59 );
60
61 $expected = <<<EOT
62<PageObject HierId="pg"><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="6" WIDTH_XL="6"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="6" WIDTH_XL="6"/></Grid></PageContent></PageObject>
63EOT;
64
65 $this->assertXmlEquals(
66 $expected,
67 $page->getXMLFromDom()
68 );
69 }
const TEMPLATE_TWO_COLUMN

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_TWO_COLUMN.

+ Here is the call graph for this function:

◆ testCellData()

PCGridTest::testCellData ( )

Definition at line 247 of file PCGridTest.php.

247 : void
248 {
249 $page = $this->getEmptyPageWithDom();
250 $pc = new ilPCGrid($page);
251 $pc->create($page, "pg");
252 $pc->applyTemplate(
254 0,
255 0,
256 0,
257 0,
258 0
259 );
260 $page->addHierIDs();
261
262 $this->assertEquals(
263 [
264 0 => [
265 "xs" => "",
266 "s" => "12",
267 "m" => "6",
268 "l" => "8",
269 "xl" => "9",
270 "pc_id" => "",
271 "hier_id" => "1_1",
272 "pos" => 0
273 ],
274 1 => [
275 "xs" => "",
276 "s" => "12",
277 "m" => "6",
278 "l" => "4",
279 "xl" => "3",
280 "pc_id" => "",
281 "hier_id" => "1_2",
282 "pos" => 1
283 ]
284 ],
285 $pc->getCellData()
286 );
287 }

References COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MAIN_SIDE.

+ Here is the call graph for this function:

◆ testConstruction()

PCGridTest::testConstruction ( )

Definition at line 26 of file PCGridTest.php.

26 : void
27 {
28 $page = $this->getEmptyPageWithDom();
29 $pc = new ilPCGrid($page);
30 $this->assertEquals(
31 ilPCGrid::class,
32 get_class($pc)
33 );
34 }

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCGridTest::testCreate ( )

Definition at line 36 of file PCGridTest.php.

36 : void
37 {
38 $page = $this->getEmptyPageWithDom();
39 $pc = new ilPCGrid($page);
40 $pc->create($page, "pg");
41 $this->assertXmlEquals(
42 '<PageObject HierId="pg"><PageContent><Grid></Grid></PageContent></PageObject>',
43 $page->getXMLFromDom()
44 );
45 }

References COPageTestBase\assertXmlEquals(), and COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testDelete()

PCGridTest::testDelete ( )

Definition at line 169 of file PCGridTest.php.

169 : void
170 {
171 $page = $this->getEmptyPageWithDom();
172 $pc = new ilPCGrid($page);
173 $pc->create($page, "pg");
174 $pc->applyTemplate(
176 0,
177 0,
178 0,
179 0,
180 0
181 );
182 $page->addHierIDs();
183 $pc->deleteGridCell("1_2", "");
184 $page->stripHierIDs();
185
186 $expected = <<<EOT
187<PageObject><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="8" WIDTH_XL="9"/></Grid></PageContent></PageObject>
188EOT;
189
190 $this->assertXmlEquals(
191 $expected,
192 $page->getXMLFromDom()
193 );
194 }

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MAIN_SIDE.

+ Here is the call graph for this function:

◆ testMoveLeft()

PCGridTest::testMoveLeft ( )

Definition at line 341 of file PCGridTest.php.

341 : void
342 {
343 $page = $this->getPageWithGrid();
344 $cell = $this->getCellForHierId($page, "1_2");
345 $cell->moveCellLeft();
346 $page->stripHierIDs();
347 $page->stripPCIDs();
348
349 $expected = <<<EOT
350<PageObject><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="4" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="8" WIDTH_XL="9"/></Grid></PageContent></PageObject>
351EOT;
352
353 $this->assertXmlEquals(
354 $expected,
355 $page->getXMLFromDom()
356 );
357 }
getCellForHierId(ilPageObject $page, string $hier_id)
Definition: PCGridTest.php:312

References COPageTestBase\assertXmlEquals(), getCellForHierId(), and getPageWithGrid().

+ Here is the call graph for this function:

◆ testMoveRight()

PCGridTest::testMoveRight ( )

Definition at line 323 of file PCGridTest.php.

323 : void
324 {
325 $page = $this->getPageWithGrid();
326 $cell = $this->getCellForHierId($page, "1_1");
327 $cell->moveCellRight();
328 $page->stripHierIDs();
329 $page->stripPCIDs();
330
331 $expected = <<<EOT
332<PageObject><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="4" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="8" WIDTH_XL="9"/></Grid></PageContent></PageObject>
333EOT;
334
335 $this->assertXmlEquals(
336 $expected,
337 $page->getXMLFromDom()
338 );
339 }

References COPageTestBase\assertXmlEquals(), getCellForHierId(), and getPageWithGrid().

+ Here is the call graph for this function:

◆ testPositions()

PCGridTest::testPositions ( )

Definition at line 95 of file PCGridTest.php.

95 : void
96 {
97 $page = $this->getEmptyPageWithDom();
98 $pc = new ilPCGrid($page);
99 $pc->create($page, "pg");
100 $pc->applyTemplate(
102 0,
103 0,
104 0,
105 0,
106 0
107 );
108 $page->addHierIDs();
109 $pc->savePositions([
110 "1_1:" => 20,
111 "1_2:" => 10
112 ]);
113 $page->stripHierIDs();
114
115 $expected = <<<EOT
116<PageObject><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="4" WIDTH_XL="3"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="6" WIDTH_L="8" WIDTH_XL="9"/></Grid></PageContent></PageObject>
117EOT;
118
119 $this->assertXmlEquals(
120 $expected,
121 $page->getXMLFromDom()
122 );
123 }

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MAIN_SIDE.

+ Here is the call graph for this function:

◆ testWidths()

PCGridTest::testWidths ( )

Definition at line 125 of file PCGridTest.php.

125 : void
126 {
127 $page = $this->getEmptyPageWithDom();
128 $pc = new ilPCGrid($page);
129 $pc->create($page, "pg");
130 $pc->applyTemplate(
132 0,
133 0,
134 0,
135 0,
136 0
137 );
138 $page->addHierIDs();
139 $pc->saveWidths(
140 [
141 "1_1:" => 12,
142 "1_2:" => 12
143 ],
144 [
145 "1_1:" => 12,
146 "1_2:" => 12
147 ],
148 [
149 "1_1:" => 6,
150 "1_2:" => 6
151 ],
152 [
153 "1_1:" => 6,
154 "1_2:" => 6
155 ],
156 );
157 $page->stripHierIDs();
158
159 $expected = <<<EOT
160<PageObject><PageContent><Grid><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="12" WIDTH_L="6" WIDTH_XL="6"/><GridCell WIDTH_XS="" WIDTH_S="12" WIDTH_M="12" WIDTH_L="6" WIDTH_XL="6"/></Grid></PageContent></PageObject>
161EOT;
162
163 $this->assertXmlEquals(
164 $expected,
165 $page->getXMLFromDom()
166 );
167 }

References COPageTestBase\assertXmlEquals(), COPageTestBase\getEmptyPageWithDom(), and ilPCGridGUI\TEMPLATE_MAIN_SIDE.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: