ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ViewControlSortationTest Class Reference
+ Inheritance diagram for ViewControlSortationTest:
+ Collaboration diagram for ViewControlSortationTest:

Public Member Functions

 testViewControlSortationConstruct ()
 
 testViewControlSortationWithWrongValue ()
 
 testViewControlSortationWithInput ()
 
 testViewControlFieldSortationRendering ()
 
 testViewControlSortationRenderingOutsideContainer ()
 
- 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)
 

Additional Inherited Members

- 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 ViewControlSortationTest.php.

Member Function Documentation

◆ testViewControlFieldSortationRendering()

ViewControlSortationTest::testViewControlFieldSortationRendering ( )

Definition at line 84 of file ViewControlSortationTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ViewControlBaseTest\buildVCFactory(), and ILIAS_UI_TestBase\getDefaultRenderer().

84  : void
85  {
86  $r = $this->getDefaultRenderer();
87  $options = [
88  'A' => new Order('opt', 'ASC'),
89  'B' => new Order('opt', 'DESC')
90  ];
91  $vc = $this->buildVCFactory()->sortation($options)
92  ->withOnChange((new SignalGenerator())->create());
93 
94  $expected = $this->brutallyTrimHTML('
95 <div class="dropdown il-viewcontrol il-viewcontrol-sortation l-bar__element" id="id_3">
96  <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="caret"></span></button>
97  <ul id="id_3_ctrl" class="dropdown-menu">
98  <li><button class="btn btn-link" id="id_1">A</button></li>
99  <li><button class="btn btn-link" id="id_2">B</button></li>
100  </ul>
101  <div class="il-viewcontrol-value" role="none">
102  <input id="id_4" type="hidden" value="" />
103  <input id="id_5" type="hidden" value="" />
104  </div>
105 </div>
106 ');
107  $html = $this->brutallyTrimHTML($r->render($vc));
108  $this->assertEquals($expected, $html);
109  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
+ Here is the call graph for this function:

◆ testViewControlSortationConstruct()

ViewControlSortationTest::testViewControlSortationConstruct ( )

Definition at line 33 of file ViewControlSortationTest.php.

References ViewControlBaseTest\buildVCFactory().

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  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
+ Here is the call graph for this function:

◆ testViewControlSortationRenderingOutsideContainer()

ViewControlSortationTest::testViewControlSortationRenderingOutsideContainer ( )

Definition at line 111 of file ViewControlSortationTest.php.

References ViewControlBaseTest\buildVCFactory().

111  : void
112  {
113  $options = ['A' => new Order('opt', 'ASC')];
114  $this->expectException(\LogicException::class);
115  $this->buildVCFactory()->sortation($options)->getOnChangeSignal();
116  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
+ Here is the call graph for this function:

◆ testViewControlSortationWithInput()

ViewControlSortationTest::testViewControlSortationWithInput ( )

Definition at line 57 of file ViewControlSortationTest.php.

References ViewControlBaseTest\buildDataFactory(), ViewControlBaseTest\buildVCFactory(), and ViewControlBaseTest\getNamesource().

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  ->will(
69  $this->onConsecutiveCalls($v[0], $v[1])
70  );
71 
72  $vc = $this->buildVCFactory()->sortation($options)
73  ->withNameFrom($this->getNamesource())
74  ->withInput($input);
75 
76  $df = $this->buildDataFactory();
77  $this->assertEquals(
78  $df->ok($df->order('opt', 'DESC')),
79  $vc->getContent()
80  );
81  $this->assertEquals($v, $vc->getValue());
82  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
+ Here is the call graph for this function:

◆ testViewControlSortationWithWrongValue()

ViewControlSortationTest::testViewControlSortationWithWrongValue ( )

Definition at line 46 of file ViewControlSortationTest.php.

References ViewControlBaseTest\buildVCFactory().

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  }
Both the subject and the direction need to be specified when expressing an order. ...
Definition: Order.php:12
+ Here is the call graph for this function:

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