Definition at line 40 of file OptionalGroupInputTest.php.
◆ setUp()
OptionalGroupInputTest::setUp |
( |
| ) |
|
◆ testCommonRendering()
OptionalGroupInputTest::testCommonRendering |
( |
| ) |
|
◆ testGroupAcceptsNullButDoesNotForward()
OptionalGroupInputTest::testGroupAcceptsNullButDoesNotForward |
( |
| ) |
|
Definition at line 206 of file OptionalGroupInputTest.php.
References null.
208 $this->assertNotSame($this->child1, $this->child2);
211 ->expects($this->never())
212 ->method(
"withValue");
214 ->expects($this->never())
215 ->method(
"isClientSideValueOk");
217 ->expects($this->never())
218 ->method(
"withValue");
220 ->expects($this->never())
221 ->method(
"isClientSideValueOk");
223 $new_group = $this->optional_group->withValue(
null);
225 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
226 $this->assertInstanceOf(OptionalGroup::class, $new_group);
227 $this->assertNotSame($this->optional_group, $new_group);
228 $this->assertEquals(
null, $new_group->getValue());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testGroupForwardsValuesOnGetValue()
OptionalGroupInputTest::testGroupForwardsValuesOnGetValue |
( |
| ) |
|
Definition at line 231 of file OptionalGroupInputTest.php.
233 $this->assertNotSame($this->child1, $this->child2);
236 ->expects($this->once())
241 ->expects($this->once())
246 $vals = $this->optional_group->getValue();
248 $this->assertEquals([
"one",
"two"], $vals);
◆ testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength()
OptionalGroupInputTest::testGroupOnlyDoesNoAcceptArrayValuesWithWrongLength |
( |
| ) |
|
Definition at line 200 of file OptionalGroupInputTest.php.
202 $this->expectException(InvalidArgumentException::class);
203 $this->optional_group->withValue([1]);
◆ testGroupOnlyDoesNoAcceptNonArrayValue()
OptionalGroupInputTest::testGroupOnlyDoesNoAcceptNonArrayValue |
( |
| ) |
|
Definition at line 194 of file OptionalGroupInputTest.php.
196 $this->expectException(InvalidArgumentException::class);
197 $this->optional_group->withValue(1);
◆ testOptionalGroupForwardsValuesOnWithValue()
OptionalGroupInputTest::testOptionalGroupForwardsValuesOnWithValue |
( |
| ) |
|
Definition at line 162 of file OptionalGroupInputTest.php.
164 $this->assertNotSame($this->child1, $this->child2);
167 ->expects($this->once())
168 ->method(
"withValue")
170 ->willReturn($this->child2);
172 ->expects($this->once())
173 ->method(
"isClientSideValueOk")
177 ->expects($this->once())
178 ->method(
"withValue")
180 ->willReturn($this->child1);
182 ->expects($this->once())
183 ->method(
"isClientSideValueOk")
187 $new_group = $this->optional_group->withValue([1,2]);
189 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
190 $this->assertInstanceOf(OptionalGroup::class, $new_group);
191 $this->assertNotSame($this->optional_group, $new_group);
◆ testOptionalGroupMayOnlyHaveInputChildren()
OptionalGroupInputTest::testOptionalGroupMayOnlyHaveInputChildren |
( |
| ) |
|
◆ testThatOptionalGroupIsNotRequiredBecauseOfItsChildren()
OptionalGroupInputTest::testThatOptionalGroupIsNotRequiredBecauseOfItsChildren |
( |
| ) |
|
Definition at line 135 of file OptionalGroupInputTest.php.
137 $this->assertNotSame($this->child1, $this->child2);
138 $this->child1->method(
'isRequired')->willReturn(
true);
139 $this->child2->method(
'isRequired')->willReturn(
true);
143 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
144 $this->assertInstanceOf(OptionalGroup::class, $new_group);
145 $this->assertFalse($new_group->isRequired());
◆ testWithDisabledDisablesChildren()
OptionalGroupInputTest::testWithDisabledDisablesChildren |
( |
| ) |
|
Definition at line 95 of file OptionalGroupInputTest.php.
97 $this->assertNotSame($this->child1, $this->child2);
100 ->expects($this->once())
101 ->method(
"withDisabled")
103 ->willReturn($this->child2);
105 ->expects($this->once())
106 ->method(
"withDisabled")
108 ->willReturn($this->child1);
110 $new_group = $this->optional_group->withDisabled(
true);
112 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
113 $this->assertInstanceOf(OptionalGroup::class, $new_group);
114 $this->assertNotSame($this->optional_group, $new_group);
◆ testWithInputCallsChildrenAndAppliesOperations()
OptionalGroupInputTest::testWithInputCallsChildrenAndAppliesOperations |
( |
| ) |
|
Definition at line 251 of file OptionalGroupInputTest.php.
References null, and ILIAS\Repository\refinery().
253 $this->assertNotSame($this->child1, $this->child2);
255 $input_data = $this->createMock(InputData::class);
258 ->expects($this->once())
260 ->with(
"name0",
null)
261 ->willReturn(
"checked");
264 ->expects($this->once())
265 ->method(
"withInput")
267 ->willReturn($this->child2);
269 ->expects($this->once())
270 ->method(
"getContent")
272 ->willReturn($this->data_factory->ok(
"one"));
274 ->expects($this->once())
275 ->method(
"withInput")
277 ->willReturn($this->child1);
279 ->expects($this->once())
280 ->method(
"getContent")
282 ->willReturn($this->data_factory->ok(
"two"));
285 $new_group = $this->optional_group
286 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called):
string {
288 $this->assertEquals([
"two",
"one"], $v);
291 ->withInput($input_data);
293 $this->assertTrue($called);
294 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
295 $this->assertInstanceOf(OptionalGroup::class, $new_group);
296 $this->assertNotSame($this->optional_group, $new_group);
297 $this->assertEquals($this->data_factory->ok(
"result"), $new_group->getContent());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testWithInputDoesNotApplyOperationsOnError()
OptionalGroupInputTest::testWithInputDoesNotApplyOperationsOnError |
( |
| ) |
|
Definition at line 300 of file OptionalGroupInputTest.php.
References ILIAS\UI\examples\Symbol\Glyph\Language\language(), null, and ILIAS\Repository\refinery().
302 $this->assertNotSame($this->child1, $this->child2);
304 $input_data = $this->createMock(InputData::class);
307 ->expects($this->once())
309 ->with(
"name0",
null)
310 ->willReturn(
"checked");
313 ->expects($this->once())
314 ->method(
"withInput")
316 ->willReturn($this->child2);
318 ->expects($this->once())
319 ->method(
"getContent")
320 ->willReturn($this->data_factory->error(
""));
322 ->expects($this->once())
323 ->method(
"withInput")
325 ->willReturn($this->child1);
327 ->expects($this->once())
328 ->method(
"getContent")
329 ->willReturn($this->data_factory->ok(
"two"));
331 $i18n =
"THERE IS SOME ERROR IN THIS GROUP";
333 ->expects($this->once())
335 ->with(
"ui_error_in_group")
338 $new_group = $this->optional_group
339 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ():
void {
340 $this->fail(
"This should not happen.");
342 ->withInput($input_data);
344 $this->assertEquals([$this->child2, $this->child1], $new_group->getInputs());
345 $this->assertInstanceOf(OptionalGroup::class, $new_group);
346 $this->assertNotSame($this->optional_group, $new_group);
347 $this->assertTrue($new_group->getContent()->isError());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
language()
description: > Example for rendring a language glyph.
◆ testWithInputDoesNotCallChildrenWhenUnchecked()
OptionalGroupInputTest::testWithInputDoesNotCallChildrenWhenUnchecked |
( |
| ) |
|
Definition at line 350 of file OptionalGroupInputTest.php.
References null, and ILIAS\Repository\refinery().
352 $this->assertNotSame($this->child1, $this->child2);
354 $input_data = $this->createMock(InputData::class);
357 ->expects($this->once())
359 ->with(
"name0",
null)
363 ->expects($this->never())
364 ->method(
"withInput");
366 ->expects($this->never())
367 ->method(
"getContent");
369 ->expects($this->never())
370 ->method(
"withInput");
372 ->expects($this->never())
373 ->method(
"getContent");
376 $new_group = $this->optional_group
377 ->withAdditionalTransformation($this->
refinery->custom()->transformation(
function ($v) use (&$called):
string {
379 $this->assertEquals(
null, $v);
382 ->withInput($input_data);
384 $this->assertTrue($called);
385 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
386 $this->assertInstanceOf(OptionalGroup::class, $new_group);
387 $this->assertNotSame($this->optional_group, $new_group);
388 $this->assertEquals($this->data_factory->ok(
"result"), $new_group->getContent());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
◆ testWithRequiredDoesNotRequire()
OptionalGroupInputTest::testWithRequiredDoesNotRequire |
( |
| ) |
|
Definition at line 117 of file OptionalGroupInputTest.php.
119 $this->assertNotSame($this->child1, $this->child2);
122 ->expects($this->never())
123 ->method(
"withRequired");
125 ->expects($this->never())
126 ->method(
"withRequired");
128 $new_group = $this->optional_group->withRequired(
true);
130 $this->assertEquals([$this->child1, $this->child2], $new_group->getInputs());
131 $this->assertInstanceOf(OptionalGroup::class, $new_group);
132 $this->assertNotSame($this->optional_group, $new_group);
◆ $child1
OptionalGroupInputTest::$child1 |
|
protected |
◆ $child2
OptionalGroupInputTest::$child2 |
|
protected |
◆ $data_factory
◆ $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: