ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ItemGroupTest Class Reference

Test items groups. More...

+ Inheritance diagram for ItemGroupTest:
+ Collaboration diagram for ItemGroupTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title ()
 
 test_get_items ()
 
 test_with_actions ()
 
 test_render_base ()
 
 test_render_with_actions ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Test items groups.

Definition at line 14 of file ItemGroupTest.php.

Member Function Documentation

◆ getFactory()

ItemGroupTest::getFactory ( )
Returns

Definition at line 20 of file ItemGroupTest.php.

Referenced by test_get_items(), test_get_title(), test_implements_factory_interface(), test_render_base(), test_render_with_actions(), and test_with_actions().

21  {
22  return new I\Component\Item\Factory;
23  }
+ Here is the caller graph for this function:

◆ test_get_items()

ItemGroupTest::test_get_items ( )

Definition at line 48 of file ItemGroupTest.php.

References $c, $f, and getFactory().

49  {
50  $f = $this->getFactory();
51 
52  $items = array(
53  $f->standard("title1"),
54  $f->standard("title2")
55  );
56 
57  $c = $f->group("group", $items);
58 
59  $this->assertEquals($c->getItems(), $items);
60  }
+ Here is the call graph for this function:

◆ test_get_title()

ItemGroupTest::test_get_title ( )

Definition at line 37 of file ItemGroupTest.php.

References $c, $f, and getFactory().

38  {
39  $f = $this->getFactory();
40  $c = $f->group("group", array(
41  $f->standard("title1"),
42  $f->standard("title2")
43  ));
44 
45  $this->assertEquals($c->getTitle(), "group");
46  }
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemGroupTest::test_implements_factory_interface ( )

Definition at line 25 of file ItemGroupTest.php.

References $f, and getFactory().

26  {
27  $f = $this->getFactory();
28 
29  $group = $f->group("group", array(
30  $f->standard("title1"),
31  $f->standard("title2")
32  ));
33 
34  $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Group", $group);
35  }
+ Here is the call graph for this function:

◆ test_render_base()

ItemGroupTest::test_render_base ( )

Definition at line 80 of file ItemGroupTest.php.

References $c, $f, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

81  {
82  $f = $this->getFactory();
83  $r = $this->getDefaultRenderer();
84 
85  $items = array(
86  $f->standard("title1"),
87  $f->standard("title2")
88  );
89 
90  $c = $f->group("group", $items);
91 
92  $html = $r->render($c);
93 
94  $expected = <<<EOT
95 <div class="il-item-group">
96  <h4>group</h4>
97  <div class="il-item-group-items">
98  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
99  <h5>title1</h5>
100  </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
101  <h5>title2</h5>
102  </div></div>
103  </div>
104 </div>
105 EOT;
106  $this->assertHTMLEquals($expected, $html);
107  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_actions()

ItemGroupTest::test_render_with_actions ( )

Definition at line 109 of file ItemGroupTest.php.

References $c, $f, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

110  {
111  $f = $this->getFactory();
112  $r = $this->getDefaultRenderer();
113 
114  $actions = new I\Component\Dropdown\Standard(array(
115  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
116  new I\Component\Button\Shy("GitHub", "https://www.github.com")
117  ));
118  $items = array(
119  $f->standard("title1"),
120  $f->standard("title2")
121  );
122 
123  $c = $f->group("group", $items)->withActions($actions);
124 
125  $html = $r->render($c);
126 
127  $expected = <<<EOT
128 <div class="il-item-group">
129 <h4>group</h4><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
130  <ul class="dropdown-menu">
131  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
132  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
133  </ul>
134  </div>
135  <div class="il-item-group-items">
136  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
137  <h5>title1</h5>
138  </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
139  <h5>title2</h5>
140  </div></div>
141  </div>
142 </div>
143 EOT;
144  $this->assertHTMLEquals($expected, $html);
145  }
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_actions()

ItemGroupTest::test_with_actions ( )

Definition at line 62 of file ItemGroupTest.php.

References $c, $f, and getFactory().

63  {
64  $f = $this->getFactory();
65 
66  $actions = new I\Component\Dropdown\Standard(array(
67  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
68  new I\Component\Button\Shy("GitHub", "https://www.github.com")
69  ));
70  $items = array(
71  $f->standard("title1"),
72  $f->standard("title2")
73  );
74 
75  $c = $f->group("group", $items)->withActions($actions);
76 
77  $this->assertEquals($c->getActions(), $actions);
78  }
+ Here is the call graph for this function:

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