ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 47 of file ElementsTest.php.

References ILIAS\__construct().

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

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

References ILIAS\LTI\ToolProvider\$key.

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  $format = $this->createMock(DateFormat::class);
37  $util = new class ($format) extends NullUtilities {
38  public function txt(string $key): string
39  {
40  return 'translated ' . $key;
41  }
42  };
43 
44  return new Elements($util);
45  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

◆ getTreeOfBaseElements()

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

Definition at line 84 of file ElementsTest.php.

References ILIAS\MetaData\Presentation\ElementsTest\getBaseElement().

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

84  : BaseElementInterface
85  {
86  $root = $this->getBaseElement('root', null);
87  $high = $this->getBaseElement('high', $root);
88  $middle = $this->getBaseElement('lifeCycle', $high);
89  return $this->getBaseElement('lowElement', $middle);
90  }
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 92 of file ElementsTest.php.

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

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

◆ testNameWithParents()

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

Definition at line 115 of file ElementsTest.php.

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

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

◆ testNameWithParentsAndCutOff()

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

Definition at line 161 of file ElementsTest.php.

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

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

◆ testNameWithParentsAndSkipInitial()

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

Definition at line 147 of file ElementsTest.php.

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

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

◆ testNameWithParentsForRoot()

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

Definition at line 129 of file ElementsTest.php.

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

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

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