ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
InputTest Class Reference

Test on field implementation. More...

+ Inheritance diagram for InputTest:
+ Collaboration diagram for InputTest:

Public Member Functions

 setUp ()
 
 testConstructor ()
 
 testWithLabel ()
 
 testWithByline ()
 
 testWithRequired ()
 
 testWithRequiredAndCustomConstraint ()
 
 testWithDisabled ()
 
 testWithValue ()
 
 testWithValueThrows ()
 
 testWithName ()
 
 testWithNameForNamedInput ()
 
 testWithError ()
 
 testGetContent ()
 
 testWithInput ()
 
 testOnlyRunWithInputWithName ()
 
 testWithInputAndTransformation ()
 
 testWithInputAndTransformationDifferentOrder ()
 
 testWithInputAndConstraintSuccessfull ()
 
 testWithInputAndConstraintFails ()
 
 testWithInputAndConstraintFailsDifferentOrder ()
 
 testWithInputTransformationAndConstraint ()
 
 testWithInputTransformationAndConstraintDifferentOrder ()
 
 testWithInputConstraintAndTransformation ()
 
 testWithInputConstraintFailsAndTransformation ()
 
 testWithInputConstraintFailsAndTransformationDifferentOrder ()
 
 testWithInputRequirementConstraint ()
 
 testWithInputToggleRequirement ()
 

Protected Attributes

DataFactory $data_factory
 
Refinery $refinery
 
DefInput $input
 
DefInput $dedicated_input
 
DefNamesource $name_source
 
FormInput $named_input
 

Detailed Description

Test on field implementation.

Definition at line 123 of file InputTest.php.

Member Function Documentation

◆ setUp()

InputTest::setUp ( )

Definition at line 132 of file InputTest.php.

132 : void
133 {
134 $this->data_factory = new DataFactory();
135 $language = $this->createMock(ILIAS\Language\Language::class);
136 $this->refinery = new Refinery($this->data_factory, $language);
137 $this->input = new DefInput(
138 $this->data_factory,
139 $this->refinery,
140 "label",
141 "byline"
142 );
143 $this->named_input = $this->input->withDedicatedName('dedicated_name');
144 $this->name_source = new DefNamesource();
145 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ testConstructor()

InputTest::testConstructor ( )

Definition at line 147 of file InputTest.php.

147 : void
148 {
149 $this->assertEquals("label", $this->input->getLabel());
150 $this->assertEquals("byline", $this->input->getByline());
151 }

◆ testGetContent()

InputTest::testGetContent ( )

Definition at line 252 of file InputTest.php.

252 : void
253 {
254 $this->expectException(LogicException::class);
255
256 $this->input->getContent();
257 }

◆ testOnlyRunWithInputWithName()

InputTest::testOnlyRunWithInputWithName ( )

Definition at line 277 of file InputTest.php.

277 : void
278 {
279 $raised = false;
280 try {
281 $this->input->withInput(new DefInputData([]));
282 $this->assertFalse("This should not happen.");
283 } catch (LogicException $e) {
284 $raised = true;
285 }
286 $this->assertTrue($raised);
287 }

References Vendor\Package\$e.

◆ testWithByline()

InputTest::testWithByline ( )

Definition at line 161 of file InputTest.php.

161 : void
162 {
163 $byline = "new byline";
164 $input = $this->input->withByline($byline);
165 $this->assertEquals($byline, $input->getByline());
166 $this->assertNotSame($this->input, $input);
167 }
withByline(string $byline)
Get an input like this, but with an additional/replaced label.static
Definition: FormInput.php:102
DefInput $input
Definition: InputTest.php:127

References $input, ILIAS\UI\Implementation\Component\Input\Field\FormInput\getByline(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withByline().

+ Here is the call graph for this function:

◆ testWithDisabled()

InputTest::testWithDisabled ( )

Definition at line 191 of file InputTest.php.

191 : void
192 {
193 $this->assertFalse($this->input->isDisabled());
194 $input = $this->input->withDisabled(true);
195 $this->assertTrue($input->isDisabled());
196 $input = $input->withDisabled(false);
197 $this->assertFalse($input->isDisabled());
198 }
withDisabled(bool $is_disabled)
Get an input like this, but set it to a disabled state.static
Definition: FormInput.php:139

References $input, ILIAS\UI\Implementation\Component\Input\Field\FormInput\isDisabled(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withDisabled().

+ Here is the call graph for this function:

◆ testWithError()

InputTest::testWithError ( )

Definition at line 243 of file InputTest.php.

243 : void
244 {
245 $error = "error";
246 $input = $this->input->withError($error);
247 $this->assertEquals(null, $this->input->getError());
248 $this->assertEquals($error, $input->getError());
249 $this->assertNotSame($this->input, $input);
250 }
withError(string $error)
Get an input like this one, with a different error.
Definition: Input.php:127
getError()
The error of the input as used in HTML.
Definition: Input.php:119

References $input, ILIAS\UI\Implementation\Component\Input\Input\getError(), and ILIAS\UI\Implementation\Component\Input\Input\withError().

+ Here is the call graph for this function:

◆ testWithInput()

InputTest::testWithInput ( )

Definition at line 259 of file InputTest.php.

259 : void
260 {
261 $name = "name_0";
262 $value = "valu";
263 $input = $this->input->withNameFrom($this->name_source);
264 $values = new DefInputData([$name => $value]);
265
266 $input2 = $input->withInput($values);
267 $res = $input2->getContent();
268
269 $this->assertInstanceOf(Result::class, $res);
270 $this->assertTrue($res->isOk());
271 $this->assertEquals($value, $res->value());
272
273 $this->assertNotSame($input, $input2);
274 $this->assertEquals($value, $input2->getValue());
275 }
withNameFrom(NameSource $source, ?string $parent_name=null)
Definition: Input.php:200
$res
Definition: ltiservices.php:69

References $input, $res, ILIAS\UI\Implementation\Component\Input\Field\FormInput\withInput(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputAndConstraintFails()

InputTest::testWithInputAndConstraintFails ( )

Definition at line 361 of file InputTest.php.

361 : void
362 {
363 $name = "name_0";
364 $value = "value";
365 $error = "an error";
366 $input = $this->input->withNameFrom($this->name_source);
367 $values = new DefInputData([$name => $value]);
368
369 $input2 = $input->withAdditionalTransformation($this->refinery->custom()->constraint(function () {
370 return false;
371 }, $error))->withInput($values);
372 $res = $input2->getContent();
373
374 $this->assertInstanceOf(Result::class, $res);
375 $this->assertTrue($res->isError());
376 $this->assertEquals($error, $res->error());
377
378 $this->assertNotSame($input, $input2);
379 $this->assertEquals($value, $input2->getValue());
380 $this->assertEquals($error, $input2->getError());
381 }
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the current or future content.
Definition: Input.php:145

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputAndConstraintFailsDifferentOrder()

InputTest::testWithInputAndConstraintFailsDifferentOrder ( )

Definition at line 383 of file InputTest.php.

383 : void
384 {
385 $rc = $this->refinery->custom();
386
387 $name = "name_0";
388 $value = "value";
389 $error = "an error";
390 $input = $this->input->withNameFrom($this->name_source);
391 $values = new DefInputData([$name => $value]);
392
393 $input2 = $input
394 ->withInput($values)
395 ->withAdditionalTransformation($rc->constraint(function () {
396 return false;
397 }, $error));
398
399 $res = $input2->getContent();
400
401 $this->assertInstanceOf(Result::class, $res);
402 $this->assertTrue($res->isError());
403 $this->assertEquals($error, $res->error());
404
405 $this->assertNotSame($input, $input2);
406 $this->assertEquals($value, $input2->getValue());
407 $this->assertEquals($error, $input2->getError());
408 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Field\FormInput\withInput(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputAndConstraintSuccessfull()

InputTest::testWithInputAndConstraintSuccessfull ( )

Definition at line 339 of file InputTest.php.

339 : void
340 {
341 $name = "name_0";
342 $value = "value";
343 $error = "an error";
344 $input = $this->input->withNameFrom($this->name_source);
345 $values = new DefInputData([$name => $value]);
346
347 $input2 = $input->withAdditionalTransformation($this->refinery->custom()->constraint(function () {
348 return true;
349 }, $error))->withInput($values);
350 $res = $input2->getContent();
351
352 $this->assertInstanceOf(Result::class, $res);
353 $this->assertTrue($res->isOk());
354 $this->assertEquals($value, $res->value());
355
356 $this->assertNotSame($input, $input2);
357 $this->assertEquals($value, $input2->getValue());
358 $this->assertEquals(null, $input2->getError());
359 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputAndTransformation()

InputTest::testWithInputAndTransformation ( )

Definition at line 289 of file InputTest.php.

289 : void
290 {
291 $name = "name_0";
292 $value = "value";
293 $transform_to = "other value";
294 $input = $this->input->withNameFrom($this->name_source);
295 $values = new DefInputData([$name => $value]);
296
298 $this->refinery->custom()->transformation(function ($v) use ($value, $transform_to): string {
299 $this->assertEquals($value, $v);
300 return $transform_to;
301 })
302 )->withInput($values);
303
304 $res = $input2->getContent();
305
306 $this->assertInstanceOf(Result::class, $res);
307 $this->assertTrue($res->isOk());
308 $this->assertEquals($transform_to, $res->value());
309
310 $this->assertNotSame($input, $input2);
311 $this->assertEquals($value, $input2->getValue());
312 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputAndTransformationDifferentOrder()

InputTest::testWithInputAndTransformationDifferentOrder ( )

Definition at line 314 of file InputTest.php.

314 : void
315 {
316 $name = "name_0";
317 $value = "value";
318 $transform_to = "other value";
319 $input = $this->input->withNameFrom($this->name_source);
320 $values = new DefInputData([$name => $value]);
321
322 $input2 = $input->withInput($values)->withAdditionalTransformation(
323 $this->refinery->custom()->transformation(function ($v) use ($value, $transform_to): string {
324 $this->assertEquals($value, $v);
325 return $transform_to;
326 })
327 );
328
329 $res = $input2->getContent();
330
331 $this->assertInstanceOf(Result::class, $res);
332 $this->assertTrue($res->isOk());
333 $this->assertEquals($transform_to, $res->value());
334
335 $this->assertNotSame($input, $input2);
336 $this->assertEquals($value, $input2->getValue());
337 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Field\FormInput\withInput(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputConstraintAndTransformation()

InputTest::testWithInputConstraintAndTransformation ( )

Definition at line 474 of file InputTest.php.

474 : void
475 {
476 $name = "name_0";
477 $value = "value";
478 $transform_to = "other value";
479 $error = "an error";
480 $input = $this->input->withNameFrom($this->name_source);
481 $values = new DefInputData([$name => $value]);
482
484 $this->refinery->custom()->constraint(function ($v) use ($value): bool {
485 $this->assertEquals($value, $v);
486 return true;
487 }, $error)
488 )->withAdditionalTransformation(
489 $this->refinery->custom()->transformation(function ($v) use ($value, $transform_to): string {
490 $this->assertEquals($value, $v);
491 return $transform_to;
492 })
493 )->withInput($values);
494
495 $res = $input2->getContent();
496
497 $this->assertInstanceOf(Result::class, $res);
498 $this->assertTrue($res->isOk());
499 $this->assertEquals($transform_to, $res->value());
500
501 $this->assertNotSame($input, $input2);
502 $this->assertEquals($value, $input2->getValue());
503 $this->assertEquals(null, $input2->getError());
504 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputConstraintFailsAndTransformation()

InputTest::testWithInputConstraintFailsAndTransformation ( )

Definition at line 506 of file InputTest.php.

506 : void
507 {
508 $rc = $this->refinery->custom();
509
510 $name = "name_0";
511 $value = "value";
512 $transform_to = "other value";
513 $error = "an error";
514 $input = $this->input->withNameFrom($this->name_source);
515 $values = new DefInputData([$name => $value]);
516
517 $input2 = $input
518 ->withAdditionalTransformation($rc->constraint(function ($v) use ($value): bool {
519 $this->assertEquals($value, $v);
520
521 return false;
522 }, $error))
523 ->withAdditionalTransformation($rc->transformation(function () use ($value, $transform_to): string {
524 $this->assertFalse("This should not happen");
525
526 return $transform_to;
527 }))->withInput($values);
528 $res = $input2->getContent();
529
530 $this->assertInstanceOf(Result::class, $res);
531 $this->assertTrue($res->isError());
532 $this->assertEquals($error, $res->error());
533
534 $this->assertNotSame($input, $input2);
535 $this->assertEquals($value, $input2->getValue());
536 $this->assertEquals($error, $input2->getError());
537 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputConstraintFailsAndTransformationDifferentOrder()

InputTest::testWithInputConstraintFailsAndTransformationDifferentOrder ( )

Definition at line 539 of file InputTest.php.

539 : void
540 {
541 $name = "name_0";
542 $value = "value";
543 $transform_to = "other value";
544 $error = "an error";
545 $input = $this->input->withNameFrom($this->name_source);
546 $values = new DefInputData([$name => $value]);
547
548 $input2 = $input->withInput($values)->withAdditionalTransformation(
549 $this->refinery->custom()->constraint(function ($v) use ($value): bool {
550 $this->assertEquals($value, $v);
551 return false;
552 }, $error)
553 )->withAdditionalTransformation(
554 $this->refinery->custom()->transformation(function () use ($value, $transform_to): string {
555 $this->assertFalse("This should not happen");
556 return $transform_to;
557 })
558 );
559
560 $res = $input2->getContent();
561
562 $this->assertInstanceOf(Result::class, $res);
563 $this->assertTrue($res->isError());
564 $this->assertEquals($error, $res->error());
565
566 $this->assertNotSame($input, $input2);
567 $this->assertEquals($value, $input2->getValue());
568 $this->assertEquals($error, $input2->getError());
569 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Field\FormInput\withInput(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputRequirementConstraint()

InputTest::testWithInputRequirementConstraint ( )

Definition at line 571 of file InputTest.php.

571 : void
572 {
573 $name = "name_0";
574 $value = "Adam";
575 $error = "Your name does not start with an H";
576 $input = $this->input->withNameFrom($this->name_source);
577 $values = new DefInputData([$name => $value]);
578 $custom_constraint = $this->refinery->custom()->constraint(
579 function ($value) {
580 return (substr($value, 0, 1) === 'H') ? true : false;
581 },
582 $error
583 );
584 $input2 = $input->withRequired(true, $custom_constraint)->withInput($values);
585 $res = $input2->getContent();
586 $this->assertInstanceOf(Result::class, $res);
587 $this->assertFalse($res->isOk());
588 $this->assertEquals($error, $input2->getError());
589 }
withRequired(bool $is_required, ?Constraint $requirement_constraint=null)
Get an input like this, but set the field to be required (or not).With the optional $required_constra...
Definition: FormInput.php:120

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withNameFrom(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withRequired().

+ Here is the call graph for this function:

◆ testWithInputToggleRequirement()

InputTest::testWithInputToggleRequirement ( )

Definition at line 591 of file InputTest.php.

591 : void
592 {
593 $name = "name_0";
594 $value = "value";
595 $error = "an error";
596 $input = $this->input->withNameFrom($this->name_source);
597 $values = new DefInputData([$name => $value]);
598
599 $custom_constraint = $this->refinery->custom()->constraint(function () {
600 return false;
601 }, $error);
602
603 $input2 = $input->withRequired(true, $custom_constraint)->withRequired(false)->withInput($values);
604 $res = $input2->getContent();
605
606 $this->assertInstanceOf(Result::class, $res);
607 $this->assertFalse($res->isError());
608 $this->assertEquals($value, $res->value());
609 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withNameFrom(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withRequired().

+ Here is the call graph for this function:

◆ testWithInputTransformationAndConstraint()

InputTest::testWithInputTransformationAndConstraint ( )

Definition at line 410 of file InputTest.php.

410 : void
411 {
412 $name = "name_0";
413 $value = "value";
414 $transform_to = "other value";
415 $error = "an error";
416 $input = $this->input->withNameFrom($this->name_source);
417 $values = new DefInputData([$name => $value]);
418
420 $this->refinery->custom()->transformation(function ($v) use ($value, $transform_to): string {
421 $this->assertEquals($value, $v);
422 return $transform_to;
423 })
424 )->withAdditionalTransformation(
425 $this->refinery->custom()->constraint(function ($v) use ($transform_to): bool {
426 $this->assertEquals($transform_to, $v);
427 return true;
428 }, $error)
429 )->withInput($values);
430
431 $res = $input2->getContent();
432
433 $this->assertInstanceOf(Result::class, $res);
434 $this->assertTrue($res->isOk());
435 $this->assertEquals($transform_to, $res->value());
436
437 $this->assertNotSame($input, $input2);
438 $this->assertEquals($value, $input2->getValue());
439 $this->assertEquals(null, $input2->getError());
440 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Input\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithInputTransformationAndConstraintDifferentOrder()

InputTest::testWithInputTransformationAndConstraintDifferentOrder ( )

Definition at line 442 of file InputTest.php.

442 : void
443 {
444 $name = "name_0";
445 $value = "value";
446 $transform_to = "other value";
447 $error = "an error";
448 $input = $this->input->withNameFrom($this->name_source);
449 $values = new DefInputData([$name => $value]);
450
451 $input2 = $input->withInput($values)->withAdditionalTransformation(
452 $this->refinery->custom()->transformation(function ($v) use ($value, $transform_to): string {
453 $this->assertEquals($value, $v);
454 return $transform_to;
455 })
456 )->withAdditionalTransformation(
457 $this->refinery->custom()->constraint(function ($v) use ($transform_to): bool {
458 $this->assertEquals($transform_to, $v);
459 return true;
460 }, $error)
461 );
462
463 $res = $input2->getContent();
464
465 $this->assertInstanceOf(Result::class, $res);
466 $this->assertTrue($res->isOk());
467 $this->assertEquals($transform_to, $res->value());
468
469 $this->assertNotSame($input, $input2);
470 $this->assertEquals($value, $input2->getValue());
471 $this->assertEquals(null, $input2->getError());
472 }

References $input, $res, ILIAS\Repository\refinery(), ILIAS\UI\Implementation\Component\Input\Field\FormInput\withInput(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithLabel()

InputTest::testWithLabel ( )

Definition at line 153 of file InputTest.php.

153 : void
154 {
155 $label = "new label";
156 $input = $this->input->withLabel($label);
157 $this->assertEquals($label, $input->getLabel());
158 $this->assertNotSame($this->input, $input);
159 }
withLabel(string $label)
Get an input like this, but with a replaced label.static
Definition: FormInput.php:84

References $input, ILIAS\UI\Implementation\Component\Input\Field\FormInput\getLabel(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withLabel().

+ Here is the call graph for this function:

◆ testWithName()

InputTest::testWithName ( )

Definition at line 223 of file InputTest.php.

223 : void
224 {
225 $name = "name_0";
226 $input = $this->input->withNameFrom($this->name_source);
227 $this->assertEquals(null, $this->input->getName());
228 $this->assertEquals($name, $input->getName());
229 $this->assertNotSame($this->input, $input);
230 $this->assertEquals(1, $this->name_source->count);
231 }
getName()
The name of the input as used in HTML.
Definition: Input.php:192

References $input, ILIAS\UI\Implementation\Component\Input\Input\getName(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithNameForNamedInput()

InputTest::testWithNameForNamedInput ( )

Definition at line 233 of file InputTest.php.

233 : void
234 {
235 $name = "dedicated_name_0";
236 $input = $this->named_input->withNameFrom($this->name_source);
237 $this->assertEquals(null, $this->named_input->getName());
238 $this->assertEquals($name, $input->getName());
239 $this->assertNotSame($this->named_input, $input);
240 $this->assertEquals(1, $this->name_source->count);
241 }

References $input, ILIAS\UI\Implementation\Component\Input\Input\getName(), and ILIAS\UI\Implementation\Component\Input\Input\withNameFrom().

+ Here is the call graph for this function:

◆ testWithRequired()

InputTest::testWithRequired ( )

Definition at line 169 of file InputTest.php.

169 : void
170 {
171 $this->assertFalse($this->input->isRequired());
172 $input = $this->input->withRequired(true);
173 $this->assertTrue($input->isRequired());
174 $input = $input->withRequired(false);
175 $this->assertFalse($input->isRequired());
176 }

References $input, ILIAS\UI\Implementation\Component\Input\Field\FormInput\isRequired(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withRequired().

+ Here is the call graph for this function:

◆ testWithRequiredAndCustomConstraint()

InputTest::testWithRequiredAndCustomConstraint ( )

Definition at line 178 of file InputTest.php.

178 : void
179 {
180 $custom_constraint = $this->refinery->custom()->constraint(
181 function ($value) {
182 return (substr($value, 0, 1) === 'H') ? true : false;
183 },
184 "Your name does not start with an H"
185 );
186 $input = $this->input->withRequired(true, $custom_constraint);
187 $this->assertTrue($input->isRequired());
188 $this->assertEquals($input->requirement_constraint, $custom_constraint);
189 }

References $input, ILIAS\UI\Implementation\Component\Input\Field\FormInput\isRequired(), ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\Input\Field\FormInput\withRequired().

+ Here is the call graph for this function:

◆ testWithValue()

InputTest::testWithValue ( )

Definition at line 200 of file InputTest.php.

200 : void
201 {
202 $value = "some value";
203 $input = $this->input->withValue($value);
204 $this->assertEquals(null, $this->input->getValue());
205 $this->assertEquals($value, $input->getValue());
206 $this->assertNotSame($this->input, $input);
207 }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Input.php:101
getValue()
Get the value that is displayed in the input client side.
Definition: Input.php:89

References $input, ILIAS\UI\Implementation\Component\Input\Input\getValue(), and ILIAS\UI\Implementation\Component\Input\Input\withValue().

+ Here is the call graph for this function:

◆ testWithValueThrows()

InputTest::testWithValueThrows ( )

Definition at line 209 of file InputTest.php.

209 : void
210 {
211 $this->input->value_ok = false;
212 $raised = false;
213 try {
214 $this->input->withValue("foo");
215 $this->assertFalse("This should not happen.");
216 } catch (InvalidArgumentException $e) {
217 $raised = true;
218 }
219 $this->assertTrue($raised);
220 $this->assertEquals(null, $this->input->getValue());
221 }

References Vendor\Package\$e.

Field Documentation

◆ $data_factory

DataFactory InputTest::$data_factory
protected

Definition at line 125 of file InputTest.php.

◆ $dedicated_input

DefInput InputTest::$dedicated_input
protected

Definition at line 128 of file InputTest.php.

◆ $input

◆ $name_source

DefNamesource InputTest::$name_source
protected

Definition at line 129 of file InputTest.php.

◆ $named_input

FormInput InputTest::$named_input
protected

Definition at line 130 of file InputTest.php.

◆ $refinery

Refinery InputTest::$refinery
protected

Definition at line 126 of file InputTest.php.


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