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

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testType ()
 
 testContentWidth ()
 
 testContentHeight ()
 
 testHorizontalAlign ()
 
 testBehaviour ()
 
 testAddTab ()
 
 testCaptions ()
 
 testPositions ()
 
 testDeleteTab ()
 
 testTemplate ()
 
 testAutoTime ()
 
 testRandomStart ()
 
 testNewItemAfter ()
 
 testNewItemBefore ()
 
 testDeleteItem ()
 
 testMoveItemDown ()
 
 testMoveItemUp ()
 

Protected Member Functions

 getTabsWithTabs (ilPageObject $page)
 
 getTabForHierId (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 PCTabsTest.php.

Member Function Documentation

◆ getTabForHierId()

PCTabsTest::getTabForHierId ( ilPageObject  $page,
string  $hier_id 
)
protected

Definition at line 367 of file PCTabsTest.php.

367 : ilPCTab
368 {
369 $page->insertPCIds();
370 $pc_id = $page->getPCIdForHierId($hier_id);
371 $cont_node = $page->getContentDomNode($hier_id);
372 $pc = new ilPCTab($page);
373 $pc->setDomNode($cont_node);
374 $pc->setHierId($hier_id);
375 $pc->setPcId($pc_id);
376 return $pc;
377 }
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="")
insertPCIds()
Insert Page Content IDs.
getPCIdForHierId(string $hier_id)

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

Referenced by testDeleteItem(), testMoveItemDown(), testMoveItemUp(), testNewItemAfter(), and testNewItemBefore().

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

◆ getTabsWithTabs()

PCTabsTest::getTabsWithTabs ( ilPageObject  $page)
protected

Definition at line 162 of file PCTabsTest.php.

162 : ilPCTabs
163 {
164 $pc = new ilPCTabs($page);
165 $pc->create($page, "pg", "");
166 $pc->setTabType("HorizontalAccordion");
167 $pc->addTab("One");
168 $pc->addTab("Two");
169 $pc->addTab("Three");
170 $page->addHierIDs();
171 return $pc;
172 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addHierIDs()
Add hierarchical ID (e.g.

References ilPageObject\addHierIDs().

Referenced by testAddTab(), testCaptions(), testDeleteItem(), testDeleteTab(), testMoveItemDown(), testMoveItemUp(), testNewItemAfter(), testNewItemBefore(), and testPositions().

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

◆ testAddTab()

PCTabsTest::testAddTab ( )

Definition at line 174 of file PCTabsTest.php.

174 : void
175 {
176 $page = $this->getEmptyPageWithDom();
177 $pc = $this->getTabsWithTabs($page);
178
179 /*
180 $this->assertEquals(
181 "AllClosed",
182 $pc->getBehavior()
183 );*/
184
185 $page->stripHierIDs();
186
187 $expected = <<<EOT
188<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>One</TabCaption></Tab><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
189EOT;
190 $this->assertXmlEquals(
191 $expected,
192 $page->getXMLFromDom()
193 );
194 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
getTabsWithTabs(ilPageObject $page)
Definition: PCTabsTest.php:162

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

+ Here is the call graph for this function:

◆ testAutoTime()

PCTabsTest::testAutoTime ( )

Definition at line 311 of file PCTabsTest.php.

311 : void
312 {
313 $page = $this->getEmptyPageWithDom();
314 $pc = new ilPCTabs($page);
315 $pc->create($page, "pg", "");
316 $pc->setAutoTime(20);
317
318 $this->assertEquals(
319 20,
320 $pc->getAutoTime()
321 );
322
323 $page->stripHierIDs();
324
325 $expected = <<<EOT
326<PageObject><PageContent><Tabs AutoAnimWait="20"></Tabs></PageContent></PageObject>
327EOT;
328 $this->assertXmlEquals(
329 $expected,
330 $page->getXMLFromDom()
331 );
332 }

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

+ Here is the call graph for this function:

◆ testBehaviour()

PCTabsTest::testBehaviour ( )

Definition at line 139 of file PCTabsTest.php.

139 : void
140 {
141 $page = $this->getEmptyPageWithDom();
142 $pc = new ilPCTabs($page);
143 $pc->create($page, "pg", "");
144 $pc->setBehavior("AllClosed");
145
146 $this->assertEquals(
147 "AllClosed",
148 $pc->getBehavior()
149 );
150
151 $page->stripHierIDs();
152
153 $expected = <<<EOT
154<PageObject><PageContent><Tabs Behavior="AllClosed"></Tabs></PageContent></PageObject>
155EOT;
156 $this->assertXmlEquals(
157 $expected,
158 $page->getXMLFromDom()
159 );
160 }

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

+ Here is the call graph for this function:

◆ testCaptions()

PCTabsTest::testCaptions ( )

Definition at line 196 of file PCTabsTest.php.

196 : void
197 {
198 $page = $this->getEmptyPageWithDom();
199 $pc = $this->getTabsWithTabs($page);
200 $pc->saveCaptions(
201 [
202 "1_1:" => "New 1",
203 "1_2:" => "New 2",
204 "1_3:" => "New 3"
205 ]
206 );
207
208 $this->assertEquals(
209 [
210 0 => [
211 "pos" => 0,
212 "caption" => "New 1",
213 "pc_id" => "",
214 "hier_id" => "1_1"
215 ],
216 1 => [
217 "pos" => 1,
218 "caption" => "New 2",
219 "pc_id" => "",
220 "hier_id" => "1_2"
221 ],
222 2 => [
223 "pos" => 2,
224 "caption" => "New 3",
225 "pc_id" => "",
226 "hier_id" => "1_3"
227 ]
228 ],
229 $pc->getCaptions()
230 );
231
232 $this->assertEquals(
233 "New 2",
234 $pc->getCaption("1_2", "")
235 );
236
237 $page->stripHierIDs();
238
239 $expected = <<<EOT
240<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>New 1</TabCaption></Tab><Tab><TabCaption>New 2</TabCaption></Tab><Tab><TabCaption>New 3</TabCaption></Tab></Tabs></PageContent></PageObject>
241EOT;
242 $this->assertXmlEquals(
243 $expected,
244 $page->getXMLFromDom()
245 );
246 }

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

+ Here is the call graph for this function:

◆ testConstruction()

PCTabsTest::testConstruction ( )

Definition at line 26 of file PCTabsTest.php.

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

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testContentHeight()

PCTabsTest::testContentHeight ( )

Definition at line 93 of file PCTabsTest.php.

93 : void
94 {
95 $page = $this->getEmptyPageWithDom();
96 $pc = new ilPCTabs($page);
97 $pc->create($page, "pg", "");
98 $pc->setContentHeight("200");
99
100 $this->assertEquals(
101 "200",
102 $pc->getContentHeight()
103 );
104
105 $page->stripHierIDs();
106
107 $expected = <<<EOT
108<PageObject><PageContent><Tabs ContentHeight="200"></Tabs></PageContent></PageObject>
109EOT;
110 $this->assertXmlEquals(
111 $expected,
112 $page->getXMLFromDom()
113 );
114 }

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

+ Here is the call graph for this function:

◆ testContentWidth()

PCTabsTest::testContentWidth ( )

Definition at line 70 of file PCTabsTest.php.

70 : void
71 {
72 $page = $this->getEmptyPageWithDom();
73 $pc = new ilPCTabs($page);
74 $pc->create($page, "pg", "");
75 $pc->setContentWidth("100");
76
77 $this->assertEquals(
78 "100",
79 $pc->getContentWidth()
80 );
81
82 $page->stripHierIDs();
83
84 $expected = <<<EOT
85<PageObject><PageContent><Tabs ContentWidth="100"></Tabs></PageContent></PageObject>
86EOT;
87 $this->assertXmlEquals(
88 $expected,
89 $page->getXMLFromDom()
90 );
91 }

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

+ Here is the call graph for this function:

◆ testCreate()

PCTabsTest::testCreate ( )

Definition at line 36 of file PCTabsTest.php.

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

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

+ Here is the call graph for this function:

◆ testDeleteItem()

PCTabsTest::testDeleteItem ( )

Definition at line 417 of file PCTabsTest.php.

417 : void
418 {
419 $page = $this->getEmptyPageWithDom();
420 $pc = $this->getTabsWithTabs($page);
421 $tab = $this->getTabForHierId($page, "1_2");
422 $tab->deleteItem();
423
424 $page->stripHierIDs();
425 $page->stripPCIDs();
426
427 $expected = <<<EOT
428<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>One</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
429EOT;
430 $this->assertXmlEquals(
431 $expected,
432 $page->getXMLFromDom()
433 );
434 }
getTabForHierId(ilPageObject $page, string $hier_id)
Definition: PCTabsTest.php:367

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

+ Here is the call graph for this function:

◆ testDeleteTab()

PCTabsTest::testDeleteTab ( )

Definition at line 271 of file PCTabsTest.php.

271 : void
272 {
273 $page = $this->getEmptyPageWithDom();
274 $pc = $this->getTabsWithTabs($page);
275 $pc->deleteTab("1_2", "");
276
277 $page->stripHierIDs();
278
279 $expected = <<<EOT
280<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>One</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
281EOT;
282 $this->assertXmlEquals(
283 $expected,
284 $page->getXMLFromDom()
285 );
286 }

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

+ Here is the call graph for this function:

◆ testHorizontalAlign()

PCTabsTest::testHorizontalAlign ( )

Definition at line 116 of file PCTabsTest.php.

116 : void
117 {
118 $page = $this->getEmptyPageWithDom();
119 $pc = new ilPCTabs($page);
120 $pc->create($page, "pg", "");
121 $pc->setHorizontalAlign("Right");
122
123 $this->assertEquals(
124 "Right",
125 $pc->getHorizontalAlign()
126 );
127
128 $page->stripHierIDs();
129
130 $expected = <<<EOT
131<PageObject><PageContent><Tabs HorizontalAlign="Right"></Tabs></PageContent></PageObject>
132EOT;
133 $this->assertXmlEquals(
134 $expected,
135 $page->getXMLFromDom()
136 );
137 }

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

+ Here is the call graph for this function:

◆ testMoveItemDown()

PCTabsTest::testMoveItemDown ( )

Definition at line 436 of file PCTabsTest.php.

436 : void
437 {
438 $page = $this->getEmptyPageWithDom();
439 $pc = $this->getTabsWithTabs($page);
440 $tab = $this->getTabForHierId($page, "1_1");
441 $tab->moveItemDown();
442
443 $page->stripHierIDs();
444 $page->stripPCIDs();
445
446 $expected = <<<EOT
447<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>One</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
448EOT;
449 $this->assertXmlEquals(
450 $expected,
451 $page->getXMLFromDom()
452 );
453 }

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

+ Here is the call graph for this function:

◆ testMoveItemUp()

PCTabsTest::testMoveItemUp ( )

Definition at line 455 of file PCTabsTest.php.

455 : void
456 {
457 $page = $this->getEmptyPageWithDom();
458 $pc = $this->getTabsWithTabs($page);
459 $tab = $this->getTabForHierId($page, "1_2");
460 $tab->moveItemUp();
461
462 $page->stripHierIDs();
463 $page->stripPCIDs();
464
465 $expected = <<<EOT
466<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>One</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
467EOT;
468 $this->assertXmlEquals(
469 $expected,
470 $page->getXMLFromDom()
471 );
472 }

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

+ Here is the call graph for this function:

◆ testNewItemAfter()

PCTabsTest::testNewItemAfter ( )

Definition at line 379 of file PCTabsTest.php.

379 : void
380 {
381 $page = $this->getEmptyPageWithDom();
382 $pc = $this->getTabsWithTabs($page);
383 $tab = $this->getTabForHierId($page, "1_1");
384 $tab->newItemAfter();
385
386 $page->stripHierIDs();
387 $page->stripPCIDs();
388
389 $expected = <<<EOT
390<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>One</TabCaption></Tab><Tab></Tab><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
391EOT;
392 $this->assertXmlEquals(
393 $expected,
394 $page->getXMLFromDom()
395 );
396 }

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

+ Here is the call graph for this function:

◆ testNewItemBefore()

PCTabsTest::testNewItemBefore ( )

Definition at line 398 of file PCTabsTest.php.

398 : void
399 {
400 $page = $this->getEmptyPageWithDom();
401 $pc = $this->getTabsWithTabs($page);
402 $tab = $this->getTabForHierId($page, "1_2");
403 $tab->newItemBefore();
404
405 $page->stripHierIDs();
406 $page->stripPCIDs();
407
408 $expected = <<<EOT
409<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>One</TabCaption></Tab><Tab></Tab><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>Three</TabCaption></Tab></Tabs></PageContent></PageObject>
410EOT;
411 $this->assertXmlEquals(
412 $expected,
413 $page->getXMLFromDom()
414 );
415 }

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

+ Here is the call graph for this function:

◆ testPositions()

PCTabsTest::testPositions ( )

Definition at line 248 of file PCTabsTest.php.

248 : void
249 {
250 $page = $this->getEmptyPageWithDom();
251 $pc = $this->getTabsWithTabs($page);
252 $pc->savePositions(
253 [
254 "1_1:" => 3,
255 "1_2:" => 2,
256 "1_3:" => 1
257 ]
258 );
259
260 $page->stripHierIDs();
261
262 $expected = <<<EOT
263<PageObject><PageContent><Tabs Type="HorizontalAccordion"><Tab><TabCaption>Three</TabCaption></Tab><Tab><TabCaption>Two</TabCaption></Tab><Tab><TabCaption>One</TabCaption></Tab></Tabs></PageContent></PageObject>
264EOT;
265 $this->assertXmlEquals(
266 $expected,
267 $page->getXMLFromDom()
268 );
269 }

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

+ Here is the call graph for this function:

◆ testRandomStart()

PCTabsTest::testRandomStart ( )

Definition at line 334 of file PCTabsTest.php.

334 : void
335 {
336 $page = $this->getEmptyPageWithDom();
337 $pc = new ilPCTabs($page);
338 $pc->create($page, "pg", "");
339
340 $pc->setRandomStart(false);
341 $this->assertEquals(
342 false,
343 $pc->getRandomStart()
344 );
345
346 $pc->setRandomStart(true);
347 $this->assertEquals(
348 true,
349 $pc->getRandomStart()
350 );
351
352 $page->stripHierIDs();
353
354 $expected = <<<EOT
355<PageObject><PageContent><Tabs RandomStart="1"></Tabs></PageContent></PageObject>
356EOT;
357 $this->assertXmlEquals(
358 $expected,
359 $page->getXMLFromDom()
360 );
361 }

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

+ Here is the call graph for this function:

◆ testTemplate()

PCTabsTest::testTemplate ( )

Definition at line 288 of file PCTabsTest.php.

288 : void
289 {
290 $page = $this->getEmptyPageWithDom();
291 $pc = new ilPCTabs($page);
292 $pc->create($page, "pg", "");
293 $pc->setTemplate("MyTemplate");
294
295 $this->assertEquals(
296 "MyTemplate",
297 $pc->getTemplate()
298 );
299
300 $page->stripHierIDs();
301
302 $expected = <<<EOT
303<PageObject><PageContent><Tabs Template="MyTemplate"></Tabs></PageContent></PageObject>
304EOT;
305 $this->assertXmlEquals(
306 $expected,
307 $page->getXMLFromDom()
308 );
309 }

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

+ Here is the call graph for this function:

◆ testType()

PCTabsTest::testType ( )

Definition at line 47 of file PCTabsTest.php.

47 : void
48 {
49 $page = $this->getEmptyPageWithDom();
50 $pc = new ilPCTabs($page);
51 $pc->create($page, "pg", "");
52 $pc->setTabType("Carousel");
53
54 $this->assertEquals(
55 "Carousel",
56 $pc->getTabType()
57 );
58
59 $page->stripHierIDs();
60
61 $expected = <<<EOT
62<PageObject><PageContent><Tabs Type="Carousel"></Tabs></PageContent></PageObject>
63EOT;
64 $this->assertXmlEquals(
65 $expected,
66 $page->getXMLFromDom()
67 );
68 }

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

+ Here is the call graph for this function:

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