19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
44 protected bool $active,
45 protected SlotIdentifier $slot
49 public function slot(): SlotIdentifier
54 public function type():
Type
59 public function isActive(): bool
69 ): ControlledRepository {
70 return new class ($slot, $active_count) extends NullControlledRepository {
72 protected SlotIdentifier $slot,
73 protected
int $active_count
77 public function countActiveVocabulariesForSlot(SlotIdentifier $slot):
int
79 if ($slot === $this->slot) {
80 return $this->active_count;
90 ): StandardRepository {
91 return new class ($slot, $active) extends NullStandardRepository {
93 protected SlotIdentifier $slot,
94 protected bool $active
98 public function isVocabularyActive(SlotIdentifier $slot): bool
100 if ($slot === $this->slot) {
101 return $this->active;
111 [5,
true,
true,
true],
112 [5,
true,
false,
true],
113 [1,
false,
true,
false],
114 [1,
false,
false,
true],
115 [0,
true,
true,
false],
116 [0,
true,
false,
true],
117 [0,
false,
false,
false]
121 #[\PHPUnit\Framework\Attributes\DataProvider('activeCountProvider')]
123 int $active_controlled_vocabs,
124 bool $is_standard_vocab_active,
125 bool $is_vocab_active,
126 bool $are_other_vocabs_active
129 $this->getControlledRepo(SlotIdentifier::TECHNICAL_FORMAT, $active_controlled_vocabs),
130 $this->getStandardRepo(SlotIdentifier::TECHNICAL_FORMAT, $is_standard_vocab_active)
132 $vocab = $this->getVocabulary(
135 SlotIdentifier::TECHNICAL_FORMAT
139 $are_other_vocabs_active,
140 $infos->isDeactivatable(
$vocab)
146 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
147 $vocab = $this->getVocabulary(Type::CONTROLLED_STRING);
149 $this->assertTrue($infos->isDeactivatable(
$vocab));
152 #[\PHPUnit\Framework\Attributes\DataProvider('activeCountProvider')]
154 int $active_controlled_vocabs,
155 bool $is_standard_vocab_active,
156 bool $is_vocab_active,
157 bool $are_other_vocabs_active
160 $this->getControlledRepo(SlotIdentifier::TECHNICAL_FORMAT, $active_controlled_vocabs),
161 $this->getStandardRepo(SlotIdentifier::TECHNICAL_FORMAT, $is_standard_vocab_active)
163 $vocab = $this->getVocabulary(
164 Type::CONTROLLED_VOCAB_VALUE,
166 SlotIdentifier::TECHNICAL_FORMAT
170 $are_other_vocabs_active,
171 $infos->isDeactivatable(
$vocab)
177 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
180 $this->assertFalse($infos->isDeactivatable(
$vocab));
185 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
186 $vocab = $this->getVocabulary(Type::STANDARD);
188 $this->assertFalse($infos->canDisallowCustomInput(
$vocab));
193 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
194 $vocab = $this->getVocabulary(Type::CONTROLLED_STRING);
196 $this->assertTrue($infos->canDisallowCustomInput(
$vocab));
201 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
202 $vocab = $this->getVocabulary(Type::CONTROLLED_VOCAB_VALUE);
204 $this->assertFalse($infos->canDisallowCustomInput(
$vocab));
209 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
212 $this->assertFalse($infos->canDisallowCustomInput(
$vocab));
217 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
218 $vocab = $this->getVocabulary(Type::STANDARD);
220 $this->assertFalse($infos->isCustomInputApplicable(
$vocab));
225 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
226 $vocab = $this->getVocabulary(Type::CONTROLLED_STRING);
228 $this->assertTrue($infos->isCustomInputApplicable(
$vocab));
233 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
234 $vocab = $this->getVocabulary(Type::CONTROLLED_VOCAB_VALUE);
236 $this->assertFalse($infos->isCustomInputApplicable(
$vocab));
241 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
244 $this->assertTrue($infos->isCustomInputApplicable(
$vocab));
249 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
250 $vocab = $this->getVocabulary(Type::STANDARD);
252 $this->assertFalse($infos->canBeDeleted(
$vocab));
257 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
258 $vocab = $this->getVocabulary(Type::CONTROLLED_STRING);
260 $this->assertTrue($infos->canBeDeleted(
$vocab));
263 #[\PHPUnit\Framework\Attributes\DataProvider('activeCountProvider')]
265 int $active_controlled_vocabs,
266 bool $is_standard_vocab_active,
267 bool $is_vocab_active,
268 bool $are_other_vocabs_active
271 $this->getControlledRepo(SlotIdentifier::TECHNICAL_FORMAT, $active_controlled_vocabs),
272 $this->getStandardRepo(SlotIdentifier::TECHNICAL_FORMAT, $is_standard_vocab_active)
274 $vocab = $this->getVocabulary(
275 Type::CONTROLLED_VOCAB_VALUE,
277 SlotIdentifier::TECHNICAL_FORMAT
281 $are_other_vocabs_active,
282 $infos->canBeDeleted(
$vocab)
288 $infos =
new Infos($this->getControlledRepo(), $this->getStandardRepo());
291 $this->assertFalse($infos->canBeDeleted(
$vocab));
__construct()
Constructor setup ILIAS global object @access public.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc