ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\MetaData\Presentation\ElementsTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Presentation\ElementsTest:
+ Collaboration diagram for ILIAS\MetaData\Presentation\ElementsTest:

Public Member Functions

 testName ()
 
 testNameWithParents ()
 
 testNameWithParentsForRoot ()
 
 testNameWithParentsAndSkipInitial ()
 
 testNameWithParentsAndCutOff ()
 

Protected Member Functions

 getElements ()
 
 getBaseElement (string $name, ?BaseElementInterface $super)
 
 getTreeOfBaseElements ()
 

Detailed Description

Definition at line 32 of file ElementsTest.php.

Member Function Documentation

◆ getBaseElement()

ILIAS\MetaData\Presentation\ElementsTest::getBaseElement ( string  $name,
?BaseElementInterface  $super 
)
protected

Definition at line 46 of file ElementsTest.php.

References ILIAS\__construct().

Referenced by ILIAS\MetaData\Presentation\ElementsTest\getTreeOfBaseElements(), and ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsForRoot().

49  : BaseElementInterface {
50  return new class ($name, $super) extends NullBaseElement {
51  public function __construct(
52  protected string $name,
53  protected ?BaseElementInterface $super
54  ) {
55  }
56 
57  public function getDefinition(): DefinitionInterface
58  {
59  return new class ($this->name) extends NullDefinition {
60  public function __construct(protected string $name)
61  {
62  }
63 
64  public function name(): string
65  {
66  return $this->name;
67  }
68  };
69  }
70 
71  public function getSuperElement(): ?BaseElementInterface
72  {
73  return $this->super;
74  }
75 
76  public function isRoot(): bool
77  {
78  return is_null($this->super);
79  }
80  };
81  }
__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:

◆ getElements()

ILIAS\MetaData\Presentation\ElementsTest::getElements ( )
protected

Definition at line 34 of file ElementsTest.php.

Referenced by ILIAS\MetaData\Presentation\ElementsTest\testName(), ILIAS\MetaData\Presentation\ElementsTest\testNameWithParents(), ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsAndCutOff(), ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsAndSkipInitial(), and ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsForRoot().

34  : Elements
35  {
36  $util = new class () extends NullUtilities {
37  public function txt(string $key): string
38  {
39  return 'translated ' . $key;
40  }
41  };
42 
43  return new Elements($util);
44  }
+ Here is the caller graph for this function:

◆ getTreeOfBaseElements()

ILIAS\MetaData\Presentation\ElementsTest::getTreeOfBaseElements ( )
protected

Definition at line 83 of file ElementsTest.php.

References ILIAS\MetaData\Presentation\ElementsTest\getBaseElement(), and null.

Referenced by ILIAS\MetaData\Presentation\ElementsTest\testName(), ILIAS\MetaData\Presentation\ElementsTest\testNameWithParents(), ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsAndCutOff(), and ILIAS\MetaData\Presentation\ElementsTest\testNameWithParentsAndSkipInitial().

83  : BaseElementInterface
84  {
85  $root = $this->getBaseElement('root', null);
86  $high = $this->getBaseElement('high', $root);
87  $middle = $this->getBaseElement('lifeCycle', $high);
88  return $this->getBaseElement('lowElement', $middle);
89  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getBaseElement(string $name, ?BaseElementInterface $super)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testName()

ILIAS\MetaData\Presentation\ElementsTest::testName ( )

Definition at line 91 of file ElementsTest.php.

References $lifecycle, ILIAS\MetaData\Presentation\ElementsTest\getElements(), and ILIAS\MetaData\Presentation\ElementsTest\getTreeOfBaseElements().

91  : void
92  {
93  $elements = $this->getElements();
94  $low = $this->getTreeOfBaseElements();
95  $this->assertSame(
96  'translated meta_low_element',
97  $elements->name($low)
98  );
99  $this->assertSame(
100  'translated meta_low_element_plural',
101  $elements->name($low, true)
102  );
103  $lifecycle = $low->getSuperElement();
104  $this->assertSame(
105  'translated meta_lifecycle',
106  $elements->name($lifecycle)
107  );
108  $this->assertSame(
109  'translated meta_lifecycle_plural',
110  $elements->name($lifecycle, true)
111  );
112  }
$lifecycle
+ Here is the call graph for this function:

◆ testNameWithParents()

ILIAS\MetaData\Presentation\ElementsTest::testNameWithParents ( )

Definition at line 114 of file ElementsTest.php.

References ILIAS\MetaData\Presentation\ElementsTest\getElements(), ILIAS\MetaData\Presentation\ElementsTest\getTreeOfBaseElements(), and null.

114  : void
115  {
116  $elements = $this->getElements();
117  $low = $this->getTreeOfBaseElements();
118  $this->assertSame(
119  'translated meta_high: translated meta_lifecycle: translated meta_low_element',
120  $elements->nameWithParents($low)
121  );
122  $this->assertSame(
123  'translated meta_high: translated meta_lifecycle: translated meta_low_element_plural',
124  $elements->nameWithParents($low, null, true)
125  );
126  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ testNameWithParentsAndCutOff()

ILIAS\MetaData\Presentation\ElementsTest::testNameWithParentsAndCutOff ( )

Definition at line 160 of file ElementsTest.php.

References $lifecycle, ILIAS\MetaData\Presentation\ElementsTest\getElements(), and ILIAS\MetaData\Presentation\ElementsTest\getTreeOfBaseElements().

160  : void
161  {
162  $elements = $this->getElements();
163  $low = $this->getTreeOfBaseElements();
164  $lifecycle = $low->getSuperElement();
165  $high = $lifecycle->getSuperElement();
166  $this->assertSame(
167  'translated meta_lifecycle: translated meta_low_element',
168  $elements->nameWithParents($low, $high)
169  );
170  $this->assertSame(
171  'translated meta_lifecycle: translated meta_low_element_plural',
172  $elements->nameWithParents($low, $high, true)
173  );
174  $this->assertSame(
175  'translated meta_low_element',
176  $elements->nameWithParents($low, $lifecycle)
177  );
178  $this->assertSame(
179  'translated meta_lifecycle',
180  $elements->nameWithParents($low, $high, true, true)
181  );
182  $this->assertSame(
183  'translated meta_low_element_plural',
184  $elements->nameWithParents($low, $lifecycle, true, true)
185  );
186  }
$lifecycle
+ Here is the call graph for this function:

◆ testNameWithParentsAndSkipInitial()

ILIAS\MetaData\Presentation\ElementsTest::testNameWithParentsAndSkipInitial ( )

Definition at line 146 of file ElementsTest.php.

References ILIAS\MetaData\Presentation\ElementsTest\getElements(), ILIAS\MetaData\Presentation\ElementsTest\getTreeOfBaseElements(), and null.

146  : void
147  {
148  $elements = $this->getElements();
149  $low = $this->getTreeOfBaseElements();
150  $this->assertSame(
151  'translated meta_high: translated meta_lifecycle',
152  $elements->nameWithParents($low, null, false, true)
153  );
154  $this->assertSame(
155  'translated meta_high: translated meta_lifecycle',
156  $elements->nameWithParents($low, null, true, true)
157  );
158  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ testNameWithParentsForRoot()

ILIAS\MetaData\Presentation\ElementsTest::testNameWithParentsForRoot ( )

Definition at line 128 of file ElementsTest.php.

References ILIAS\MetaData\Presentation\ElementsTest\getBaseElement(), ILIAS\MetaData\Presentation\ElementsTest\getElements(), and null.

128  : void
129  {
130  $elements = $this->getElements();
131  $root = $this->getBaseElement('root', null);
132  $this->assertSame(
133  'translated meta_root',
134  $elements->nameWithParents($root)
135  );
136  $this->assertSame(
137  'translated meta_root_plural',
138  $elements->nameWithParents($root, null, true)
139  );
140  $this->assertSame(
141  'translated meta_root',
142  $elements->nameWithParents($root, null, false, true)
143  );
144  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getBaseElement(string $name, ?BaseElementInterface $super)
+ Here is the call graph for this function:

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