ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\Elements\Structure\StructureElementTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Elements\Structure\StructureElementTest:
+ Collaboration diagram for ILIAS\MetaData\Elements\Structure\StructureElementTest:

Public Member Functions

 testSubAndSuperElements ()
 
 testMDIDAndIsRoot ()
 
 testSubElementByName ()
 

Protected Member Functions

 getDefinition (string $name)
 
 getStructureElement (bool $is_root, string $name, StructureElement ... $elements)
 

Detailed Description

Definition at line 29 of file StructureElementTest.php.

Member Function Documentation

◆ getDefinition()

ILIAS\MetaData\Elements\Structure\StructureElementTest::getDefinition ( string  $name)
protected

Definition at line 31 of file StructureElementTest.php.

References ILIAS\__construct().

Referenced by ILIAS\MetaData\Elements\Structure\StructureElementTest\getStructureElement().

31  : DefinitionInterface
32  {
33  return new class ($name) extends NullDefinition {
34  public function __construct(protected string $name)
35  {
36  }
37 
38  public function name(): string
39  {
40  return $this->name;
41  }
42  };
43  }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStructureElement()

ILIAS\MetaData\Elements\Structure\StructureElementTest::getStructureElement ( bool  $is_root,
string  $name,
StructureElement ...  $elements 
)
protected

Definition at line 45 of file StructureElementTest.php.

References ILIAS\MetaData\Elements\Structure\StructureElementTest\getDefinition().

Referenced by ILIAS\MetaData\Elements\Structure\StructureElementTest\testMDIDAndIsRoot(), ILIAS\MetaData\Elements\Structure\StructureElementTest\testSubAndSuperElements(), and ILIAS\MetaData\Elements\Structure\StructureElementTest\testSubElementByName().

49  : StructureElement {
50  return new StructureElement(
51  $is_root,
52  $this->getDefinition($name),
53  ...$elements
54  );
55  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testMDIDAndIsRoot()

ILIAS\MetaData\Elements\Structure\StructureElementTest::testMDIDAndIsRoot ( )

Definition at line 75 of file StructureElementTest.php.

References ILIAS\MetaData\Elements\Structure\StructureElementTest\getStructureElement(), and ILIAS\MetaData\Elements\STRUCTURE.

75  : void
76  {
77  $root = $this->getStructureElement(true, 'root');
78  $not_root = $this->getStructureElement(false, 'name');
79 
80  $this->assertSame(NoID::ROOT, $root->getMDID());
81  $this->assertSame(NoID::STRUCTURE, $not_root->getMDID());
82 
83  $this->assertTrue($root->isRoot());
84  $this->assertFalse($not_root->isRoot());
85  }
getStructureElement(bool $is_root, string $name, StructureElement ... $elements)
+ Here is the call graph for this function:

◆ testSubAndSuperElements()

ILIAS\MetaData\Elements\Structure\StructureElementTest::testSubAndSuperElements ( )

Definition at line 57 of file StructureElementTest.php.

References ILIAS\MetaData\Elements\Structure\StructureElementTest\getStructureElement().

57  : void
58  {
59  $struct11 = $this->getStructureElement(false, '1.1');
60  $struct1 = $this->getStructureElement(false, '1', $struct11);
61  $struct2 = $this->getStructureElement(false, '2');
62  $root = $this->getStructureElement(true, 'root', $struct1, $struct2);
63 
64  $subs = $root->getSubElements();
65  $this->assertSame($struct1, $subs->current());
66  $subs->next();
67  $this->assertSame($struct2, $subs->current());
68  $subs->next();
69  $this->assertNull($subs->current());
70 
71  $this->assertSame($root, $struct1->getSuperElement());
72  $this->assertSame($struct11, $struct1->getSubElements()->current());
73  }
getStructureElement(bool $is_root, string $name, StructureElement ... $elements)
+ Here is the call graph for this function:

◆ testSubElementByName()

ILIAS\MetaData\Elements\Structure\StructureElementTest::testSubElementByName ( )

Definition at line 87 of file StructureElementTest.php.

References ILIAS\MetaData\Elements\Structure\StructureElementTest\getStructureElement().

87  : void
88  {
89  $sub1 = $this->getStructureElement(false, 'sub 1');
90  $sub2 = $this->getStructureElement(false, 'sub 2');
91  $sub3 = $this->getStructureElement(false, 'sub 3');
92  $el = $this->getStructureElement(false, 'name', $sub1, $sub2, $sub3);
93 
94  $this->assertSame($sub2, $el->getSubElement('sub 2'));
95  $this->assertSame($sub3, $el->getSubElement('sub 3'));
96  $this->assertSame($sub1, $el->getSubElement('sub 1'));
97  $this->assertNull($el->getSubElement('something else'));
98  }
getStructureElement(bool $is_root, string $name, StructureElement ... $elements)
+ Here is the call graph for this function:

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