ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 13 of file ItemGroupTest.php.

Member Function Documentation

◆ getFactory()

ItemGroupTest::getFactory ( )
Returns

Definition at line 19 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().

20  {
21  return new \ILIAS\UI\Implementation\Factory();
22  }
+ Here is the caller graph for this function:

◆ test_get_items()

ItemGroupTest::test_get_items ( )

Definition at line 47 of file ItemGroupTest.php.

References array, and getFactory().

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

◆ test_get_title()

ItemGroupTest::test_get_title ( )

Definition at line 36 of file ItemGroupTest.php.

References array, and getFactory().

37  {
38  $f = $this->getFactory();
39  $c = $f->item()->group("group", array(
40  $f->item()->standard("title1"),
41  $f->item()->standard("title2")
42  ));
43 
44  $this->assertEquals($c->getTitle(), "group");
45  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemGroupTest::test_implements_factory_interface ( )

Definition at line 24 of file ItemGroupTest.php.

References array, and getFactory().

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

◆ test_render_base()

ItemGroupTest::test_render_base ( )

Definition at line 79 of file ItemGroupTest.php.

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

80  {
81  $f = $this->getFactory();
82  $r = $this->getDefaultRenderer();
83 
84  $items = array(
85  $f->item()->standard("title1"),
86  $f->item()->standard("title2")
87  );
88 
89  $c = $f->item()->group("group", $items);
90 
91  $html = $r->render($c);
92 
93  $expected = <<<EOT
94 <div class="il-item-group">
95  <h4>group</h4>
96  <div class="il-item-group-items">
97  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
98  <h5>title1</h5>
99  </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
100  <h5>title2</h5>
101  </div></div>
102  </div>
103 </div>
104 EOT;
105  $this->assertHTMLEquals($expected, $html);
106  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$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 108 of file ItemGroupTest.php.

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

109  {
110  $f = $this->getFactory();
111  $r = $this->getDefaultRenderer();
112 
113  $actions = $f->dropdown()->standard(array(
114  $f->button()->shy("ILIAS", "https://www.ilias.de"),
115  $f->button()->shy("GitHub", "https://www.github.com")
116  ));
117  $items = array(
118  $f->item()->standard("title1"),
119  $f->item()->standard("title2")
120  );
121 
122  $c = $f->item()->group("group", $items)->withActions($actions);
123 
124  $html = $r->render($c);
125 
126  $expected = <<<EOT
127 <div class="il-item-group">
128 <h4>group</h4><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
129  <ul class="dropdown-menu">
130  <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
131  <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
132  </ul>
133  </div>
134  <div class="il-item-group-items">
135  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
136  <h5>title1</h5>
137  </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
138  <h5>title2</h5>
139  </div></div>
140  </div>
141 </div>
142 EOT;
143  $this->assertHTMLEquals($expected, $html);
144  }
Add some data
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
Create styles array
The data for the language used.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_actions()

ItemGroupTest::test_with_actions ( )

Definition at line 61 of file ItemGroupTest.php.

References array, and getFactory().

62  {
63  $f = $this->getFactory();
64 
65  $actions = $f->dropdown()->standard(array(
66  $f->button()->shy("ILIAS", "https://www.ilias.de"),
67  $f->button()->shy("GitHub", "https://www.github.com")
68  ));
69  $items = array(
70  $f->item()->standard("title1"),
71  $f->item()->standard("title2")
72  );
73 
74  $c = $f->item()->group("group", $items)->withActions($actions);
75 
76  $this->assertEquals($c->getActions(), $actions);
77  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

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