Definition at line 39 of file OptionalGroupInputTest.php.
◆ setUp()
OptionalGroupInputTest::setUp |
( |
| ) |
|
◆ testGroupAcceptsNullButDoesNotForward()
OptionalGroupInputTest::testGroupAcceptsNullButDoesNotForward |
( |
| ) |
|
Definition at line 203 of file OptionalGroupInputTest.php.
205 $this->assertNotSame($this->child1, $this->child2);
208 ->expects($this->never())
209 ->method(
"withValue");
211 ->expects($this->never())
212 ->method(
"isClientSideValueOk");
214 ->expects($this->never())
215 ->method(
"withValue");
217 ->expects($this->never())
218 ->method(
"isClientSideValueOk");
220 $new_group = $this->optional_group->withValue(null);
222 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
223 $this->assertInstanceOf(OptionalGroup::class, $new_group);
224 $this->assertNotSame($this->optional_group, $new_group);
225 $this->assertEquals(null, $new_group->getValue());
◆ testGroupForwardsValuesOnGetValue()
OptionalGroupInputTest::testGroupForwardsValuesOnGetValue |
( |
| ) |
|
Definition at line 228 of file OptionalGroupInputTest.php.
230 $this->assertNotSame($this->child1, $this->child2);
233 ->expects($this->once())
238 ->expects($this->once())
243 $vals = $this->optional_group->getValue();
245 $this->assertEquals([
"one",
"two"], $vals);
◆ testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength()
OptionalGroupInputTest::testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength |
( |
| ) |
|
Definition at line 197 of file OptionalGroupInputTest.php.
199 $this->expectException(InvalidArgumentException::class);
200 $this->optional_group->withValue([1]);
◆ testGroupOnlyDoesNoAcceptNonArrayValue()
OptionalGroupInputTest::testGroupOnlyDoesNoAcceptNonArrayValue |
( |
| ) |
|
Definition at line 191 of file OptionalGroupInputTest.php.
193 $this->expectException(InvalidArgumentException::class);
194 $this->optional_group->withValue(1);
◆ testOptionalGroupForwardsValuesOnWithValue()
OptionalGroupInputTest::testOptionalGroupForwardsValuesOnWithValue |
( |
| ) |
|
Definition at line 159 of file OptionalGroupInputTest.php.
161 $this->assertNotSame($this->child1, $this->child2);
164 ->expects($this->once())
165 ->method(
"withValue")
167 ->willReturn($this->child2);
169 ->expects($this->once())
170 ->method(
"isClientSideValueOk")
174 ->expects($this->once())
175 ->method(
"withValue")
177 ->willReturn($this->child1);
179 ->expects($this->once())
180 ->method(
"isClientSideValueOk")
184 $new_group = $this->optional_group->withValue([1,2]);
186 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
187 $this->assertInstanceOf(OptionalGroup::class, $new_group);
188 $this->assertNotSame($this->optional_group, $new_group);
◆ testOptionalGroupMayOnlyHaveInputChildren()
OptionalGroupInputTest::testOptionalGroupMayOnlyHaveInputChildren |
( |
| ) |
|
◆ testThatOptionalGroupIsNotRequiredBecauseOfItsChildren()
OptionalGroupInputTest::testThatOptionalGroupIsNotRequiredBecauseOfItsChildren |
( |
| ) |
|
Definition at line 132 of file OptionalGroupInputTest.php.
134 $this->assertNotSame($this->child1, $this->child2);
135 $this->child1->method(
'isRequired')->willReturn(
true);
136 $this->child2->method(
'isRequired')->willReturn(
true);
140 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
141 $this->assertInstanceOf(OptionalGroup::class, $new_group);
142 $this->assertFalse($new_group->isRequired());
◆ testWithDisabledDisablesChildren()
OptionalGroupInputTest::testWithDisabledDisablesChildren |
( |
| ) |
|
Definition at line 92 of file OptionalGroupInputTest.php.
94 $this->assertNotSame($this->child1, $this->child2);
97 ->expects($this->once())
98 ->method(
"withDisabled")
100 ->willReturn($this->child2);
102 ->expects($this->once())
103 ->method(
"withDisabled")
105 ->willReturn($this->child1);
107 $new_group = $this->optional_group->withDisabled(
true);
109 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
110 $this->assertInstanceOf(OptionalGroup::class, $new_group);
111 $this->assertNotSame($this->optional_group, $new_group);
◆ testWithInputCallsChildrenAndAppliesOperations()
OptionalGroupInputTest::testWithInputCallsChildrenAndAppliesOperations |
( |
| ) |
|
Definition at line 248 of file OptionalGroupInputTest.php.
References ILIAS\Repository\refinery().
250 $this->assertNotSame($this->child1, $this->child2);
252 $input_data = $this->createMock(InputData::class);
255 ->expects($this->once())
257 ->with(
"name0", null)
258 ->willReturn(
"checked");
261 ->expects($this->once())
262 ->method(
"withInput")
264 ->willReturn($this->child2);
266 ->expects($this->once())
267 ->method(
"getContent")
269 ->willReturn($this->data_factory->ok(
"one"));
271 ->expects($this->once())
272 ->method(
"withInput")
274 ->willReturn($this->child1);
276 ->expects($this->once())
277 ->method(
"getContent")
279 ->willReturn($this->data_factory->ok(
"two"));
282 $new_group = $this->optional_group
283 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called):
string {
285 $this->assertEquals([
"two",
"one"], $v);
288 ->withInput($input_data);
290 $this->assertTrue($called);
291 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
292 $this->assertInstanceOf(OptionalGroup::class, $new_group);
293 $this->assertNotSame($this->optional_group, $new_group);
294 $this->assertEquals($this->data_factory->ok(
"result"), $new_group->getContent());
◆ testWithInputDoesNotApplyOperationsOnError()
OptionalGroupInputTest::testWithInputDoesNotApplyOperationsOnError |
( |
| ) |
|
Definition at line 297 of file OptionalGroupInputTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language(), and ILIAS\Repository\refinery().
299 $this->assertNotSame($this->child1, $this->child2);
301 $input_data = $this->createMock(InputData::class);
304 ->expects($this->once())
306 ->with(
"name0", null)
307 ->willReturn(
"checked");
310 ->expects($this->once())
311 ->method(
"withInput")
313 ->willReturn($this->child2);
315 ->expects($this->once())
316 ->method(
"getContent")
317 ->willReturn($this->data_factory->error(
""));
319 ->expects($this->once())
320 ->method(
"withInput")
322 ->willReturn($this->child1);
324 ->expects($this->once())
325 ->method(
"getContent")
326 ->willReturn($this->data_factory->ok(
"two"));
328 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
330 ->expects($this->once())
332 ->with(
"ui_error_in_group")
335 $new_group = $this->optional_group
336 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ():
void {
337 $this->fail(
"This should not happen.");
339 ->withInput($input_data);
341 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
342 $this->assertInstanceOf(OptionalGroup::class, $new_group);
343 $this->assertNotSame($this->optional_group, $new_group);
344 $this->assertTrue($new_group->getContent()->isError());
◆ testWithInputDoesNotCallChildrenWhenUnchecked()
OptionalGroupInputTest::testWithInputDoesNotCallChildrenWhenUnchecked |
( |
| ) |
|
Definition at line 347 of file OptionalGroupInputTest.php.
References ILIAS\Repository\refinery().
349 $this->assertNotSame($this->child1, $this->child2);
351 $input_data = $this->createMock(InputData::class);
354 ->expects($this->once())
356 ->with(
"name0", null)
360 ->expects($this->never())
361 ->method(
"withInput");
363 ->expects($this->never())
364 ->method(
"getContent");
366 ->expects($this->never())
367 ->method(
"withInput");
369 ->expects($this->never())
370 ->method(
"getContent");
373 $new_group = $this->optional_group
374 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called):
string {
376 $this->assertEquals(null, $v);
379 ->withInput($input_data);
381 $this->assertTrue($called);
382 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
383 $this->assertInstanceOf(OptionalGroup::class, $new_group);
384 $this->assertNotSame($this->optional_group, $new_group);
385 $this->assertEquals($this->data_factory->ok(
"result"), $new_group->getContent());
◆ testWithRequiredDoesNotRequire()
OptionalGroupInputTest::testWithRequiredDoesNotRequire |
( |
| ) |
|
Definition at line 114 of file OptionalGroupInputTest.php.
116 $this->assertNotSame($this->child1, $this->child2);
119 ->expects($this->never())
120 ->method(
"withRequired");
122 ->expects($this->never())
123 ->method(
"withRequired");
125 $new_group = $this->optional_group->withRequired(
true);
127 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
128 $this->assertInstanceOf(OptionalGroup::class, $new_group);
129 $this->assertNotSame($this->optional_group, $new_group);
◆ $child1
OptionalGroupInputTest::$child1 |
|
protected |
◆ $child2
OptionalGroupInputTest::$child2 |
|
protected |
◆ $data_factory
Data Factory OptionalGroupInputTest::$data_factory |
|
protected |
◆ $group
◆ $language
OptionalGroupInputTest::$language |
|
protected |
◆ $optional_group
ILIAS UI Component Input Field Group OptionalGroupInputTest::$optional_group |
|
protected |
◆ $refinery
Refinery OptionalGroupInputTest::$refinery |
|
protected |
The documentation for this class was generated from the following file: