19 declare(strict_types=1);
21 require_once
'./vendor/composer/vendor/autoload.php';
22 require_once
'./components/ILIAS/UI/tests/Base.php';
39 return new Data\Factory();
45 $this->createMock(
ILIAS\Language\Language::class)
50 return new VC\Factory(
51 new I\SignalGenerator(),
59 $this->createMock(UploadLimitResolver::class),
60 new I\SignalGenerator(),
69 return new Control\Factory(
73 new I\SignalGenerator(),
81 $this->assertInstanceOf(
VC\ViewControl::class, $vc);
82 $this->assertInstanceOf(
I\Signal::class, $vc->getSubmissionSignal());
89 $c_factory->fieldSelection([]),
90 $c_factory->sortation([]),
91 $c_factory->pagination()
96 $this->assertSameSize($controls, $vc->getInputs());
99 fn($input) => $input->withNameFrom($name_source,
'view_control'),
103 $this->assertEquals($named, $vc->getInputs());
108 $request = $this->createMock(ServerRequestInterface::class);
110 ->expects($this->once())
111 ->method(
"getQueryParams")
113 'view_control/input_0' => [
'a1',
'a3'],
114 'view_control/input_1/input_2' =>
'a2',
115 'view_control/input_1/input_3' =>
'DESC' 120 $c_factory->fieldSelection([
'a1' =>
'A',
'a2' =>
'B',
'a3' =>
'C']),
121 $c_factory->sortation([
128 $vc2 = $vc->withRequest($request);
129 $this->assertNotSame($vc2, $vc);
131 $data = $vc2->getData();
132 $this->assertSameSize($controls,
$data);
138 $this->assertEquals($expected, array_values(
$data));
143 $this->expectException(\LogicException::class);
147 $c_factory->fieldSelection([
'a1' =>
'A',
'a2' =>
'B',
'a3' =>
'C'])
150 $this->getDefaultRenderer()->render($vc);
155 $transform = $this->
buildRefinery()->custom()->transformation(
156 fn($v) => [
'modified' =>
'transformed']
159 $request = $this->createMock(ServerRequestInterface::class);
160 $request->expects($this->once())
161 ->method(
"getQueryParams")
162 ->willReturn([
'some' =>
'data']);
168 ->withAdditionalTransformation($transform)
169 ->withRequest($request);
172 $expected = [
'modified' =>
'transformed'];
173 $this->assertEquals($expected, $vc->getData());
180 $c_factory->fieldSelection([
'a1' =>
'A',
'a2' =>
'B',
'a3' =>
'C'])
181 ->withValue([
'a1',
'a3']),
182 $c_factory->sortation([
185 ])->withValue([
'a2',
'DESC']),
189 $data = $vc->getComponentInternalValues();
193 'view_control/input_0' => [
'a1',
'a3'],
194 'view_control/input_1/input_2' =>
'a2',
195 'view_control/input_1/input_3' =>
'DESC'
Interface Observer Contains several chained tasks and infos about them.
Both the subject and the direction need to be specified when expressing an order. ...
testViewControlContainerTransforms()
testViewControlContainerConstruct()
testViewControlContainerWithRequest()
testViewControlContainerWithControls()
testViewControlContainerRenderWithoutRequest()
testExtractCurrentValues()