ILIAS
release_9 Revision v9.13-25-g2c18ec4c24f
◀ ilDoc Overview
BaseSetTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\MetaData\Elements\Base
;
22
23
use
PHPUnit\Framework\TestCase
;
24
use
ILIAS\MetaData\Structure\Definitions\DefinitionInterface
;
25
use
ILIAS\MetaData\Elements\Data\Type
;
26
use
ILIAS\MetaData\Elements\NoID
;
27
28
class
BaseSetTest
extends
TestCase
29
{
30
protected
function
getBaseSet
(
31
BaseElementInterface
$root
32
):
BaseSet
{
33
return
new
class
($root) extends
BaseSet
{
34
public
function
__construct
(
35
BaseElementInterface
$root
36
) {
37
parent::__construct
($root);
38
}
39
};
40
}
41
42
protected
function
getRoot
():
BaseElementInterface
43
{
44
return
new
class
() extends
NullBaseElement
{
45
public
function
getMDID():
int
|
NoID
46
{
47
return
NoID::ROOT;
48
}
49
50
public
function
isRoot():
bool
51
{
52
return
true
;
53
}
54
};
55
}
56
57
public
function
testGetRoot
(): void
58
{
59
$root = $this->
getRoot
();
60
$set = $this->
getBaseSet
($root);
61
62
$this->assertSame($root, $set->getRoot());
63
}
64
65
public
function
testNotRootException
(): void
66
{
67
$not_root =
new
NullBaseElement
();
68
69
$this->expectException(\ilMDElementsException::class);
70
$set = $this->
getBaseSet
($not_root);
71
}
72
73
public
function
testClone
(): void
74
{
75
$root = $this->
getRoot
();
76
$set = $this->
getBaseSet
($root);
77
78
$cloned_set = clone $set;
79
$this->assertEquals($root, $cloned_set->getRoot());
80
$this->assertNotSame($root, $cloned_set->getRoot());
81
}
82
}
ILIAS\MetaData\Elements\Base
Definition:
BaseElement.php:21
ILIAS\MetaData\Elements\Base\BaseSetTest\testGetRoot
testGetRoot()
Definition:
BaseSetTest.php:57
ILIAS\MetaData\Elements\Base\BaseSetTest\testNotRootException
testNotRootException()
Definition:
BaseSetTest.php:65
ILIAS\MetaData\Elements\Base\BaseSetTest
Definition:
BaseSetTest.php:28
ILIAS\MetaData\Elements\Base\BaseSetTest\getBaseSet
getBaseSet(BaseElementInterface $root)
Definition:
BaseSetTest.php:30
ILIAS\MetaData\Elements\Base\BaseSetTest\testClone
testClone()
Definition:
BaseSetTest.php:73
ILIAS\MetaData\Repository\Validation\Data\__construct
__construct(VocabulariesInterface $vocabularies)
Definition:
VocabularyBridge.php:31
ILIAS\__construct
__construct()
Constructor setup ILIAS global object public.
Definition:
class.ilias.php:62
ILIAS\MetaData\Elements\Base\NullBaseElement
Definition:
NullBaseElement.php:27
ILIAS\MetaData\Elements\Data\Type
Type
Definition:
Type.php:23
DefinitionInterface
ILIAS\MetaData\Elements\Base\BaseElementInterface
Definition:
BaseElementInterface.php:27
ILIAS\MetaData\Elements\Base\BaseSet
Definition:
BaseSet.php:23
ILIAS\MetaData\Elements\NoID
NoID
Definition:
NoID.php:23
ILIAS\MetaData\Elements\Base\BaseSetTest\getRoot
getRoot()
Definition:
BaseSetTest.php:42
TestCase
Services
MetaData
test
Elements
Base
BaseSetTest.php
Generated on Wed Sep 10 2025 14:11:45 for ILIAS by
1.8.13 (using
Doxyfile
)