ILIAS  release_8 Revision v8.24
ViewControlGenericTest Class Reference
+ Inheritance diagram for ViewControlGenericTest:
+ Collaboration diagram for ViewControlGenericTest:

Public Member Functions

 testViewControlSortationMutators ()
 
 testViewControlWithInput ()
 
- Public Member Functions inherited from ViewControlBaseTest
 getUIFactory ()
 
 getDataFactory ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getViewControl ()
 
- Protected Member Functions inherited from ViewControlBaseTest
 getNamesource ()
 
 buildDataFactory ()
 
 buildRefinery ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Definition at line 31 of file ViewControlInputGenericTest.php.

Member Function Documentation

◆ getViewControl()

ViewControlGenericTest::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 ViewControlBaseTest\buildDataFactory(), ViewControlBaseTest\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()

ViewControlGenericTest::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()

ViewControlGenericTest::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 ViewControlBaseTest\buildDataFactory(), ViewControlBaseTest\buildRefinery(), ViewControlBaseTest\getNamesource(), and getViewControl().

+ Here is the call graph for this function:

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