Definition at line 34 of file GroupInputTest.php.
◆ getFieldFactory()
GroupInputTest::getFieldFactory |
( |
| ) |
|
◆ setUp()
GroupInputTest::setUp |
( |
| ) |
|
Definition at line 41 of file GroupInputTest.php.
References language().
43 $this->child1 = $this->createMock(Input1::class);
44 $this->child2 = $this->createMock(Input2::class);
45 $this->data_factory =
new Data\Factory;
46 $this->
language = $this->createMock(\ilLanguage::class);
47 $this->refinery = new \ILIAS\Refinery\Factory($this->data_factory, $this->
language);
49 $this->group =
new Field\Group(
53 [$this->child1, $this->child2],
◆ testErrorIsI18NOnError()
GroupInputTest::testErrorIsI18NOnError |
( |
| ) |
|
Definition at line 300 of file GroupInputTest.php.
References language().
302 $this->assertNotSame($this->child1, $this->child2);
304 $input_data = $this->createMock(InputData::class);
307 ->method(
"withInput")
308 ->willReturn($this->child2);
310 ->method(
"getContent")
311 ->willReturn($this->data_factory->error(
""));
313 ->method(
"withInput")
314 ->willReturn($this->child1);
316 ->method(
"getContent")
317 ->willReturn($this->data_factory->ok(
"two"));
319 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
321 ->expects($this->once())
323 ->with(
"ui_error_in_group")
326 $new_group = $this->group
327 ->withInput($input_data);
329 $this->assertTrue($new_group->getContent()->isError());
330 $this->assertEquals($i18n, $new_group->getContent()->error());
◆ testGroupForwardsValuesOnGetValue()
GroupInputTest::testGroupForwardsValuesOnGetValue |
( |
| ) |
|
Definition at line 195 of file GroupInputTest.php.
197 $this->assertNotSame($this->child1, $this->child2);
200 ->expects($this->once())
205 ->expects($this->once())
210 $vals = $this->group->getValue();
212 $this->assertEquals([
"one",
"two"], $vals);
◆ testGroupForwardsValuesOnWithValue()
GroupInputTest::testGroupForwardsValuesOnWithValue |
( |
| ) |
|
Definition at line 117 of file GroupInputTest.php.
119 $this->assertNotSame($this->child1, $this->child2);
122 ->expects($this->once())
123 ->method(
"withValue")
125 ->willReturn($this->child2);
127 ->expects($this->once())
128 ->method(
"isClientSideValueOk")
132 ->expects($this->once())
133 ->method(
"withValue")
135 ->willReturn($this->child1);
137 ->expects($this->once())
138 ->method(
"isClientSideValueOk")
142 $new_group = $this->group->withValue([1,2]);
144 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
145 $this->assertInstanceOf(Field\Group::class, $new_group);
146 $this->assertNotSame($this->group, $new_group);
◆ testGroupMayOnlyHaveInputChildren()
GroupInputTest::testGroupMayOnlyHaveInputChildren |
( |
| ) |
|
Definition at line 103 of file GroupInputTest.php.
References language().
105 $this->expectException(\InvalidArgumentException::class);
107 $this->group =
new Field\Group(
◆ testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength()
GroupInputTest::testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength |
( |
| ) |
|
Definition at line 188 of file GroupInputTest.php.
190 $this->expectException(\InvalidArgumentException::class);
192 $new_group = $this->group->withValue([1]);
◆ testGroupOnlyDoesNoAcceptNonArrayValue()
GroupInputTest::testGroupOnlyDoesNoAcceptNonArrayValue |
( |
| ) |
|
Definition at line 181 of file GroupInputTest.php.
183 $this->expectException(\InvalidArgumentException::class);
185 $new_group = $this->group->withValue(1);
◆ testGroupRendering()
GroupInputTest::testGroupRendering |
( |
| ) |
|
Definition at line 358 of file GroupInputTest.php.
References Vendor\Package\$f.
362 $f->text(
"input1",
"in 1"),
363 $f->text(
"input2",
"in 2")
365 $label =
'group label';
366 $group =
$f->group($inputs, $label);
369 <div
class=
"form-group row">
370 <label
for=
"id_1" class=
"control-label col-sm-3">input1</label>
371 <div
class=
"col-sm-9">
372 <input
id=
"id_1" type=
"text" name=
"" class=
"form-control form-control-sm" />
373 <div
class=
"help-block">in 1</div>
376 <div
class=
"form-group row">
377 <label
for=
"id_2" class=
"control-label col-sm-3">input2</label>
378 <div
class=
"col-sm-9">
379 <input
id=
"id_2" type=
"text" name=
"" class=
"form-control form-control-sm" />
380 <div
class=
"help-block">in 2</div>
386 $this->assertEquals($expected, $actual);
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
◆ testGroupWithoutRequiredField()
GroupInputTest::testGroupWithoutRequiredField |
( |
| ) |
|
◆ testGroupWithRequiredField()
GroupInputTest::testGroupWithRequiredField |
( |
| ) |
|
◆ testWithDisabledDisablesChildren()
GroupInputTest::testWithDisabledDisablesChildren |
( |
| ) |
|
Definition at line 59 of file GroupInputTest.php.
61 $this->assertNotSame($this->child1, $this->child2);
64 ->expects($this->once())
65 ->method(
"withDisabled")
67 ->willReturn($this->child2);
69 ->expects($this->once())
70 ->method(
"withDisabled")
72 ->willReturn($this->child1);
74 $new_group = $this->group->withDisabled(
true);
76 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
77 $this->assertInstanceOf(Field\Group::class, $new_group);
78 $this->assertNotSame($this->group, $new_group);
◆ testWithInputCallsChildrenAndAppliesOperations()
GroupInputTest::testWithInputCallsChildrenAndAppliesOperations |
( |
| ) |
|
Definition at line 215 of file GroupInputTest.php.
217 $this->assertNotSame($this->child1, $this->child2);
219 $input_data = $this->createMock(InputData::class);
222 ->expects($this->once())
223 ->method(
"withInput")
225 ->willReturn($this->child2);
227 ->expects($this->once())
228 ->method(
"getContent")
229 ->willReturn($this->data_factory->ok(
"one"));
231 ->expects($this->once())
232 ->method(
"withInput")
234 ->willReturn($this->child1);
236 ->expects($this->once())
237 ->method(
"getContent")
238 ->willReturn($this->data_factory->ok(
"two"));
241 $new_group = $this->group
242 ->withAdditionalTransformation($this->refinery->custom()->transformation(
function ($v) use (&$called) {
244 $this->assertEquals([
"two",
"one"], $v);
247 ->withInput($input_data);
249 $this->assertTrue($called);
250 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
251 $this->assertInstanceOf(Field\Group::class, $new_group);
252 $this->assertNotSame($this->group, $new_group);
253 $this->assertEquals($this->data_factory->ok(
"result"), $new_group->getContent());
◆ testWithInputDoesNotApplyOperationsOnError()
GroupInputTest::testWithInputDoesNotApplyOperationsOnError |
( |
| ) |
|
Definition at line 256 of file GroupInputTest.php.
References language().
258 $this->assertNotSame($this->child1, $this->child2);
260 $input_data = $this->createMock(InputData::class);
263 ->expects($this->once())
264 ->method(
"withInput")
266 ->willReturn($this->child2);
268 ->expects($this->once())
269 ->method(
"getContent")
270 ->willReturn($this->data_factory->error(
""));
272 ->expects($this->once())
273 ->method(
"withInput")
275 ->willReturn($this->child1);
277 ->expects($this->once())
278 ->method(
"getContent")
279 ->willReturn($this->data_factory->ok(
"two"));
281 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
283 ->expects($this->once())
285 ->with(
"ui_error_in_group")
288 $new_group = $this->group
289 ->withAdditionalTransformation($this->refinery->custom()->transformation(
function ($v) {
290 $this->assertFalse(
true,
"This should not happen.");
292 ->withInput($input_data);
294 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
295 $this->assertInstanceOf(Field\Group::class, $new_group);
296 $this->assertNotSame($this->group, $new_group);
297 $this->assertTrue($new_group->getContent()->isError());
◆ testWithoutChildren()
GroupInputTest::testWithoutChildren |
( |
| ) |
|
Definition at line 332 of file GroupInputTest.php.
References language().
334 $group =
new Field\Group(
342 $content = $group->getContent();
343 $this->assertInstanceOf(\
ILIAS\Data\
Result\Ok::class, $content);
344 $this->assertCount(0, $content->value());
Class ChatMainBarProvider .
A result encapsulates a value or an error and simplifies the handling of those.
◆ testWithRequiredRequiresChildren()
GroupInputTest::testWithRequiredRequiresChildren |
( |
| ) |
|
Definition at line 81 of file GroupInputTest.php.
83 $this->assertNotSame($this->child1, $this->child2);
86 ->expects($this->once())
87 ->method(
"withRequired")
89 ->willReturn($this->child2);
91 ->expects($this->once())
92 ->method(
"withRequired")
94 ->willReturn($this->child1);
96 $new_group = $this->group->withRequired(
true);
98 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
99 $this->assertInstanceOf(Field\Group::class, $new_group);
100 $this->assertNotSame($this->group, $new_group);
◆ testWithValuePreservesKeys()
GroupInputTest::testWithValuePreservesKeys |
( |
| ) |
|
Definition at line 149 of file GroupInputTest.php.
References language().
151 $this->assertNotSame($this->child1, $this->child2);
153 $this->group =
new Field\Group(
157 [
"child1" => $this->child1,
"child2" => $this->child2],
163 ->method(
"withValue")
164 ->willReturn($this->child2);
166 ->method(
"isClientSideValueOk")
169 ->method(
"withValue")
170 ->willReturn($this->child1);
172 ->method(
"isClientSideValueOk")
175 $new_group = $this->group->withValue([
"child1" => 1,
"child2" => 2]);
177 $this->assertEquals([
"child1" => $this->child2,
"child2" => $this->child1], $new_group->getInputs());
◆ $refinery
GroupInputTest::$refinery |
|
private |
The documentation for this class was generated from the following file: