19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
45 protected string $value,
46 protected SlotIdentifier $vocab_slot
49 $this->value = $value;
50 $this->vocab_slot = $vocab_slot;
53 public function type():
Type
58 public function value(): string
63 public function vocabularySlot(): SlotIdentifier
65 return $this->vocab_slot;
72 $format = $this->createMock(DateFormat::class);
73 $format->method(
'applyTo')->willReturnCallback(
function (\DateTimeImmutable $arg) {
74 return $arg->format(
'd:m:Y');
82 $this->format = $format;
85 public function getUserDateFormat():
DateFormat
90 public function txt(
string $key):
string
92 return 'translated ' . $key;
97 public function durationToIterator(
string $duration): \Generator
108 public function datetimeToObject(
string $datetime): \DateTimeImmutable
110 return new \DateTimeImmutable(
$datetime);
114 $vocab_presentation =
new class () extends NullVocabulariesPresentation {
115 public function presentableLabels(
116 PresentationUtilities $presentation_utilities,
117 SlotIdentifier $slot,
118 bool $with_unknown_vocab_flag,
121 foreach ($values as $value) {
122 yield
new class ($value, $slot, $with_unknown_vocab_flag) extends
NullLabelledValue {
124 protected string $value,
125 protected SlotIdentifier $slot,
126 protected bool $with_unknown_vocab_flag
130 public function value():
string
135 public function label():
string
137 return 'vocab ' . $this->slot->value .
' ' .
138 $this->value . ($this->with_unknown_vocab_flag ?
' flagged' :
'');
145 return new Data($util, $helper, $vocab_presentation);
150 $data = $this->getData();
152 'vocab rights_cost SomeKey',
153 $data->vocabularyValue(
'SomeKey', SlotIdentifier::RIGHTS_COST),
159 $data = $this->getData();
161 'translated meta_l_key',
162 $data->language(
'key')
168 $data = $this->getData();
171 $data->datetime(
'2012-12-31')
177 $data = $this->getData();
179 '89 translated years, 0 translated months, 1 translated second',
180 $data->duration(
'89:0::::1')
186 $data = $this->getData();
188 'vocab rights_cost SomeKey',
189 $data->dataValue($this->getElementData(
192 SlotIdentifier::RIGHTS_COST
196 'vocab rights_cost SomeKey',
197 $data->dataValue($this->getElementData(
200 SlotIdentifier::RIGHTS_COST
204 'translated meta_l_key',
205 $data->dataValue($this->getElementData(Type::LANG,
'key'))
209 $data->dataValue($this->getElementData(Type::DATETIME,
'2012-12-31'))
212 '89 translated years, 5 translated months, 1 translated second',
216 'This should just go through.',
217 $data->dataValue($this->getElementData(Type::VOCAB_SOURCE,
'This should just go through.'))
__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