ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\OERHarvester\XML\WriterTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\OERHarvester\XML\WriterTest:
+ Collaboration diagram for ILIAS\MetaData\OERHarvester\XML\WriterTest:

Public Member Functions

 testWriteSimpleDCMetaData ()
 

Protected Member Functions

 getLOMRepository ()
 
 getSimpleDCWriter ()
 

Detailed Description

Definition at line 31 of file WriterTest.php.

Member Function Documentation

◆ getLOMRepository()

ILIAS\MetaData\OERHarvester\XML\WriterTest::getLOMRepository ( )
protected

Definition at line 33 of file WriterTest.php.

33 : RepositoryInterface
34 {
35 return new class () extends NullRepository {
36 public function getMD(int $obj_id, int $sub_id, string $type): SetInterface
37 {
38 $xml_elements = '<obj_id>' . $obj_id . '</obj_id>' .
39 '<sub_id>' . $sub_id . '</sub_id>' .
40 '<type>' . $type . '</type>';
41 return new class ($xml_elements) extends NullSet {
42 public function __construct(public string $xml_elements)
43 {
44 }
45 };
46 }
47 };
48 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76

References ILIAS\__construct().

Referenced by ILIAS\MetaData\OERHarvester\XML\WriterTest\testWriteSimpleDCMetaData().

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

◆ getSimpleDCWriter()

ILIAS\MetaData\OERHarvester\XML\WriterTest::getSimpleDCWriter ( )
protected

Definition at line 50 of file WriterTest.php.

50 : SimpleDCInterface
51 {
52 return new class () extends NullSimpleDC {
53 public function write(SetInterface $set, int $object_ref_id): \SimpleXMLElement
54 {
55 return new \SimpleXMLElement(
56 '<xml>' . $set->xml_elements . '<ref_id>' . $object_ref_id . '</ref_id>' . '</xml>'
57 );
58 }
59 };
60 }

Referenced by ILIAS\MetaData\OERHarvester\XML\WriterTest\testWriteSimpleDCMetaData().

+ Here is the caller graph for this function:

◆ testWriteSimpleDCMetaData()

ILIAS\MetaData\OERHarvester\XML\WriterTest::testWriteSimpleDCMetaData ( )

Definition at line 62 of file WriterTest.php.

62 : void
63 {
64 $writer = new Writer(
65 $this->getLOMRepository(),
66 $this->getSimpleDCWriter()
67 );
68
69 $expected_xml = '<xml><obj_id>' . 21 . '</obj_id>' .
70 '<sub_id>' . 21 . '</sub_id>' .
71 '<type>' . 'some type' . '</type>' .
72 '<ref_id>' . 67 . '</ref_id></xml>';
73
74 $xml = $writer->writeSimpleDCMetaData(21, 67, 'some type');
75
76 $this->assertXmlStringEqualsXmlString(
77 $expected_xml,
78 $xml->saveXML()
79 );
80 }

References ILIAS\MetaData\OERHarvester\XML\WriterTest\getLOMRepository(), and ILIAS\MetaData\OERHarvester\XML\WriterTest\getSimpleDCWriter().

+ Here is the call graph for this function:

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