ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ViewControlInputGenericTest Class Reference
+ Inheritance diagram for ViewControlInputGenericTest:
+ Collaboration diagram for ViewControlInputGenericTest:

Public Member Functions

 testViewControlSortationMutators ()
 
 testViewControlWithInput ()
 
- Public Member Functions inherited from ViewControlTestBase
 getUIFactory ()
 
 getDataFactory ()
 

Protected Member Functions

 getViewControl ()
 
- Protected Member Functions inherited from ViewControlTestBase
 getNamesource ()
 
 buildDataFactory ()
 
 buildRefinery ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 

Detailed Description

Definition at line 31 of file ViewControlInputGenericTest.php.

Member Function Documentation

◆ getViewControl()

ViewControlInputGenericTest::getViewControl ( )
protected

Definition at line 33 of file ViewControlInputGenericTest.php.

34 {
35 return new class (
36 $this->buildDataFactory(),
37 $this->buildRefinery(),
38 ''
39 ) extends Control\ViewControlInput {
40 public function isClientSideValueOk($value): bool
41 {
42 return true;
43 }
44 protected function getDefaultValue(): string
45 {
46 return 'default';
47 }
48 };
49 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21

References ViewControlTestBase\buildDataFactory(), ViewControlTestBase\buildRefinery(), and ILIAS\UI\Implementation\Component\Input\ViewControl\isClientSideValueOk().

Referenced by testViewControlSortationMutators(), and testViewControlWithInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testViewControlSortationMutators()

ViewControlInputGenericTest::testViewControlSortationMutators ( )

Definition at line 51 of file ViewControlInputGenericTest.php.

51 : void
52 {
53 $vc = $this->getViewControl();
54 $v = 'some value';
55 $l = 'some label';
56 $s = (new SignalGenerator())->create();
57 $this->assertEquals($v, $vc->withValue($v)->getValue());
58 $this->assertEquals($s, $vc->withOnChange($s)->getOnChangeSignal());
59 }

References getViewControl().

+ Here is the call graph for this function:

◆ testViewControlWithInput()

ViewControlInputGenericTest::testViewControlWithInput ( )

Definition at line 61 of file ViewControlInputGenericTest.php.

61 : void
62 {
63 $v = 'some input value';
64
65 $input = $this->createMock(InputData::class);
66 $input->expects($this->exactly(2))
67 ->method("getOr")
68 ->willReturn($v);
69
70 $vc = $this->getViewControl()
71 ->withNameFrom($this->getNamesource())
72 ->withInput($input);
73
74 $df = $this->buildDataFactory();
75 $this->assertEquals(
76 $df->ok($v),
77 $vc->getContent()
78 );
79 $this->assertEquals($v, $vc->getValue());
80
81 $transform = $this->buildRefinery()->custom()->transformation(
82 fn($v) => ['mod' => $v]
83 );
84 $vc = $vc->withAdditionalTransformation($transform);
85 $this->assertEquals(
86 ['mod' => $v],
87 $vc->withInput($input)->getContent()->value()
88 );
89 }

References ViewControlTestBase\buildDataFactory(), ViewControlTestBase\buildRefinery(), ViewControlTestBase\getNamesource(), and getViewControl().

+ Here is the call graph for this function:

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