ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 26 of file PCMediaObjectTest.php.

Member Function Documentation

◆ checkMAProps()

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

Definition at line 164 of file PCMediaObjectTest.php.

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

◆ getMediaObjectInPage()

PCMediaObjectTest::getMediaObjectInPage ( ilPageObject  $page)
protected

Definition at line 81 of file PCMediaObjectTest.php.

82 {
83 $pc = new ilPCMediaObject($page);
84 $pc->setMediaObject($this->getMediaObjectMock());
85 $pc->createAlias($page, "pg");
86 $page->addHierIDs();
87 $page->insertPCIds();
88 $pc->setHierId("1");
89 $pc->setPCId($page->getPCIdForHierId("1"));
90 $pc->setDomNode($pc->getDomNode());
91 return $pc;
92 }
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 31 of file PCMediaObjectTest.php.

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

◆ testAddMapArea()

PCMediaObjectTest::testAddMapArea ( )

Definition at line 411 of file PCMediaObjectTest.php.

411 : void
412 {
413 $this->checkMAProps(
414 function (ilMediaAliasItem $ma): void {
415 $ma->addMapArea(
417 "10,10,100,100",
418 "Area Title",
419 [
420 "LinkType" => "ext",
421 "Href" => "http://www.ilias.de"
422 ],
423 "One"
424 );
425 $this->assertEquals(
426 [
427 0 => [
428 "Nr" => 1,
429 "Shape" => "Rect",
430 "Coords" => "10,10,100,100",
431 "HighlightMode" => "",
432 "HighlightClass" => "",
433 "Id" => "One",
434 "Link" => [
435 "LinkType" => "ExtLink",
436 "Href" => "http://www.ilias.de",
437 "Title" => "Area Title"
438 ]
439 ]
440 ],
441 $ma->getMapAreas()
442 );
443 $this->assertEquals(
444 "http://www.ilias.de",
445 $ma->getHrefOfArea(1)
446 );
447 },
448 $expected = <<<EOT
449<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>
450EOT
451 );
452 }
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 550 of file PCMediaObjectTest.php.

550 : void
551 {
552 $this->checkMAProps(
553 function (ilMediaAliasItem $ma): void {
554 $ma->addMapArea(
556 "10,10,100,100",
557 "Area Title",
558 [
559 "LinkType" => "int",
560 "Type" => "ltype",
561 "Target" => "ltarget",
562 "TargetFrame" => "ltargetframe"
563 ],
564 "One"
565 );
566 $this->assertEquals(
567 "int",
568 $ma->getLinkTypeOfArea(1)
569 );
570 $this->assertEquals(
571 "ltype",
572 $ma->getTypeOfArea(1)
573 );
574 $this->assertEquals(
575 "ltarget",
576 $ma->getTargetOfArea(1)
577 );
578 $this->assertEquals(
579 "ltargetframe",
581 );
582 $this->assertEquals(
583 "Area Title",
584 $ma->getTitleOfArea(1)
585 );
586 },
587 null
588 );
589 }
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 251 of file PCMediaObjectTest.php.

251 : void
252 {
253 $this->checkMAProps(
254 function (ilMediaAliasItem $ma): void {
255 $this->assertEquals(
256 false,
257 $ma->definesCaption()
258 );
259 $ma->setCaption("My Caption");
260 $this->assertEquals(
261 "My Caption",
262 $ma->getCaption()
263 );
264 $this->assertEquals(
265 true,
266 $ma->definesCaption()
267 );
268 },
269 $expected = <<<EOT
270<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>
271EOT
272 );
273 }
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 137 of file PCMediaObjectTest.php.

137 : void
138 {
139 $page = $this->getEmptyPageWithDom();
140 $pc = $this->getMediaObjectInPage($page);
141
142 $pc->setCaptionClass("MyCaptionClass");
143
144 $this->assertEquals(
145 "MyCaptionClass",
146 $pc->getCaptionClass()
147 );
148
149 $page->stripHierIDs();
150 $page->stripPCIDs();
151
152 $expected = <<<EOT
153<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>
154EOT;
155
156 $this->assertXmlEquals(
157 $expected,
158 $page->getXMLFromDom()
159 );
160 }

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

+ Here is the call graph for this function:

◆ testConstruction()

PCMediaObjectTest::testConstruction ( )

Definition at line 41 of file PCMediaObjectTest.php.

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

References COPageTestBase\getEmptyPageWithDom().

+ Here is the call graph for this function:

◆ testCreate()

PCMediaObjectTest::testCreate ( )

Definition at line 51 of file PCMediaObjectTest.php.

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

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

+ Here is the call graph for this function:

◆ testCreateAlias()

PCMediaObjectTest::testCreateAlias ( )

Definition at line 62 of file PCMediaObjectTest.php.

62 : void
63 {
64 $page = $this->getEmptyPageWithDom();
65 $pc = new ilPCMediaObject($page);
66 $pc->setMediaObject($this->getMediaObjectMock());
67 $pc->createAlias($page, "pg");
68
69 $page->stripHierIDs();
70
71 $expected = <<<EOT
72<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>
73EOT;
74
75 $this->assertXmlEquals(
76 $expected,
77 $page->getXMLFromDom()
78 );
79 }

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

+ Here is the call graph for this function:

◆ testDeleteAllMapAreas()

PCMediaObjectTest::testDeleteAllMapAreas ( )

Definition at line 518 of file PCMediaObjectTest.php.

518 : void
519 {
520 $this->checkMAProps(
521 function (ilMediaAliasItem $ma): void {
522 $ma->addMapArea(
524 "10,10,100,100",
525 "Area Title",
526 [
527 "LinkType" => "ext",
528 "Href" => "http://www.ilias.de"
529 ],
530 "One"
531 );
532 $ma->addMapArea(
534 "11,11,101,101",
535 "Area Title 2",
536 [
537 "LinkType" => "ext",
538 "Href" => "http://ilias.de"
539 ],
540 "Two"
541 );
542 $ma->deleteAllMapAreas();
543 },
544 $expected = <<<EOT
545<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>
546EOT
547 );
548 }
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 454 of file PCMediaObjectTest.php.

454 : void
455 {
456 $this->checkMAProps(
457 function (ilMediaAliasItem $ma): void {
458 $ma->addMapArea(
460 "10,10,100,100",
461 "Area Title",
462 [
463 "LinkType" => "ext",
464 "Href" => "http://www.ilias.de"
465 ],
466 "One"
467 );
468 $ma->addMapArea(
470 "11,11,101,101",
471 "Area Title 2",
472 [
473 "LinkType" => "ext",
474 "Href" => "http://ilias.de"
475 ],
476 "Two"
477 );
478 $ma->deleteMapArea(1);
479 },
480 $expected = <<<EOT
481<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>
482EOT
483 );
484 }
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 486 of file PCMediaObjectTest.php.

486 : void
487 {
488 $this->checkMAProps(
489 function (ilMediaAliasItem $ma): void {
490 $ma->addMapArea(
492 "10,10,100,100",
493 "Area Title",
494 [
495 "LinkType" => "ext",
496 "Href" => "http://www.ilias.de"
497 ],
498 "One"
499 );
500 $ma->addMapArea(
502 "11,11,101,101",
503 "Area Title 2",
504 [
505 "LinkType" => "ext",
506 "Href" => "http://ilias.de"
507 ],
508 "Two"
509 );
510 $ma->deleteMapAreaById("One");
511 },
512 $expected = <<<EOT
513<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>
514EOT
515 );
516 }
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 275 of file PCMediaObjectTest.php.

275 : void
276 {
277 $this->checkMAProps(
278 function (ilMediaAliasItem $ma): void {
279 $ma->setCaption("My Caption");
280 $this->assertEquals(
281 true,
282 $ma->definesCaption()
283 );
284 $ma->deriveCaption();
285 $this->assertEquals(
286 false,
287 $ma->definesCaption()
288 );
289 },
290 $expected = <<<EOT
291<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>
292EOT
293 );
294 }
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 391 of file PCMediaObjectTest.php.

391 : void
392 {
393 $this->checkMAProps(
394 function (ilMediaAliasItem $ma): void {
395 $ma->setParameters([
396 "par1" => "val1",
397 "par2" => "val2"
398 ]);
399 $ma->deriveParameters();
400 $this->assertEquals(
401 false,
402 $ma->definesParameters()
403 );
404 },
405 $expected = <<<EOT
406<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>
407EOT
408 );
409 }
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 225 of file PCMediaObjectTest.php.

225 : void
226 {
227 $this->checkMAProps(
228 function (ilMediaAliasItem $ma): void {
229 $this->assertEquals(
230 false,
231 $ma->definesSize()
232 );
233 $ma->setWidth("222");
234 $ma->setHeight("111");
235 $this->assertEquals(
236 true,
237 $ma->definesSize()
238 );
239 $ma->deriveSize();
240 $this->assertEquals(
241 false,
242 $ma->definesSize()
243 );
244 },
245 $expected = <<<EOT
246<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>
247EOT
248 );
249 }
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 320 of file PCMediaObjectTest.php.

320 : void
321 {
322 $this->checkMAProps(
323 function (ilMediaAliasItem $ma): void {
324 $ma->setTextRepresentation("My Text");
325 $this->assertEquals(
326 true,
328 );
330 $this->assertEquals(
331 false,
333 );
334 },
335 $expected = <<<EOT
336<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>
337EOT
338 );
339 }
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 94 of file PCMediaObjectTest.php.

94 : void
95 {
96 $page = $this->getEmptyPageWithDom();
97 $pc = $this->getMediaObjectInPage($page);
98
99 $page->stripHierIDs();
100 $page->stripPCIDs();
101
102 $expected = <<<EOT
103<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>
104EOT;
105
106 $this->assertXmlEquals(
107 $expected,
108 $pc->dumpXML()
109 );
110 }

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

+ Here is the call graph for this function:

◆ testHeight()

PCMediaObjectTest::testHeight ( )

Definition at line 209 of file PCMediaObjectTest.php.

209 : void
210 {
211 $this->checkMAProps(
212 function (ilMediaAliasItem $ma): void {
213 $ma->setHeight("11");
214 $this->assertEquals(
215 "11",
216 $ma->getHeight()
217 );
218 },
219 $expected = <<<EOT
220<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>
221EOT
222 );
223 }

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

+ Here is the call graph for this function:

◆ testHorizontalAlign()

PCMediaObjectTest::testHorizontalAlign ( )

Definition at line 341 of file PCMediaObjectTest.php.

341 : void
342 {
343 $this->checkMAProps(
344 function (ilMediaAliasItem $ma): void {
345 $ma->setHorizontalAlign("Right");
346 $this->assertEquals(
347 "Right",
348 $ma->getHorizontalAlign()
349 );
350 },
351 $expected = <<<EOT
352<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>
353EOT
354 );
355 }
setHorizontalAlign(string $a_halign)

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

+ Here is the call graph for this function:

◆ testParameters()

PCMediaObjectTest::testParameters ( )

Definition at line 357 of file PCMediaObjectTest.php.

357 : void
358 {
359 $this->checkMAProps(
360 function (ilMediaAliasItem $ma): void {
361 $this->assertEquals(
362 false,
363 $ma->definesParameters()
364 );
365 $ma->setParameters([
366 "par1" => "val1",
367 "par2" => "val2"
368 ]);
369 $this->assertEquals(
370 [
371 "par1" => "val1",
372 "par2" => "val2"
373 ],
374 $ma->getParameters()
375 );
376 $this->assertEquals(
377 true,
378 $ma->definesParameters()
379 );
380 $this->assertEquals(
381 'par1="val1", par2="val2"',
382 $ma->getParameterString()
383 );
384 },
385 $expected = <<<EOT
386<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>
387EOT
388 );
389 }
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 112 of file PCMediaObjectTest.php.

112 : void
113 {
114 $page = $this->getEmptyPageWithDom();
115 $pc = $this->getMediaObjectInPage($page);
116
117 $pc->setClass("MyClass");
118
119 $this->assertEquals(
120 "MyClass",
121 $pc->getClass()
122 );
123
124 $page->stripHierIDs();
125 $page->stripPCIDs();
126
127 $expected = <<<EOT
128<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>
129EOT;
130
131 $this->assertXmlEquals(
132 $expected,
133 $page->getXMLFromDom()
134 );
135 }

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

+ Here is the call graph for this function:

◆ testTextRepresentation()

PCMediaObjectTest::testTextRepresentation ( )

Definition at line 296 of file PCMediaObjectTest.php.

296 : void
297 {
298 $this->checkMAProps(
299 function (ilMediaAliasItem $ma): void {
300 $this->assertEquals(
301 false,
303 );
304 $ma->setTextRepresentation("My Text");
305 $this->assertEquals(
306 "My Text",
308 );
309 $this->assertEquals(
310 true,
312 );
313 },
314 $expected = <<<EOT
315<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>
316EOT
317 );
318 }

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

+ Here is the call graph for this function:

◆ testWidth()

PCMediaObjectTest::testWidth ( )

Definition at line 185 of file PCMediaObjectTest.php.

185 : void
186 {
187 $this->checkMAProps(
188 function (ilMediaAliasItem $ma): void {
189 $this->assertEquals(
190 false,
191 $ma->definesSize()
192 );
193 $ma->setWidth("222");
194 $this->assertEquals(
195 "222",
196 $ma->getWidth()
197 );
198 $this->assertEquals(
199 true,
200 $ma->definesSize()
201 );
202 },
203 $expected = <<<EOT
204<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>
205EOT
206 );
207 }

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: