ILIAS  release_8 Revision v8.24
FieldFactoryTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21require_once 'tests/UI/AbstractFactoryTest.php';
22
26use ILIAS\Data;
27use ILIAS\Refinery\Factory as Refinery;
28
30{
32 "text" => [
33 "context" => false,
34 ],
35 "numeric" => [
36 "context" => false,
37 ],
38 "group" => [
39 "context" => false,
40 ],
41 "section" => [
42 "context" => false,
43 ],
44 "optionalGroup" => [
45 "context" => false,
46 ],
47 "switchableGroup" => [
48 "context" => false,
49 ],
50 "checkbox" => [
51 "context" => false,
52 ],
53 "select" => [
54 "context" => false,
55 ],
56 "textarea" => [
57 "context" => false,
58 ],
59 "radio" => [
60 "context" => false,
61 ],
62 "multiSelect" => [
63 "context" => false,
64 ]
65 ];
66
67 public string $factory_title = 'ILIAS\\UI\\Component\\Input\\Field\\Factory';
68
69
70 final public function buildFactory(): I\Input\Field\Factory
71 {
72 $df = new Data\Factory();
73 $language = $this->createMock(ilLanguage::class);
74 return new I\Input\Field\Factory(
75 $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
76 new SignalGenerator(),
77 $df,
78 new Refinery($df, $language),
79 $language
80 );
81 }
82
84 {
85 $f = $this->buildFactory();
86
87 $input = $f->text("label", "byline");
88 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
89 $this->assertInstanceOf(Field\Text::class, $input);
90 }
91
93 {
94 $f = $this->buildFactory();
95
96 $input = $f->numeric("label", "byline");
97 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
98 $this->assertInstanceOf(Field\Numeric::class, $input);
99 }
100
102 {
103 $f = $this->buildFactory();
104
105 $input = $f->section([], "label", "byline");
106 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
107 $this->assertInstanceOf(Field\Group::class, $input);
108 $this->assertInstanceOf(Field\Section::class, $input);
109 }
110
112 {
113 $f = $this->buildFactory();
114
115 $input = $f->group([]);
116 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
117 $this->assertInstanceOf(Field\Group::class, $input);
118 }
119
121 {
122 $f = $this->buildFactory();
123
124 $input = $f->checkbox("label", "byline");
125 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
126 $this->assertInstanceOf(Field\Checkbox::class, $input);
127 }
128
130 {
131 $f = $this->buildFactory();
132
133 $input = $f->tag("label", [], "byline");
134 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
135 $this->assertInstanceOf(Field\Tag::class, $input);
136 }
137
139 {
140 $f = $this->buildFactory();
141
142 $input = $f->password("label", "byline");
143 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
144 $this->assertInstanceOf(Field\Password::class, $input);
145 }
146
148 {
149 $f = $this->buildFactory();
150
151 $input = $f->select("label", [], "byline");
152 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
153 $this->assertInstanceOf(Field\Select::class, $input);
154 }
155
157 {
158 $f = $this->buildFactory();
159
160 $input = $f->textarea("label", "byline");
161 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
162 $this->assertInstanceOf(Field\Textarea::class, $input);
163 }
164
166 {
167 $f = $this->buildFactory();
168
169 $input = $f->radio("label", "byline");
170 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
171 $this->assertInstanceOf(Field\Radio::class, $input);
172 }
173
175 {
176 $f = $this->buildFactory();
177
178 $input = $f->multiSelect("label", [], "byline");
179 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
180 $this->assertInstanceOf(Field\MultiSelect::class, $input);
181 }
182
184 {
185 $f = $this->buildFactory();
186
187 $input = $f->datetime("label", "byline");
188 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
189 }
190
192 {
193 $f = $this->buildFactory();
194
195 $input = $f->duration("label", "byline");
196 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
197 $this->assertInstanceOf(Field\Group::class, $input);
198 }
199
201 {
202 $f = $this->buildFactory();
203
204 $input = $f->text("label");
205 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
206 $this->assertInstanceOf(Field\Text::class, $input);
207
208 $input = $f->numeric("label");
209 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
210 $this->assertInstanceOf(Field\Numeric::class, $input);
211
212 $input = $f->section([], "label");
213 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
214 $this->assertInstanceOf(Field\Group::class, $input);
215 $this->assertInstanceOf(Field\Section::class, $input);
216
217 $input = $f->checkbox("label");
218 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
219 $this->assertInstanceOf(Field\Checkbox::class, $input);
220
221 $input = $f->tag("label", []);
222 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
223 $this->assertInstanceOf(Field\Tag::class, $input);
224
225 $input = $f->password("label");
226 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
227 $this->assertInstanceOf(Field\Password::class, $input);
228
229 $input = $f->select("label", []);
230 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
231 $this->assertInstanceOf(Field\Select::class, $input);
232
233 $input = $f->textarea("label");
234 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
235 $this->assertInstanceOf(Field\Textarea::class, $input);
236
237 $input = $f->radio("label");
238 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
239 $this->assertInstanceOf(Field\Radio::class, $input);
240
241 $input = $f->multiSelect("label", []);
242 $this->assertInstanceOf(\ILIAS\UI\Component\Input\Container\Form\FormInput::class, $input);
243 $this->assertInstanceOf(Field\MultiSelect::class, $input);
244 }
245}
Defines tests every SHOULD pass UI-factory.
testImplementsFactoryInterfaceForTextarea()
testImplementsFactoryInterfaceForDatetime()
testImplementsFactoryInterfaceForSection()
testImplementsFactoryInterfaceForPassword()
testImplementsFactoryInterfaceForCheckbox()
testImplementsFactoryInterfaceForNumeric()
testImplementsFactoryInterfaceForMultiselect()
array $kitchensink_info_settings
testImplementsFactoryInterfaceForDuration()
Builds data types.
Definition: Factory.php:21
This is a legacy support of Component\Input\Field\Input that has been moved to Component\Input\Contai...
Definition: Input.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Checkbox.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.