ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
StandardTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\MetaData\XML\Reader\Standard
;
22
23
use
PHPUnit\Framework\TestCase
;
24
use
ILIAS\MetaData\XML\Reader\NullReader
;
25
use
ILIAS\MetaData\XML\Version
;
26
use
ILIAS\MetaData\Elements\SetInterface
;
27
use
ILIAS\MetaData\Elements\NullSet
;
28
use
SimpleXMLElement
;
29
30
class
StandardTest
extends
TestCase
31
{
32
protected
function
getReader
():
Standard
33
{
34
$structurally_coupled =
new
class
() extends
NullReader
{
35
public
function
read(\
SimpleXMLElement
$xml,
Version
$version
):
SetInterface
36
{
37
return
new
class
($xml,
$version
) extends
NullSet
{
38
public
string
$exposed;
39
40
public
function
__construct
(\
SimpleXMLElement
$xml,
Version
$version)
41
{
42
$this->exposed =
'generated by StructurallyCoupled in version '
.
43
$version->value .
' from xml '
. $xml->asXML();
44
}
45
};
46
}
47
};
48
49
$legacy =
new
class
() extends
NullReader
{
50
public
function
read(\
SimpleXMLElement
$xml,
Version
$version
):
SetInterface
51
{
52
return
new
class
($xml,
$version
) extends
NullSet
{
53
public
string
$exposed;
54
55
public
function
__construct
(\
SimpleXMLElement
$xml,
Version
$version)
56
{
57
$this->exposed =
'generated by Legacy in version '
.
58
$version->value .
' from xml '
. $xml->asXML();
59
}
60
};
61
}
62
};
63
64
return
new
Standard
($structurally_coupled, $legacy);
65
}
66
67
public
function
testReadWithVersion10_0
(): void
68
{
69
$xml =
new
SimpleXMLElement
(
'<some>xml</some>'
);
70
$reader = $this->
getReader
();
71
72
$set = $reader->read($xml,
Version::V10_0
);
73
74
$this->assertSame(
75
'generated by StructurallyCoupled in version 10.0 from xml '
. $xml->asXML(),
76
$set->exposed
77
);
78
}
79
80
public
function
testReadWithVersion4_1_0
(): void
81
{
82
$xml =
new
SimpleXMLElement
(
'<some>xml</some>'
);
83
$reader = $this->
getReader
();
84
85
$set = $reader->read($xml, Version::V4_1_0);
86
87
$this->assertSame(
88
'generated by Legacy in version 4.1.0 from xml '
. $xml->asXML(),
89
$set->exposed
90
);
91
}
92
}
SimpleXMLElement
$version
$version
Definition:
plugin.php:24
ILIAS\MetaData\XML\Reader\Standard
Definition:
Legacy.php:21
ILIAS\MetaData\XML\Reader\NullReader
Definition:
NullReader.php:28
ILIAS\MetaData\Elements\NullSet
Definition:
NullSet.php:26
ILIAS\MetaData\XML\Reader\Standard\Standard
Definition:
Standard.php:27
ILIAS\MetaData\XML\V10_0
Definition:
Version.php:26
ILIAS\__construct
__construct()
Constructor setup ILIAS global object public.
Definition:
class.ilias.php:76
SetInterface
ILIAS\MetaData\Elements\SetInterface
Definition:
SetInterface.php:26
ILIAS\MetaData\XML\Version
Version
Definition:
Version.php:23
ILIAS\MetaData\XML\Reader\Standard\StandardTest\testReadWithVersion4_1_0
testReadWithVersion4_1_0()
Definition:
StandardTest.php:80
NullReader
ILIAS\MetaData\XML\Reader\Standard\StandardTest\testReadWithVersion10_0
testReadWithVersion10_0()
Definition:
StandardTest.php:67
NullSet
TestCase
ILIAS\MetaData\XML\Reader\Standard\StandardTest\getReader
getReader()
Definition:
StandardTest.php:32
ILIAS\MetaData\XML\Reader\Standard\StandardTest
Definition:
StandardTest.php:30
components
ILIAS
MetaData
tests
XML
Reader
Standard
StandardTest.php
Generated on Wed Sep 3 2025 23:02:50 for ILIAS by
1.8.13 (using
Doxyfile
)