ILIAS  trunk Revision v12.0_alpha-1541-g23eaa5e013d
ViewControlSortationTest Class Reference
+ Inheritance diagram for ViewControlSortationTest:
+ Collaboration diagram for ViewControlSortationTest:

Public Member Functions

 testViewControlSortationConstruct ()
 
 testViewControlSortationWithWrongValue ()
 
 testViewControlSortationWithInput ()
 
 testViewControlFieldSortationRendering ()
 
 testViewControlSortationRenderingOutsideContainer ()
 
 testViewControlFieldWithSignalsRendering ()
 
- Public Member Functions inherited from ViewControlTestBase
 getUIFactory ()
 
 getDataFactory ()
 

Additional Inherited Members

- Protected Member Functions inherited from ViewControlTestBase
 getNamesource ()
 
 buildDataFactory ()
 
 buildRefinery ()
 
 buildFieldFactory ()
 
 buildVCFactory ()
 

Detailed Description

Definition at line 31 of file ViewControlSortationTest.php.

Member Function Documentation

◆ testViewControlFieldSortationRendering()

ViewControlSortationTest::testViewControlFieldSortationRendering ( )

Definition at line 82 of file ViewControlSortationTest.php.

82 : void
83 {
84 $r = $this->getDefaultRenderer();
85 $options = [
86 'A' => new Order('opt', 'ASC'),
87 'B' => new Order('opt', 'DESC')
88 ];
89 $vc = $this->buildVCFactory()->sortation($options)
90 ->withOnChange((new SignalGenerator())->create());
91
92 $expected = $this->brutallyTrimHTML('
93<div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_3">
94 <button class="btn btn-ctrl dropdown-toggle" type="button" data-toggle="dropdown" aria-label="label_sortation" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_ctrl"><span class="glyphicon-sort"></span></button>
95 <ul id="id_3_ctrl" class="dropdown-menu">
96 <li><button class="btn btn-link" id="id_1">A</button></li>
97 <li><button class="btn btn-link" id="id_2">B</button></li>
98 </ul>
99 <div class="il-viewcontrol-value" role="none">
100 <input id="id_4" type="hidden" value="" />
101 <input id="id_5" type="hidden" value="" />
102 </div>
103</div>
104');
105 $html = $this->brutallyTrimHTML($r->render($vc));
106 $this->assertEquals($expected, $html);
107 }
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:29

References ILIAS\UI\Implementation\Component\Input\Field\$options, and ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlFieldWithSignalsRendering()

ViewControlSortationTest::testViewControlFieldWithSignalsRendering ( )

Definition at line 117 of file ViewControlSortationTest.php.

117 : void
118 {
119 $r = $this->getDefaultRenderer();
120 $options = [
121 'A' => new Order('opt', 'ASC'),
122 'B' => new Order('opt', 'DESC')
123 ];
124 $vc = $this->buildVCFactory()->sortation($options)
125 ->withOnChange((new SignalGenerator())->create());
126
127 $expected = $this->brutallyTrimHTML('
128<div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_3">
129 <button class="btn btn-ctrl dropdown-toggle" type="button" data-toggle="dropdown" aria-label="label_sortation" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_ctrl"><span class="glyphicon-sort"></span></button>
130 <ul id="id_3_ctrl" class="dropdown-menu">
131 <li><button class="btn btn-link" id="id_1">A</button></li>
132 <li><button class="btn btn-link" id="id_2">B</button></li>
133 </ul>
134 <div class="il-viewcontrol-value" role="none">
135 <input id="id_4" type="hidden" value="" />
136 <input id="id_5" type="hidden" value="" />
137 </div>
138</div>
139');
140 $html = $this->brutallyTrimHTML($r->render($vc));
141 $this->assertEquals($expected, $html);
142 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, and ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlSortationConstruct()

ViewControlSortationTest::testViewControlSortationConstruct ( )

Definition at line 33 of file ViewControlSortationTest.php.

33 : void
34 {
35 $options = [
36 'A' => new Order('opt', 'ASC'),
37 'B' => new Order('opt', 'DESC')
38 ];
39 $vc = $this->buildVCFactory()->sortation($options);
40 $r = ILIAS\UI\Implementation\Component\Input\ViewControl\Renderer::class;
41
42 $this->assertInstanceOf(Signal::class, $vc->getInternalSignal());
43 $this->assertEquals($options, $vc->getOptions());
44 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, and ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlSortationRenderingOutsideContainer()

ViewControlSortationTest::testViewControlSortationRenderingOutsideContainer ( )

Definition at line 109 of file ViewControlSortationTest.php.

109 : void
110 {
111 $options = ['A' => new Order('opt', 'ASC')];
112 $this->expectException(\LogicException::class);
113 $this->buildVCFactory()->sortation($options)->getOnChangeSignal();
114 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, and ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

◆ testViewControlSortationWithInput()

ViewControlSortationTest::testViewControlSortationWithInput ( )

Definition at line 57 of file ViewControlSortationTest.php.

57 : void
58 {
59 $options = [
60 'A' => new Order('opt', 'ASC'),
61 'B' => new Order('opt', 'DESC')
62 ];
63 $v = ['opt', 'DESC'];
64
65 $input = $this->createMock(InputData::class);
66 $input->expects($this->exactly(2))
67 ->method("getOr")
68 ->willReturnOnConsecutiveCalls($v[0], $v[1]);
69
70 $vc = $this->buildVCFactory()->sortation($options)
71 ->withNameFrom($this->getNamesource())
72 ->withInput($input);
73
74 $df = $this->buildDataFactory();
75 $this->assertEquals(
76 $df->ok($df->order('opt', 'DESC')),
77 $vc->getContent()
78 );
79 $this->assertEquals($v, $vc->getValue());
80 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, ViewControlTestBase\buildDataFactory(), ViewControlTestBase\buildVCFactory(), and ViewControlTestBase\getNamesource().

+ Here is the call graph for this function:

◆ testViewControlSortationWithWrongValue()

ViewControlSortationTest::testViewControlSortationWithWrongValue ( )

Definition at line 46 of file ViewControlSortationTest.php.

46 : void
47 {
48 $this->expectException(\InvalidArgumentException::class);
49 $options = [
50 'A' => new Order('opt', 'ASC'),
51 'B' => new Order('opt', 'DESC')
52 ];
53 $vc = $this->buildVCFactory()->sortation($options)
54 ->withValue('notokvalue:DESC');
55 }

References ILIAS\UI\Implementation\Component\Input\Field\$options, and ViewControlTestBase\buildVCFactory().

+ Here is the call graph for this function:

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