ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
PCMediaObjectTest Class Reference
+ Inheritance diagram for PCMediaObjectTest:
+ Collaboration diagram for PCMediaObjectTest:

Public Member Functions

 testConstruction ()
 
 testCreate ()
 
 testCreateAlias ()
 
 testDump ()
 
 testSetClass ()
 
 testCaptionClass ()
 
 checkMAProps (Closure $assert, ?string $expected=null)
 
 testWidth ()
 
 testHeight ()
 
 testDeriveSize ()
 
 testCaption ()
 
 testDeriveCaption ()
 
 testTextRepresentation ()
 
 testDeriveTextRepresentation ()
 
 testHorizontalAlign ()
 
 testParameters ()
 
 testDeriveParameters ()
 
 testAddMapArea ()
 
 testDeleteMapArea ()
 
 testDeleteMapAreaById ()
 
 testDeleteAllMapAreas ()
 
 testAreaProps ()
 

Protected Member Functions

 getObjectAdapterMock ()
 
 getMediaObjectInPage (ilPageObject $page)
 
- 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 27 of file PCMediaObjectTest.php.

Member Function Documentation

◆ checkMAProps()

PCMediaObjectTest::checkMAProps ( Closure  $assert,
?string  $expected = null 
)

Definition at line 165 of file PCMediaObjectTest.php.

168 : void {
169 $page = $this->getEmptyPageWithDom();
170 $pc = $this->getMediaObjectInPage($page);
171 $ma = $pc->getStandardMediaAliasItem();
172
173 $assert($ma);
174
175 $page->stripHierIDs();
176 $page->stripPCIDs();
177
178 if (!is_null($expected)) {
179 $this->assertXmlEquals(
180 $expected,
181 $page->getXMLFromDom()
182 );
183 }
184 }
assertXmlEquals(string $expected_xml_as_string, string $html_xml_string)
getMediaObjectInPage(ilPageObject $page)

◆ getMediaObjectInPage()

PCMediaObjectTest::getMediaObjectInPage ( ilPageObject  $page)
protected

Definition at line 82 of file PCMediaObjectTest.php.

83 {
84 $pc = new ilPCMediaObject($page);
85 $pc->setMediaObject($this->getMediaObjectMock());
86 $pc->createAlias($page, "pg");
87 $page->addHierIDs();
88 $page->insertPCIds();
89 $pc->setHierId("1");
90 $pc->setPCId($page->getPCIdForHierId("1"));
91 $pc->setDomNode($pc->getDomNode());
92 return $pc;
93 }
Class ilPCMediaObject Media content object (see ILIAS DTD)
addHierIDs()
Add hierarchical ID (e.g.
insertPCIds()
Insert Page Content IDs.
getPCIdForHierId(string $hier_id)

References ilPageObject\addHierIDs(), COPageTestBase\getMediaObjectMock(), ilPageObject\getPCIdForHierId(), and ilPageObject\insertPCIds().

Referenced by testCaptionClass(), testDump(), and testSetClass().

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

◆ getObjectAdapterMock()

PCMediaObjectTest::getObjectAdapterMock ( )
protected
Returns
(\ILIAS\Repository\Object\ObjectAdapter&\PHPUnit\Framework\MockObject\MockObject)|\PHPUnit\Framework\MockObject\MockObject

Definition at line 32 of file PCMediaObjectTest.php.

32 : MockObject
33 {
34 $object_adapter = $this->getMockBuilder(\ILIAS\Repository\Object\ObjectAdapter::class)
35 ->disableOriginalConstructor()
36 ->getMock();
37 $object_adapter->method("getTypeForObjId")
38 ->willReturnCallback(fn() => "dummy");
39 return $object_adapter;
40 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

◆ testAddMapArea()

PCMediaObjectTest::testAddMapArea ( )

Definition at line 412 of file PCMediaObjectTest.php.

412 : void
413 {
414 $this->checkMAProps(
415 function (ilMediaAliasItem $ma): void {
416 $ma->addMapArea(
418 "10,10,100,100",
419 "Area Title",
420 [
421 "LinkType" => "ext",
422 "Href" => "http://www.ilias.de"
423 ],
424 "One"
425 );
426 $this->assertEquals(
427 [
428 0 => [
429 "Nr" => 1,
430 "Shape" => "Rect",
431 "Coords" => "10,10,100,100",
432 "HighlightMode" => "",
433 "HighlightClass" => "",
434 "Id" => "One",
435 "Link" => [
436 "LinkType" => "ExtLink",
437 "Href" => "http://www.ilias.de",
438 "Title" => "Area Title"
439 ]
440 ]
441 ],
442 $ma->getMapAreas()
443 );
444 $this->assertEquals(
445 "http://www.ilias.de",
446 $ma->getHrefOfArea(1)
447 );
448 },
449 $expected = <<<EOT
450<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><MapArea Shape="Rect" Coords="10,10,100,100" Id="One"><ExtLink Href="http://www.ilias.de">Area Title</ExtLink></MapArea></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
451EOT
452 );
453 }
checkMAProps(Closure $assert, ?string $expected=null)
Title class.
Definition: Title.php:42
const IL_AREA_RECT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getHrefOfArea(int $a_nr)
Get href (only external link)
addMapArea(string $a_shape_type, string $a_coords, string $a_title, array $a_link, string $a_id="", string $hl_mode="", string $hl_class="",)
Add a new area to the map.
getMapAreas()
Get all map areas.

References ilMediaAliasItem\addMapArea(), ilMediaAliasItem\getHrefOfArea(), ilMediaAliasItem\getMapAreas(), and IL_AREA_RECT.

+ Here is the call graph for this function:

◆ testAreaProps()

PCMediaObjectTest::testAreaProps ( )

Definition at line 551 of file PCMediaObjectTest.php.

551 : void
552 {
553 $this->checkMAProps(
554 function (ilMediaAliasItem $ma): void {
555 $ma->addMapArea(
557 "10,10,100,100",
558 "Area Title",
559 [
560 "LinkType" => "int",
561 "Type" => "ltype",
562 "Target" => "ltarget",
563 "TargetFrame" => "ltargetframe"
564 ],
565 "One"
566 );
567 $this->assertEquals(
568 "int",
569 $ma->getLinkTypeOfArea(1)
570 );
571 $this->assertEquals(
572 "ltype",
573 $ma->getTypeOfArea(1)
574 );
575 $this->assertEquals(
576 "ltarget",
577 $ma->getTargetOfArea(1)
578 );
579 $this->assertEquals(
580 "ltargetframe",
582 );
583 $this->assertEquals(
584 "Area Title",
585 $ma->getTitleOfArea(1)
586 );
587 },
588 null
589 );
590 }
getTitleOfArea(int $a_nr)
Get title.
getTargetFrameOfArea(int $a_nr)
Get target frame (only internal link)
getTypeOfArea(int $a_nr)
Get type (only internal link)
getTargetOfArea(int $a_nr)
Get target (only internal link)
getLinkTypeOfArea(int $a_nr)
Get link type.

References ilMediaAliasItem\addMapArea(), ilMediaAliasItem\getLinkTypeOfArea(), ilMediaAliasItem\getTargetFrameOfArea(), ilMediaAliasItem\getTargetOfArea(), ilMediaAliasItem\getTitleOfArea(), ilMediaAliasItem\getTypeOfArea(), and IL_AREA_RECT.

+ Here is the call graph for this function:

◆ testCaption()

PCMediaObjectTest::testCaption ( )

Definition at line 252 of file PCMediaObjectTest.php.

252 : void
253 {
254 $this->checkMAProps(
255 function (ilMediaAliasItem $ma): void {
256 $this->assertEquals(
257 false,
258 $ma->definesCaption()
259 );
260 $ma->setCaption("My Caption");
261 $this->assertEquals(
262 "My Caption",
263 $ma->getCaption()
264 );
265 $this->assertEquals(
266 true,
267 $ma->definesCaption()
268 );
269 },
270 $expected = <<<EOT
271<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><Caption Align="bottom">My Caption</Caption></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
272EOT
273 );
274 }
setCaption(string $a_caption)
definesCaption()
check if alias item defines own caption or derives caption from object

References ilMediaAliasItem\definesCaption(), ilMediaAliasItem\getCaption(), and ilMediaAliasItem\setCaption().

+ Here is the call graph for this function:

◆ testCaptionClass()

PCMediaObjectTest::testCaptionClass ( )

Definition at line 138 of file PCMediaObjectTest.php.

138 : void
139 {
140 $page = $this->getEmptyPageWithDom();
141 $pc = $this->getMediaObjectInPage($page);
142
143 $pc->setCaptionClass("MyCaptionClass");
144
145 $this->assertEquals(
146 "MyCaptionClass",
147 $pc->getCaptionClass()
148 );
149
150 $page->stripHierIDs();
151 $page->stripPCIDs();
152
153 $expected = <<<EOT
154<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0" CaptionClass="MyCaptionClass"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent></PageObject>
155EOT;
156
157 $this->assertXmlEquals(
158 $expected,
159 $page->getXMLFromDom()
160 );
161 }

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

+ Here is the call graph for this function:

◆ testConstruction()

PCMediaObjectTest::testConstruction ( )

Definition at line 42 of file PCMediaObjectTest.php.

42 : void
43 {
44 $page = $this->getEmptyPageWithDom();
45 $pc = new ilPCMediaObject($page);
46 $this->assertEquals(
47 ilPCMediaObject::class,
48 get_class($pc)
49 );
50 }

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCMediaObjectTest::testCreate ( )

Definition at line 52 of file PCMediaObjectTest.php.

52 : void
53 {
54 $page = $this->getEmptyPageWithDom();
55 $pc = new ilPCMediaObject($page);
56 $pc->create($page, "pg");
57 $this->assertXmlEquals(
58 '<PageObject HierId="pg"></PageObject>',
59 $page->getXMLFromDom()
60 );
61 }

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

+ Here is the call graph for this function:

◆ testCreateAlias()

PCMediaObjectTest::testCreateAlias ( )

Definition at line 63 of file PCMediaObjectTest.php.

63 : void
64 {
65 $page = $this->getEmptyPageWithDom();
66 $pc = new ilPCMediaObject($page);
67 $pc->setMediaObject($this->getMediaObjectMock());
68 $pc->createAlias($page, "pg");
69
70 $page->stripHierIDs();
71
72 $expected = <<<EOT
73<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
74EOT;
75
76 $this->assertXmlEquals(
77 $expected,
78 $page->getXMLFromDom()
79 );
80 }

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

+ Here is the call graph for this function:

◆ testDeleteAllMapAreas()

PCMediaObjectTest::testDeleteAllMapAreas ( )

Definition at line 519 of file PCMediaObjectTest.php.

519 : void
520 {
521 $this->checkMAProps(
522 function (ilMediaAliasItem $ma): void {
523 $ma->addMapArea(
525 "10,10,100,100",
526 "Area Title",
527 [
528 "LinkType" => "ext",
529 "Href" => "http://www.ilias.de"
530 ],
531 "One"
532 );
533 $ma->addMapArea(
535 "11,11,101,101",
536 "Area Title 2",
537 [
538 "LinkType" => "ext",
539 "Href" => "http://ilias.de"
540 ],
541 "Two"
542 );
543 $ma->deleteAllMapAreas();
544 },
545 $expected = <<<EOT
546<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
547EOT
548 );
549 }
deleteAllMapAreas()
Delete all map areas.

References ilMediaAliasItem\addMapArea(), ilMediaAliasItem\deleteAllMapAreas(), and IL_AREA_RECT.

+ Here is the call graph for this function:

◆ testDeleteMapArea()

PCMediaObjectTest::testDeleteMapArea ( )

Definition at line 455 of file PCMediaObjectTest.php.

455 : void
456 {
457 $this->checkMAProps(
458 function (ilMediaAliasItem $ma): void {
459 $ma->addMapArea(
461 "10,10,100,100",
462 "Area Title",
463 [
464 "LinkType" => "ext",
465 "Href" => "http://www.ilias.de"
466 ],
467 "One"
468 );
469 $ma->addMapArea(
471 "11,11,101,101",
472 "Area Title 2",
473 [
474 "LinkType" => "ext",
475 "Href" => "http://ilias.de"
476 ],
477 "Two"
478 );
479 $ma->deleteMapArea(1);
480 },
481 $expected = <<<EOT
482<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><MapArea Shape="Rect" Coords="11,11,101,101" Id="Two"><ExtLink Href="http://ilias.de">Area Title 2</ExtLink></MapArea></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
483EOT
484 );
485 }
deleteMapArea(int $a_nr)
Delete a sinlge map area.

References ilMediaAliasItem\addMapArea(), ilMediaAliasItem\deleteMapArea(), and IL_AREA_RECT.

+ Here is the call graph for this function:

◆ testDeleteMapAreaById()

PCMediaObjectTest::testDeleteMapAreaById ( )

Definition at line 487 of file PCMediaObjectTest.php.

487 : void
488 {
489 $this->checkMAProps(
490 function (ilMediaAliasItem $ma): void {
491 $ma->addMapArea(
493 "10,10,100,100",
494 "Area Title",
495 [
496 "LinkType" => "ext",
497 "Href" => "http://www.ilias.de"
498 ],
499 "One"
500 );
501 $ma->addMapArea(
503 "11,11,101,101",
504 "Area Title 2",
505 [
506 "LinkType" => "ext",
507 "Href" => "http://ilias.de"
508 ],
509 "Two"
510 );
511 $ma->deleteMapAreaById("One");
512 },
513 $expected = <<<EOT
514<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><MapArea Shape="Rect" Coords="11,11,101,101" Id="Two"><ExtLink Href="http://ilias.de">Area Title 2</ExtLink></MapArea></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
515EOT
516 );
517 }
deleteMapAreaById(string $a_id)
Delete map areas by id.

References ilMediaAliasItem\addMapArea(), ilMediaAliasItem\deleteMapAreaById(), and IL_AREA_RECT.

+ Here is the call graph for this function:

◆ testDeriveCaption()

PCMediaObjectTest::testDeriveCaption ( )

Definition at line 276 of file PCMediaObjectTest.php.

276 : void
277 {
278 $this->checkMAProps(
279 function (ilMediaAliasItem $ma): void {
280 $ma->setCaption("My Caption");
281 $this->assertEquals(
282 true,
283 $ma->definesCaption()
284 );
285 $ma->deriveCaption();
286 $this->assertEquals(
287 false,
288 $ma->definesCaption()
289 );
290 },
291 $expected = <<<EOT
292<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
293EOT
294 );
295 }
deriveCaption()
derive caption from object (-> caption element is removed from media alias item)

References ilMediaAliasItem\definesCaption(), ilMediaAliasItem\deriveCaption(), and ilMediaAliasItem\setCaption().

+ Here is the call graph for this function:

◆ testDeriveParameters()

PCMediaObjectTest::testDeriveParameters ( )

Definition at line 392 of file PCMediaObjectTest.php.

392 : void
393 {
394 $this->checkMAProps(
395 function (ilMediaAliasItem $ma): void {
396 $ma->setParameters([
397 "par1" => "val1",
398 "par2" => "val2"
399 ]);
400 $ma->deriveParameters();
401 $this->assertEquals(
402 false,
403 $ma->definesParameters()
404 );
405 },
406 $expected = <<<EOT
407<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
408EOT
409 );
410 }
setParameters(array $a_par_array)
definesParameters()
check if alias item defines own parameters or derives parameters from object
deriveParameters()
derive parameters from object (-> all parameter elements are removed from media alias item)

References ilMediaAliasItem\definesParameters(), ilMediaAliasItem\deriveParameters(), and ilMediaAliasItem\setParameters().

+ Here is the call graph for this function:

◆ testDeriveSize()

PCMediaObjectTest::testDeriveSize ( )

Definition at line 226 of file PCMediaObjectTest.php.

226 : void
227 {
228 $this->checkMAProps(
229 function (ilMediaAliasItem $ma): void {
230 $this->assertEquals(
231 false,
232 $ma->definesSize()
233 );
234 $ma->setWidth("222");
235 $ma->setHeight("111");
236 $this->assertEquals(
237 true,
238 $ma->definesSize()
239 );
240 $ma->deriveSize();
241 $this->assertEquals(
242 false,
243 $ma->definesSize()
244 );
245 },
246 $expected = <<<EOT
247<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent></PageObject>
248EOT
249 );
250 }
setHeight(string $a_height)
setWidth(string $a_width)
definesSize()
check if alias item defines own size or derives size from object
deriveSize()
derive size from object (-> width and height attributes are removed from layout element)

References ilMediaAliasItem\definesSize(), ilMediaAliasItem\deriveSize(), ilMediaAliasItem\setHeight(), and ilMediaAliasItem\setWidth().

+ Here is the call graph for this function:

◆ testDeriveTextRepresentation()

PCMediaObjectTest::testDeriveTextRepresentation ( )

Definition at line 321 of file PCMediaObjectTest.php.

321 : void
322 {
323 $this->checkMAProps(
324 function (ilMediaAliasItem $ma): void {
325 $ma->setTextRepresentation("My Text");
326 $this->assertEquals(
327 true,
329 );
331 $this->assertEquals(
332 false,
334 );
335 },
336 $expected = <<<EOT
337<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
338EOT
339 );
340 }
definesTextRepresentation()
check if alias item defines own TextRepresentation or derives TextRepresentation from object
setTextRepresentation(string $a_text_representation)
deriveTextRepresentation()
derive TextRepresentation from object (-> TextRepresentation element is removed from media alias item...

References ilMediaAliasItem\definesTextRepresentation(), ilMediaAliasItem\deriveTextRepresentation(), and ilMediaAliasItem\setTextRepresentation().

+ Here is the call graph for this function:

◆ testDump()

PCMediaObjectTest::testDump ( )

Definition at line 95 of file PCMediaObjectTest.php.

95 : void
96 {
97 $page = $this->getEmptyPageWithDom();
98 $pc = $this->getMediaObjectInPage($page);
99
100 $page->stripHierIDs();
101 $page->stripPCIDs();
102
103 $expected = <<<EOT
104<PageContent><MediaObject><MediaAlias OriginId="il__mob_0"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent>
105EOT;
106
107 $this->assertXmlEquals(
108 $expected,
109 $pc->dumpXML()
110 );
111 }

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

+ Here is the call graph for this function:

◆ testHeight()

PCMediaObjectTest::testHeight ( )

Definition at line 210 of file PCMediaObjectTest.php.

210 : void
211 {
212 $this->checkMAProps(
213 function (ilMediaAliasItem $ma): void {
214 $ma->setHeight("11");
215 $this->assertEquals(
216 "11",
217 $ma->getHeight()
218 );
219 },
220 $expected = <<<EOT
221<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left" Height="11"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent></PageObject>
222EOT
223 );
224 }

References ilMediaAliasItem\getHeight(), and ilMediaAliasItem\setHeight().

+ Here is the call graph for this function:

◆ testHorizontalAlign()

PCMediaObjectTest::testHorizontalAlign ( )

Definition at line 342 of file PCMediaObjectTest.php.

342 : void
343 {
344 $this->checkMAProps(
345 function (ilMediaAliasItem $ma): void {
346 $ma->setHorizontalAlign("Right");
347 $this->assertEquals(
348 "Right",
349 $ma->getHorizontalAlign()
350 );
351 },
352 $expected = <<<EOT
353<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Right"></Layout></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
354EOT
355 );
356 }
setHorizontalAlign(string $a_halign)

References ilMediaAliasItem\getHorizontalAlign(), and ilMediaAliasItem\setHorizontalAlign().

+ Here is the call graph for this function:

◆ testParameters()

PCMediaObjectTest::testParameters ( )

Definition at line 358 of file PCMediaObjectTest.php.

358 : void
359 {
360 $this->checkMAProps(
361 function (ilMediaAliasItem $ma): void {
362 $this->assertEquals(
363 false,
364 $ma->definesParameters()
365 );
366 $ma->setParameters([
367 "par1" => "val1",
368 "par2" => "val2"
369 ]);
370 $this->assertEquals(
371 [
372 "par1" => "val1",
373 "par2" => "val2"
374 ],
375 $ma->getParameters()
376 );
377 $this->assertEquals(
378 true,
379 $ma->definesParameters()
380 );
381 $this->assertEquals(
382 'par1="val1", par2="val2"',
383 $ma->getParameterString()
384 );
385 },
386 $expected = <<<EOT
387<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><Parameter Name="par1" Value="val1"></Parameter><Parameter Name="par2" Value="val2"></Parameter></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
388EOT
389 );
390 }
getParameterString()
Get all parameters as string.
getParameters()
Get all parameters as array.

References ilMediaAliasItem\definesParameters(), ilMediaAliasItem\getParameters(), ilMediaAliasItem\getParameterString(), and ilMediaAliasItem\setParameters().

+ Here is the call graph for this function:

◆ testSetClass()

PCMediaObjectTest::testSetClass ( )

Definition at line 113 of file PCMediaObjectTest.php.

113 : void
114 {
115 $page = $this->getEmptyPageWithDom();
116 $pc = $this->getMediaObjectInPage($page);
117
118 $pc->setClass("MyClass");
119
120 $this->assertEquals(
121 "MyClass",
122 $pc->getClass()
123 );
124
125 $page->stripHierIDs();
126 $page->stripPCIDs();
127
128 $expected = <<<EOT
129<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0" Class="MyClass"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent></PageObject>
130EOT;
131
132 $this->assertXmlEquals(
133 $expected,
134 $page->getXMLFromDom()
135 );
136 }

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

+ Here is the call graph for this function:

◆ testTextRepresentation()

PCMediaObjectTest::testTextRepresentation ( )

Definition at line 297 of file PCMediaObjectTest.php.

297 : void
298 {
299 $this->checkMAProps(
300 function (ilMediaAliasItem $ma): void {
301 $this->assertEquals(
302 false,
304 );
305 $ma->setTextRepresentation("My Text");
306 $this->assertEquals(
307 "My Text",
309 );
310 $this->assertEquals(
311 true,
313 );
314 },
315 $expected = <<<EOT
316<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"></MediaAlias><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left"></Layout><TextRepresentation>My Text</TextRepresentation></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"></Layout></MediaAliasItem></MediaObject></PageContent></PageObject>
317EOT
318 );
319 }

References ilMediaAliasItem\definesTextRepresentation(), ilMediaAliasItem\getTextRepresentation(), and ilMediaAliasItem\setTextRepresentation().

+ Here is the call graph for this function:

◆ testWidth()

PCMediaObjectTest::testWidth ( )

Definition at line 186 of file PCMediaObjectTest.php.

186 : void
187 {
188 $this->checkMAProps(
189 function (ilMediaAliasItem $ma): void {
190 $this->assertEquals(
191 false,
192 $ma->definesSize()
193 );
194 $ma->setWidth("222");
195 $this->assertEquals(
196 "222",
197 $ma->getWidth()
198 );
199 $this->assertEquals(
200 true,
201 $ma->definesSize()
202 );
203 },
204 $expected = <<<EOT
205<PageObject><PageContent><MediaObject><MediaAlias OriginId="il__mob_0"/><MediaAliasItem Purpose="Standard"><Layout HorizontalAlign="Left" Width="222"/></MediaAliasItem><MediaAliasItem Purpose="Fullscreen"><Layout Width="100" Height="50"/></MediaAliasItem></MediaObject></PageContent></PageObject>
206EOT
207 );
208 }

References ilMediaAliasItem\definesSize(), ilMediaAliasItem\getWidth(), and ilMediaAliasItem\setWidth().

+ Here is the call graph for this function:

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