ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ButtonMonthTest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4 
5 require_once(__DIR__ . "/../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ . "/../../Base.php");
7 
8 use \ILIAS\UI\Component as C;
9 use \ILIAS\UI\Implementation as I;
10 
15 {
16 
20  public function getFactory()
21  {
22  return $this->button_factory = new I\Component\Button\Factory();
23  }
24 
26  {
27  $f = $this->getFactory();
28 
29  $this->assertInstanceOf("ILIAS\\UI\\Component\\Button\\Month", $f->month("02-2017"));
30  }
31 
32  public function test_get_default()
33  {
34  $f = $this->getFactory();
35  $c = $f->month("02-2017");
36 
37  $this->assertEquals($c->getDefault(), "02-2017");
38  }
39 
40  public function test_render()
41  {
42  $f = $this->getFactory();
43  $r = $this->getDefaultRenderer();
44 
45  $c = $f->month("02-2017");
46 
47  $html = $r->render($c);
48 
49  $expected_html = <<<EOT
50  <div class="btn-group il-btn-month">
51  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
52  <span class="il-current-month">month_02_short 2017</span>
53  <span class="caret"></span>
54  </button>
55  <div class="dropdown-menu" data-default-date="02/1/2017" data-lang="en">
56  <div class="inline-picker"></div>
57  </div>
58 </div>
59 <script>il.Util.addOnLoad(function() {il.UI.button.initMonth('');});</script>
60 EOT;
61  $this->assertHTMLEquals("<div>" . $expected_html . "</div>", "<div>" . $html . "</div>");
62  }
63 }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
Test month button.
$r
Definition: example_031.php:79
Provides common functionality for UI tests.
Definition: Base.php:191
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87