ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\MetaData\Vocabularies\Copyright\BridgeTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Vocabularies\Copyright\BridgeTest:
+ Collaboration diagram for ILIAS\MetaData\Vocabularies\Copyright\BridgeTest:

Public Member Functions

 testVocabularyWrongSlot ()
 
 testVocabularySelectionDisabled ()
 
 testVocabulary ()
 
 testLabelsForValuesWrongSlot ()
 
 testLabelsForValuesSelectionDisabled ()
 
 testLabelsForValues ()
 

Protected Member Functions

 getVocabFactory ()
 
 getSettings (bool $cp_selection_active=true)
 
 getCopyright (int $id, string $title)
 
 getCopyrightRepository ()
 
 getIdentifierHandler ()
 

Detailed Description

Definition at line 41 of file BridgeTest.php.

Member Function Documentation

◆ getCopyright()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::getCopyright ( int  $id,
string  $title 
)
protected

Definition at line 85 of file BridgeTest.php.

References $id, ILIAS\__construct(), and ILIAS\GlobalScreen\Provider\id().

Referenced by ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository().

85  : EntryInterface
86  {
87  return new class ($id, $title) extends NullEntry {
88  public function __construct(
89  protected int $id,
90  protected string $title
91  ) {
92  }
93 
94  public function id(): int
95  {
96  return $this->id;
97  }
98 
99  public function title(): string
100  {
101  return $this->title;
102  }
103  };
104  }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCopyrightRepository()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::getCopyrightRepository ( )
protected

Definition at line 106 of file BridgeTest.php.

References ILIAS\__construct(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyright().

Referenced by ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValues(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesSelectionDisabled(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesWrongSlot(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabulary(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularySelectionDisabled(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularyWrongSlot().

107  {
108  $copyrights = [];
109  $copyrights[] = $this->getCopyright(1, 'title cp 1');
110  $copyrights[] = $this->getCopyright(2, 'title cp 2');
111  $copyrights[] = $this->getCopyright(3, 'title cp 3');
112 
113  return new class ($copyrights) extends NullRepository {
114  public function __construct(protected array $copyrights)
115  {
116  }
117 
118  public function getAllEntries(): \Generator
119  {
120  yield from $this->copyrights;
121  }
122  };
123  }
__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:

◆ getIdentifierHandler()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::getIdentifierHandler ( )
protected

◆ getSettings()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::getSettings ( bool  $cp_selection_active = true)
protected

Definition at line 71 of file BridgeTest.php.

References ILIAS\__construct().

Referenced by ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValues(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesSelectionDisabled(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesWrongSlot(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabulary(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularySelectionDisabled(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularyWrongSlot().

72  {
73  return new class ($cp_selection_active) extends NullSettings {
74  public function __construct(protected bool $cp_selection_active)
75  {
76  }
77 
78  public function isCopyrightSelectionActive(): bool
79  {
80  return $this->cp_selection_active;
81  }
82  };
83  }
__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:

◆ getVocabFactory()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::getVocabFactory ( )
protected

Definition at line 43 of file BridgeTest.php.

References ILIAS\__construct(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

Referenced by ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValues(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesSelectionDisabled(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testLabelsForValuesWrongSlot(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabulary(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularySelectionDisabled(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\testVocabularyWrongSlot().

43  : FactoryInterface
44  {
45  return new class () extends NullFactory {
46  public function copyright(string ...$values): BuilderInterface
47  {
48  return new class ($values) extends NullBuilder {
49  public function __construct(protected array $values)
50  {
51  }
52 
53  public function get(): VocabularyInterface
54  {
55  return new class ($this->values) extends NullVocabulary {
56  public function __construct(protected array $values)
57  {
58  }
59 
60  public function values(): \Generator
61  {
62  yield from $this->values;
63  }
64  };
65  }
66  };
67  }
68  };
69  }
__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:

◆ testLabelsForValues()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testLabelsForValues ( )

Definition at line 219 of file BridgeTest.php.

References ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

219  : void
220  {
221  $bridge = new Bridge(
222  $this->getVocabFactory(),
223  $this->getSettings(),
224  $this->getCopyrightRepository(),
225  $this->getIdentifierHandler()
226  );
227 
228  $labelled_values = $bridge->labelsForValues(
229  SlotIdentifier::RIGHTS_DESCRIPTION,
230  'id_1',
231  'id_3',
232  'something'
233  );
234 
235  $label_1 = $labelled_values->current();
236  $this->assertSame('id_1', $label_1->value());
237  $this->assertSame('title cp 1', $label_1->label());
238  $labelled_values->next();
239  $label_3 = $labelled_values->current();
240  $this->assertSame('id_3', $label_3->value());
241  $this->assertSame('title cp 3', $label_3->label());
242  $labelled_values->next();
243  $this->assertNull($labelled_values->current());
244  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
+ Here is the call graph for this function:

◆ testLabelsForValuesSelectionDisabled()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testLabelsForValuesSelectionDisabled ( )

Definition at line 200 of file BridgeTest.php.

References ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

200  : void
201  {
202  $bridge = new Bridge(
203  $this->getVocabFactory(),
204  $this->getSettings(false),
205  $this->getCopyrightRepository(),
206  $this->getIdentifierHandler()
207  );
208 
209  $labelled_values = $bridge->labelsForValues(
210  SlotIdentifier::RIGHTS_DESCRIPTION,
211  'id_1',
212  'id_3',
213  'something'
214  );
215 
216  $this->assertNull($labelled_values->current());
217  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
+ Here is the call graph for this function:

◆ testLabelsForValuesWrongSlot()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testLabelsForValuesWrongSlot ( )

Definition at line 181 of file BridgeTest.php.

References ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

181  : void
182  {
183  $bridge = new Bridge(
184  $this->getVocabFactory(),
185  $this->getSettings(),
186  $this->getCopyrightRepository(),
187  $this->getIdentifierHandler()
188  );
189 
190  $labelled_values = $bridge->labelsForValues(
191  SlotIdentifier::CLASSIFICATION_PURPOSE,
192  'id_1',
193  'id_3',
194  'something'
195  );
196 
197  $this->assertNull($labelled_values->current());
198  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
+ Here is the call graph for this function:

◆ testVocabulary()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testVocabulary ( )

Definition at line 163 of file BridgeTest.php.

References $vocab, ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

163  : void
164  {
165  $bridge = new Bridge(
166  $this->getVocabFactory(),
167  $this->getSettings(),
168  $this->getCopyrightRepository(),
169  $this->getIdentifierHandler()
170  );
171 
172  $vocab = $bridge->vocabulary(SlotIdentifier::RIGHTS_DESCRIPTION);
173 
174  $this->assertNotNull($vocab);
175  $this->assertSame(
176  ['id_1', 'id_2', 'id_3'],
177  iterator_to_array($vocab->values())
178  );
179  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
$vocab
+ Here is the call graph for this function:

◆ testVocabularySelectionDisabled()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testVocabularySelectionDisabled ( )

Definition at line 149 of file BridgeTest.php.

References $vocab, ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

149  : void
150  {
151  $bridge = new Bridge(
152  $this->getVocabFactory(),
153  $this->getSettings(false),
154  $this->getCopyrightRepository(),
155  $this->getIdentifierHandler()
156  );
157 
158  $vocab = $bridge->vocabulary(SlotIdentifier::RIGHTS_DESCRIPTION);
159 
160  $this->assertNull($vocab);
161  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
$vocab
+ Here is the call graph for this function:

◆ testVocabularyWrongSlot()

ILIAS\MetaData\Vocabularies\Copyright\BridgeTest::testVocabularyWrongSlot ( )

Definition at line 135 of file BridgeTest.php.

References $vocab, ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getCopyrightRepository(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getIdentifierHandler(), ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getSettings(), and ILIAS\MetaData\Vocabularies\Copyright\BridgeTest\getVocabFactory().

135  : void
136  {
137  $bridge = new Bridge(
138  $this->getVocabFactory(),
139  $this->getSettings(),
140  $this->getCopyrightRepository(),
141  $this->getIdentifierHandler()
142  );
143 
144  $vocab = $bridge->vocabulary(SlotIdentifier::CLASSIFICATION_PURPOSE);
145 
146  $this->assertNull($vocab);
147  }
getSettings(bool $cp_selection_active=true)
Definition: BridgeTest.php:71
$vocab
+ Here is the call graph for this function:

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