ILIAS
trunk Revision v11.0_alpha-1749-g1a06bdef097
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
c
e
g
h
j
l
m
p
s
t
u
v
+
Enumerations
a
c
e
f
i
j
l
m
n
o
p
r
s
t
u
v
z
+
Enumerator
a
c
d
e
f
g
i
l
m
n
o
p
q
s
t
u
v
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
Enumerations
Enumerator
+
Files
File List
+
Globals
+
All
$
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
u
v
+
Variables
$
a
c
e
g
h
i
m
n
o
p
r
s
t
u
v
z
Enumerations
Enumerator
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Modules
Pages
WriterTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\MetaData\OERHarvester\XML
;
22
23
use
PHPUnit\Framework\TestCase
;
24
use
ILIAS\MetaData\Repository\RepositoryInterface
;
25
use
ILIAS\MetaData\XML\Writer\SimpleDC\SimpleDCInterface
;
26
use
ILIAS\MetaData\Repository\NullRepository
;
27
use
ILIAS\MetaData\Elements\SetInterface
;
28
use
ILIAS\MetaData\Elements\NullSet
;
29
use
ILIAS\MetaData\XML\Writer\SimpleDC\NullSimpleDC
;
30
31
class
WriterTest
extends
TestCase
32
{
33
protected
function
getLOMRepository
():
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
}
49
50
protected
function
getSimpleDCWriter
():
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
}
61
62
public
function
testWriteSimpleDCMetaData
(): 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
}
81
}
ILIAS\MetaData\XML\Writer\SimpleDC\NullSimpleDC
Definition:
NullSimpleDC.php:25
ILIAS\MetaData\XML\Writer\SimpleDC\SimpleDCInterface
Definition:
SimpleDCInterface.php:25
ILIAS\MetaData\OERHarvester\XML
Definition:
NullWriter.php:21
ILIAS\MetaData\OERHarvester\XML\WriterTest
Definition:
WriterTest.php:31
ILIAS\MetaData\OERHarvester\XML\WriterTest\getLOMRepository
getLOMRepository()
Definition:
WriterTest.php:33
ILIAS\MetaData\OERHarvester\XML\WriterTest\getSimpleDCWriter
getSimpleDCWriter()
Definition:
WriterTest.php:50
ILIAS\MetaData\Elements\NullSet
Definition:
NullSet.php:26
NullSimpleDC
ILIAS\MetaData\OERHarvester\XML\WriterTest\testWriteSimpleDCMetaData
testWriteSimpleDCMetaData()
Definition:
WriterTest.php:62
ILIAS\__construct
__construct()
Constructor setup ILIAS global object public.
Definition:
class.ilias.php:76
SimpleDCInterface
SetInterface
NullRepository
ILIAS\MetaData\Elements\SetInterface
Definition:
SetInterface.php:26
RepositoryInterface
ILIAS\MetaData\Repository\NullRepository
Definition:
NullRepository.php:30
ILIAS\MetaData\OERHarvester\XML\Writer
Definition:
Writer.php:26
NullSet
TestCase
ILIAS\MetaData\Repository\RepositoryInterface
Definition:
RepositoryInterface.php:29
components
ILIAS
MetaData
tests
OERHarvester
XML
WriterTest.php
Generated on Wed Apr 9 2025 23:03:41 for ILIAS by
1.8.13 (using
Doxyfile
)