ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ViewControlContainerTest Class Reference
+ Inheritance diagram for ViewControlContainerTest:
+ Collaboration diagram for ViewControlContainerTest:

Public Member Functions

 testViewControlContainerConstruct ()
 
 testViewControlContainerWithControls ()
 
 testViewControlContainerWithRequest ()
 
 testViewControlContainerRenderWithoutRequest ()
 
 testViewControlContainerTransforms ()
 
 testExtractCurrentValues ()
 

Protected Member Functions

 buildDataFactory ()
 
 buildRefinery ()
 
 buildContainerFactory ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 

Detailed Description

Definition at line 35 of file ViewControlContainerTest.php.

Member Function Documentation

◆ buildContainerFactory()

ViewControlContainerTest::buildContainerFactory ( )
protected

Definition at line 48 of file ViewControlContainerTest.php.

References buildVCFactory().

Referenced by testExtractCurrentValues(), testViewControlContainerConstruct(), testViewControlContainerRenderWithoutRequest(), testViewControlContainerTransforms(), testViewControlContainerWithControls(), and testViewControlContainerWithRequest().

48  : VC\Factory
49  {
50  return new VC\Factory(
51  new I\SignalGenerator(),
52  $this->buildVCFactory(),
53  );
54  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildDataFactory()

ViewControlContainerTest::buildDataFactory ( )
protected

Definition at line 37 of file ViewControlContainerTest.php.

Referenced by buildFieldFactory(), buildRefinery(), buildVCFactory(), and testViewControlContainerWithRequest().

37  : Data\Factory
38  {
39  return new Data\Factory();
40  }
+ Here is the caller graph for this function:

◆ buildFieldFactory()

ViewControlContainerTest::buildFieldFactory ( )
protected

Definition at line 55 of file ViewControlContainerTest.php.

References buildDataFactory(), buildRefinery(), and getLanguage().

Referenced by buildVCFactory().

55  : FieldFactory
56  {
57  return new FieldFactory(
58  $this->createMock(\ILIAS\UI\Implementation\Component\Input\Field\Node\Factory::class),
59  $this->createMock(UploadLimitResolver::class),
60  new I\SignalGenerator(),
61  $this->buildDataFactory(),
62  $this->buildRefinery(),
63  $this->getLanguage()
64  );
65  }
Interface Observer Contains several chained tasks and infos about them.
getLanguage()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildRefinery()

ViewControlContainerTest::buildRefinery ( )
protected

Definition at line 41 of file ViewControlContainerTest.php.

References buildDataFactory().

Referenced by buildFieldFactory(), buildVCFactory(), and testViewControlContainerTransforms().

41  : Refinery
42  {
43  return new Refinery(
44  $this->buildDataFactory(),
45  $this->createMock(ILIAS\Language\Language::class)
46  );
47  }
Interface Observer Contains several chained tasks and infos about them.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildVCFactory()

ViewControlContainerTest::buildVCFactory ( )
protected

Definition at line 67 of file ViewControlContainerTest.php.

References buildDataFactory(), buildFieldFactory(), buildRefinery(), and getLanguage().

Referenced by buildContainerFactory(), testExtractCurrentValues(), testViewControlContainerRenderWithoutRequest(), testViewControlContainerTransforms(), testViewControlContainerWithControls(), and testViewControlContainerWithRequest().

67  : Control\Factory
68  {
69  return new Control\Factory(
70  $this->buildFieldFactory(),
71  $this->buildDataFactory(),
72  $this->buildRefinery(),
73  new I\SignalGenerator(),
74  $this->getLanguage(),
75  );
76  }
getLanguage()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testExtractCurrentValues()

ViewControlContainerTest::testExtractCurrentValues ( )

Definition at line 176 of file ViewControlContainerTest.php.

References $data, buildContainerFactory(), and buildVCFactory().

176  : void
177  {
178  $c_factory = $this->buildVCFactory();
179  $controls = [
180  $c_factory->fieldSelection(['a1' => 'A','a2' => 'B','a3' => 'C'])
181  ->withValue(['a1', 'a3']),
182  $c_factory->sortation([
183  '2up' => new Data\Order('a2', 'ASC'),
184  '2down' => new Data\Order('a2', 'DESC')
185  ])->withValue(['a2', 'DESC']),
186  ];
187 
188  $vc = $this->buildContainerFactory()->standard($controls);
189  $data = $vc->getComponentInternalValues();
190 
191  $this->assertEquals(
192  [
193  'view_control/input_0' => ['a1', 'a3'],
194  'view_control/input_1/input_2' => 'a2',
195  'view_control/input_1/input_3' => 'DESC'
196  ],
197  $data
198  );
199  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
+ Here is the call graph for this function:

◆ testViewControlContainerConstruct()

ViewControlContainerTest::testViewControlContainerConstruct ( )

Definition at line 78 of file ViewControlContainerTest.php.

References buildContainerFactory().

78  : void
79  {
80  $vc = $this->buildContainerFactory()->standard([]);
81  $this->assertInstanceOf(VC\ViewControl::class, $vc);
82  $this->assertInstanceOf(I\Signal::class, $vc->getSubmissionSignal());
83  }
+ Here is the call graph for this function:

◆ testViewControlContainerRenderWithoutRequest()

ViewControlContainerTest::testViewControlContainerRenderWithoutRequest ( )

Definition at line 141 of file ViewControlContainerTest.php.

References buildContainerFactory(), and buildVCFactory().

141  : void
142  {
143  $this->expectException(\LogicException::class);
144 
145  $c_factory = $this->buildVCFactory();
146  $controls = [
147  $c_factory->fieldSelection(['a1' => 'A','a2' => 'B','a3' => 'C'])
148  ];
149  $vc = $this->buildContainerFactory()->standard($controls);
150  $this->getDefaultRenderer()->render($vc);
151  }
+ Here is the call graph for this function:

◆ testViewControlContainerTransforms()

ViewControlContainerTest::testViewControlContainerTransforms ( )

Definition at line 153 of file ViewControlContainerTest.php.

References buildContainerFactory(), buildRefinery(), and buildVCFactory().

153  : void
154  {
155  $transform = $this->buildRefinery()->custom()->transformation(
156  fn($v) => ['modified' => 'transformed']
157  );
158 
159  $request = $this->createMock(ServerRequestInterface::class);
160  $request->expects($this->once())
161  ->method("getQueryParams")
162  ->willReturn(['some' => 'data']);
163 
164  $controls = [
165  $this->buildVCFactory()->fieldSelection(['a1' => 'A'])
166  ];
167  $vc = $this->buildContainerFactory()->standard($controls)
168  ->withAdditionalTransformation($transform)
169  ->withRequest($request);
170 
171 
172  $expected = ['modified' => 'transformed'];
173  $this->assertEquals($expected, $vc->getData());
174  }
+ Here is the call graph for this function:

◆ testViewControlContainerWithControls()

ViewControlContainerTest::testViewControlContainerWithControls ( )

Definition at line 85 of file ViewControlContainerTest.php.

References buildContainerFactory(), and buildVCFactory().

85  : void
86  {
87  $c_factory = $this->buildVCFactory();
88  $controls = [
89  $c_factory->fieldSelection([]),
90  $c_factory->sortation([]),
91  $c_factory->pagination()
92  ];
93 
94  $name_source = new FormInputNameSource();
95  $vc = $this->buildContainerFactory()->standard($controls);
96  $this->assertSameSize($controls, $vc->getInputs());
97 
98  $named = array_map(
99  fn($input) => $input->withNameFrom($name_source, 'view_control'),
100  $vc->getInputs()
101  );
102 
103  $this->assertEquals($named, $vc->getInputs());
104  }
FormInputNameSource is responsible for generating continuous form input names.
+ Here is the call graph for this function:

◆ testViewControlContainerWithRequest()

ViewControlContainerTest::testViewControlContainerWithRequest ( )

Definition at line 106 of file ViewControlContainerTest.php.

References $data, buildContainerFactory(), buildDataFactory(), and buildVCFactory().

106  : void
107  {
108  $request = $this->createMock(ServerRequestInterface::class);
109  $request
110  ->expects($this->once())
111  ->method("getQueryParams")
112  ->willReturn([
113  'view_control/input_0' => ['a1', 'a3'],
114  'view_control/input_1/input_2' => 'a2',
115  'view_control/input_1/input_3' => 'DESC'
116  ]);
117 
118  $c_factory = $this->buildVCFactory();
119  $controls = [
120  $c_factory->fieldSelection(['a1' => 'A','a2' => 'B','a3' => 'C']),
121  $c_factory->sortation([
122  '2up' => new Data\Order('a2', 'ASC'),
123  '2down' => new Data\Order('a2', 'DESC')
124  ]),
125  ];
126 
127  $vc = $this->buildContainerFactory()->standard($controls);
128  $vc2 = $vc->withRequest($request);
129  $this->assertNotSame($vc2, $vc);
130 
131  $data = $vc2->getData();
132  $this->assertSameSize($controls, $data);
133 
134  $expected = [
135  ['a1','a3'],
136  $this->buildDataFactory()->order('a2', 'DESC')
137  ];
138  $this->assertEquals($expected, array_values($data));
139  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:28
+ Here is the call graph for this function:

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