ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PaginationTest Class Reference

Test on Pagination view control. More...

+ Inheritance diagram for PaginationTest:
+ Collaboration diagram for PaginationTest:

Public Member Functions

 getUIFactory ()
 
 testConstruction ()
 
 testAttributes ()
 
 testViewControlPaginationRenderUnlimited ()
 
 testRenderWithCurrentPage ()
 
 testRenderLimited ()
 
 testRenderLimitedWithCurrentPage ()
 
 testRenderLimitedWithCurrentPage2 ()
 
 testRenderDropdown ()
 
 testGetRangeOnNull ()
 
 testRenderWithOnePageOnly ()
 

Private Member Functions

 getFactory ()
 

Detailed Description

Test on Pagination view control.

Definition at line 32 of file PaginationTest.php.

Member Function Documentation

◆ getFactory()

◆ getUIFactory()

PaginationTest::getUIFactory ( )

Definition at line 34 of file PaginationTest.php.

References ILIAS\Repository\button(), and ILIAS\Repository\symbol().

34  : NoUIFactory
35  {
36  return new class () extends NoUIFactory {
37  public function symbol(): IC\Symbol\Factory
38  {
39  return new IC\Symbol\Factory(
40  new IC\Symbol\Icon\Factory(),
41  new IC\Symbol\Glyph\Factory(),
42  new IC\Symbol\Avatar\Factory()
43  );
44  }
45  public function button(): IC\Button\Factory
46  {
47  return new IC\Button\Factory();
48  }
49  public function dropdown(): IC\Dropdown\Factory
50  {
51  return new IC\Dropdown\Factory();
52  }
53  };
54  }
button(string $caption, string $cmd)
+ Here is the call graph for this function:

◆ testAttributes()

PaginationTest::testAttributes ( )

Definition at line 70 of file PaginationTest.php.

References Vendor\Package\$f, and getFactory().

70  : void
71  {
72  $total_entries = 111;
73  $page_size = 100;
74  $current_page = 1;
75  //$select_signal;
76  $target_url = 'http://testurl';
77  $parameter_name = "param_name";
78  $max_page_options = 10;
79 
80  $f = $this->getFactory();
81  $p = $f->pagination()
82  ->withTargetURL($target_url, $parameter_name)
83  ->withTotalEntries($total_entries)
84  ->withPageSize($page_size)
85  ->withCurrentPage($current_page)
86  ->withMaxPaginationButtons($max_page_options)
87  ;
88 
89  $this->assertEquals($target_url, $p->getTargetURL());
90  $this->assertEquals($parameter_name, $p->getParameterName());
91  $this->assertEquals($page_size, $p->getPageSize());
92  $this->assertEquals($current_page, $p->getCurrentPage());
93  $this->assertEquals($max_page_options, $p->getMaxPaginationButtons());
94  $this->assertEquals(2, $p->getNumberOfPages());
95  }
+ Here is the call graph for this function:

◆ testConstruction()

PaginationTest::testConstruction ( )

Definition at line 62 of file PaginationTest.php.

References Vendor\Package\$f, and getFactory().

62  : void
63  {
64  $f = $this->getFactory();
65  $pagination = $f->pagination();
66  $this->assertInstanceOf("ILIAS\\UI\\Component\\ViewControl\\Pagination", $pagination);
67  $this->assertInstanceOf("ILIAS\\UI\\Component\\Signal", $pagination->getInternalSignal());
68  }
+ Here is the call graph for this function:

◆ testGetRangeOnNull()

PaginationTest::testGetRangeOnNull ( )

Definition at line 307 of file PaginationTest.php.

References ILIAS\UI\Implementation\Component\Table\$range, getFactory(), and null.

307  : void
308  {
309  $page_size = 0;
310  $current_page = 1;
311  $range = null;
312 
313  $pagination = $this->getFactory()->pagination()
314  ->withCurrentPage($current_page)
315  ->withPageSize($page_size);
316 
317  $this->assertNull($pagination->getRange());
318  $this->assertEquals($range, $pagination->getRange());
319  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ testRenderDropdown()

PaginationTest::testRenderDropdown ( )

Definition at line 272 of file PaginationTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and getFactory().

272  : void
273  {
274  $p = $this->getFactory()->pagination()
275  ->withTotalEntries(3)
276  ->withPageSize(1)
277  ->withDropdownAt(1);
278 
279  $expected_html = <<<EOT
280 <div class="il-viewcontrol-pagination l-bar__element">
281  <span class="btn btn-ctrl browse previous">
282  <a class="glyph disabled" aria-label="back" aria-disabled="true">
283  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
284  </a>
285  </span>
286 
287  <div class="dropdown" id="id_4">
288  <button class="btn btn-default dropdown-toggle" type="button" aria-haspopup="true" aria-expanded="false" aria-controls="id_4_menu" >pagination_label_x_of_y<span class="caret"></span></button>
289  <ul id="id_4_menu" class="dropdown-menu">
290  <li><button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=0" id="id_1">1</button></li>
291  <li><button class="btn btn-link" data-action="?pagination_offset=1" id="id_2">2</button></li>
292  <li><button class="btn btn-link" data-action="?pagination_offset=2" id="id_3">3</button></li>
293  </ul>
294  </div>
295 
296  <span class="btn btn-ctrl browse next">
297  <a tabindex="0" class="glyph" href="?pagination_offset=1" aria-label="next">
298  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
299  </a>
300  </span>
301 </div>
302 EOT;
303  $html = $this->getDefaultRenderer()->render($p);
304  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
305  }
button(string $caption, string $cmd)
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:32
+ Here is the call graph for this function:

◆ testRenderLimited()

PaginationTest::testRenderLimited ( )

Definition at line 160 of file PaginationTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and getFactory().

160  : void
161  {
162  $p = $this->getFactory()->pagination()
163  ->withTotalEntries(3)
164  ->withPageSize(1)
165  ->withMaxPaginationButtons(1);
166 
167  //one entry,
168  //browse-left disabled
169  //boundary-button right
170  $expected_html = <<<EOT
171 <div class="il-viewcontrol-pagination l-bar__element">
172  <span class="btn btn-ctrl browse previous">
173  <a class="glyph disabled" aria-label="back" aria-disabled="true">
174  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
175  </a>
176  </span>
177 
178  <button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=0" id="id_1">1</button>
179 
180  <span class="last">
181  <button class="btn btn-link" data-action="?pagination_offset=2" id="id_2">3</button>
182  </span>
183 
184  <span class="btn btn-ctrl browse next">
185  <a tabindex="0" class="glyph" href="?pagination_offset=1" aria-label="next">
186  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
187  </a>
188  </span>
189 </div>
190 EOT;
191  $html = $this->getDefaultRenderer()->render($p);
192  $this->assertHTMLEquals($expected_html, $html);
193  }
button(string $caption, string $cmd)
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:32
+ Here is the call graph for this function:

◆ testRenderLimitedWithCurrentPage()

PaginationTest::testRenderLimitedWithCurrentPage ( )

Definition at line 195 of file PaginationTest.php.

References ILIAS\Repository\button(), and getFactory().

195  : void
196  {
197  $p = $this->getFactory()->pagination()
198  ->withTotalEntries(3)
199  ->withPageSize(1)
200  ->withMaxPaginationButtons(1)
201  ->withCurrentPage(1);
202 
203  //one entry,
204  //both rockers enabled
205  //both boundary-buttons
206  $expected_html = <<<EOT
207 <div class="il-viewcontrol-pagination l-bar__element">
208  <span class="btn btn-ctrl browse previous">
209  <a tabindex="0" class="glyph" href="?pagination_offset=0" aria-label="back">
210  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
211  </a>
212  </span>
213 
214  <span class="first">
215  <button class="btn btn-link" data-action="?pagination_offset=0" id="id_2">1</button>
216  </span>
217 
218  <button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=1" id="id_1">2</button>
219 
220  <span class="last">
221  <button class="btn btn-link" data-action="?pagination_offset=2" id="id_3">3</button>
222  </span>
223 
224  <span class="btn btn-ctrl browse next">
225  <a tabindex="0" class="glyph" href="?pagination_offset=2" aria-label="next">
226  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
227  </a>
228  </span>
229 </div>
230 EOT;
231  $html = $this->getDefaultRenderer()->render($p);
232  $this->assertHTMLEquals($expected_html, $html);
233  }
button(string $caption, string $cmd)
+ Here is the call graph for this function:

◆ testRenderLimitedWithCurrentPage2()

PaginationTest::testRenderLimitedWithCurrentPage2 ( )

Definition at line 235 of file PaginationTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and getFactory().

235  : void
236  {
237  $p = $this->getFactory()->pagination()
238  ->withTotalEntries(3)
239  ->withPageSize(1)
240  ->withMaxPaginationButtons(1)
241  ->withCurrentPage(2);
242 
243  //one entry,
244  //browse-right disabled
245  //boundary-button left only
246  $expected_html = <<<EOT
247 <div class="il-viewcontrol-pagination l-bar__element">
248  <span class="btn btn-ctrl browse previous">
249  <a tabindex="0" class="glyph" href="?pagination_offset=1" aria-label="back">
250  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
251  </a>
252  </span>
253  <span class="first">
254  <button class="btn btn-link" data-action="?pagination_offset=0" id="id_2">1</button>
255  </span>
256 
257  <button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=2" id="id_1">3</button>
258 
259  <span class="btn btn-ctrl browse next">
260  <a class="glyph disabled" aria-label="next" aria-disabled="true">
261  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
262  </a>
263  </span>
264 </div>
265 EOT;
266  $html = $this->getDefaultRenderer()->render($p);
267  $this->assertHTMLEquals($expected_html, $html);
268  }
button(string $caption, string $cmd)
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:32
+ Here is the call graph for this function:

◆ testRenderWithCurrentPage()

PaginationTest::testRenderWithCurrentPage ( )

Definition at line 128 of file PaginationTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and getFactory().

128  : void
129  {
130  $p = $this->getFactory()->pagination()
131  ->withTotalEntries(2)
132  ->withPageSize(1)
133  ->withCurrentPage(1);
134 
135  //two entries, second one inactive
136  //browse-right disabled
137  $expected_html = <<<EOT
138 <div class="il-viewcontrol-pagination l-bar__element">
139  <span class="btn btn-ctrl browse previous">
140  <a tabindex="0" class="glyph" href="?pagination_offset=0" aria-label="back">
141  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
142  </a>
143  </span>
144 
145  <button class="btn btn-link" data-action="?pagination_offset=0" id="id_1">1</button>
146  <button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=1" id="id_2">2</button>
147 
148  <span class="btn btn-ctrl browse next">
149  <a class="glyph disabled" aria-label="next" aria-disabled="true">
150  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
151  </a>
152  </span>
153 </div>
154 EOT;
155 
156  $html = $this->getDefaultRenderer()->render($p);
157  $this->assertHTMLEquals($expected_html, $html);
158  }
button(string $caption, string $cmd)
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:32
+ Here is the call graph for this function:

◆ testRenderWithOnePageOnly()

PaginationTest::testRenderWithOnePageOnly ( )

Definition at line 321 of file PaginationTest.php.

References getFactory().

321  : void
322  {
323  $p = $this->getFactory()->pagination()
324  ->withTotalEntries(30)
325  ->withPageSize(30);
326  $expected_html = '';
327  $html = $this->getDefaultRenderer()->render($p);
328  $this->assertEquals($expected_html, $html);
329  }
+ Here is the call graph for this function:

◆ testViewControlPaginationRenderUnlimited()

PaginationTest::testViewControlPaginationRenderUnlimited ( )

Definition at line 97 of file PaginationTest.php.

References ILIAS\Repository\button(), ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and getFactory().

97  : void
98  {
99  $p = $this->getFactory()->pagination()
100  ->withTotalEntries(2)
101  ->withPageSize(1);
102 
103  //two entries, first one inactive
104  //browse-left disabled
105  $expected_html = <<<EOT
106 <div class="il-viewcontrol-pagination l-bar__element">
107  <span class="btn btn-ctrl browse previous">
108  <a class="glyph disabled" aria-label="back" aria-disabled="true">
109  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
110  </a>
111  </span>
112 
113  <button class="btn btn-link engaged" aria-pressed="true" data-action="?pagination_offset=0" id="id_1">1</button>
114  <button class="btn btn-link" data-action="?pagination_offset=1" id="id_2">2</button>
115 
116  <span class="btn btn-ctrl browse next">
117  <a tabindex="0" class="glyph" href="?pagination_offset=1" aria-label="next">
118  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
119  </a>
120  </span>
121 </div>
122 EOT;
123 
124  $html = $this->getDefaultRenderer()->render($p);
125  $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
126  }
button(string $caption, string $cmd)
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:32
+ Here is the call graph for this function:

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