ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

Referenced by testMoveLeft(), and testMoveRight().

312  : ilPCGridCell
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  }
getContentDomNode(string $a_hier_id, string $a_pc_id="")
getPCIdForHierId(string $hier_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

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

Referenced by testMoveLeft(), and testMoveRight().

293  : ilPageObject
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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_MAIN_SIDE
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
+ 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.

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

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>
238 EOT;
239 
240  $this->assertXmlEquals(
241  $expected,
242  $page->getXMLFromDom()
243  );
244  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testAddGridCell()

PCGridTest::testAddGridCell ( )

Definition at line 196 of file PCGridTest.php.

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

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>
213 EOT;
214 
215  $this->assertXmlEquals(
216  $expected,
217  $page->getXMLFromDom()
218  );
219  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testApplyTemplateManual()

PCGridTest::testApplyTemplateManual ( )

Definition at line 71 of file PCGridTest.php.

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

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>
87 EOT;
88 
89  $this->assertXmlEquals(
90  $expected,
91  $page->getXMLFromDom()
92  );
93  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testApplyTemplateTwoColumn()

PCGridTest::testApplyTemplateTwoColumn ( )

Definition at line 47 of file PCGridTest.php.

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

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>
63 EOT;
64 
65  $this->assertXmlEquals(
66  $expected,
67  $page->getXMLFromDom()
68  );
69  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_TWO_COLUMN
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testCellData()

PCGridTest::testCellData ( )

Definition at line 247 of file PCGridTest.php.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_MAIN_SIDE
+ Here is the call graph for this function:

◆ testConstruction()

PCGridTest::testConstruction ( )

Definition at line 26 of file PCGridTest.php.

References COPageTestBase\getEmptyPageWithDom().

26  : void
27  {
28  $page = $this->getEmptyPageWithDom();
29  $pc = new ilPCGrid($page);
30  $this->assertEquals(
31  ilPCGrid::class,
32  get_class($pc)
33  );
34  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testCreate()

PCGridTest::testCreate ( )

Definition at line 36 of file PCGridTest.php.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testDelete()

PCGridTest::testDelete ( )

Definition at line 169 of file PCGridTest.php.

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

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>
188 EOT;
189 
190  $this->assertXmlEquals(
191  $expected,
192  $page->getXMLFromDom()
193  );
194  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_MAIN_SIDE
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testMoveLeft()

PCGridTest::testMoveLeft ( )

Definition at line 341 of file PCGridTest.php.

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

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>
351 EOT;
352 
353  $this->assertXmlEquals(
354  $expected,
355  $page->getXMLFromDom()
356  );
357  }
getCellForHierId(ilPageObject $page, string $hier_id)
Definition: PCGridTest.php:312
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testMoveRight()

PCGridTest::testMoveRight ( )

Definition at line 323 of file PCGridTest.php.

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

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>
333 EOT;
334 
335  $this->assertXmlEquals(
336  $expected,
337  $page->getXMLFromDom()
338  );
339  }
getCellForHierId(ilPageObject $page, string $hier_id)
Definition: PCGridTest.php:312
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testPositions()

PCGridTest::testPositions ( )

Definition at line 95 of file PCGridTest.php.

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

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>
117 EOT;
118 
119  $this->assertXmlEquals(
120  $expected,
121  $page->getXMLFromDom()
122  );
123  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_MAIN_SIDE
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

◆ testWidths()

PCGridTest::testWidths ( )

Definition at line 125 of file PCGridTest.php.

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

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>
161 EOT;
162 
163  $this->assertXmlEquals(
164  $expected,
165  $page->getXMLFromDom()
166  );
167  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEMPLATE_MAIN_SIDE
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
+ Here is the call graph for this function:

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