ILIAS  release_8 Revision v8.24
ItemGroupTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 ()
 
 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 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Test items groups

Definition at line 30 of file ItemGroupTest.php.

Member Function Documentation

◆ getFactory()

ItemGroupTest::getFactory ( )

Definition at line 32 of file ItemGroupTest.php.

32 : C\Item\Factory
33 {
34 return new I\Component\Item\Factory();
35 }

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

+ Here is the caller graph for this function:

◆ test_get_items()

ItemGroupTest::test_get_items ( )

Definition at line 60 of file ItemGroupTest.php.

60 : void
61 {
62 $f = $this->getFactory();
63
64 $items = array(
65 $f->standard("title1"),
66 $f->standard("title2")
67 );
68
69 $c = $f->group("group", $items);
70
71 $this->assertEquals($c->getItems(), $items);
72 }
$c
Definition: cli.php:38

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

+ Here is the call graph for this function:

◆ test_get_title()

ItemGroupTest::test_get_title ( )

Definition at line 49 of file ItemGroupTest.php.

49 : void
50 {
51 $f = $this->getFactory();
52 $c = $f->group("group", array(
53 $f->standard("title1"),
54 $f->standard("title2")
55 ));
56
57 $this->assertEquals("group", $c->getTitle());
58 }

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

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ItemGroupTest::test_implements_factory_interface ( )

Definition at line 37 of file ItemGroupTest.php.

37 : void
38 {
39 $f = $this->getFactory();
40
41 $group = $f->group("group", array(
42 $f->standard("title1"),
43 $f->standard("title2")
44 ));
45
46 $this->assertInstanceOf("ILIAS\\UI\\Component\\Item\\Group", $group);
47 }

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

+ Here is the call graph for this function:

◆ test_render_base()

ItemGroupTest::test_render_base ( )

Definition at line 92 of file ItemGroupTest.php.

92 : void
93 {
94 $f = $this->getFactory();
95 $r = $this->getDefaultRenderer();
96
97 $items = array(
98 $f->standard("title1"),
99 $f->standard("title2")
100 );
101
102 $c = $f->group("group", $items);
103
104 $html = $r->render($c);
105
106 $expected = <<<EOT
107<div class="il-item-group">
108 <h3>group</h3>
109 <div class="il-item-group-items">
110
111 <ul>
112 <li class="il-std-item-container">
113 <div class="il-item il-std-item ">
114 <div class="il-item-title">title1</div>
115 </div>
116 </li>
117 <li class="il-std-item-container">
118 <div class="il-item il-std-item ">
119 <div class="il-item-title">title2</div>
120 </div>
121 </li>
122 </ul>
123 </div>
124</div>
125EOT;
126 $this->assertHTMLEquals(
127 $this->brutallyTrimHTML($expected),
128 $this->brutallyTrimHTML($html)
129 );
130 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_with_actions()

ItemGroupTest::test_render_with_actions ( )

Definition at line 132 of file ItemGroupTest.php.

132 : void
133 {
134 $f = $this->getFactory();
135 $r = $this->getDefaultRenderer();
136
137 $actions = new I\Component\Dropdown\Standard(array(
138 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
139 new I\Component\Button\Shy("GitHub", "https://www.github.com")
140 ));
141 $items = array(
142 $f->standard("title1"),
143 $f->standard("title2")
144 );
145
146 $c = $f->group("group", $items)->withActions($actions);
147
148 $html = $r->render($c);
149
150 $expected = <<<EOT
151<div class="il-item-group">
152 <h3>group</h3>
153 <div class="dropdown">
154 <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="id_3" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu">
155 <span class="caret"></span>
156 </button>
157 <ul id="id_3_menu" class="dropdown-menu">
158 <li>
159 <button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button>
160 </li>
161 <li>
162 <button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button>
163 </li>
164 </ul>
165 </div>
166 <div class="il-item-group-items">
167 <ul>
168 <li class="il-std-item-container">
169 <div class="il-item il-std-item ">
170 <div class="il-item-title">title1</div>
171 </div>
172 </li>
173 <li class="il-std-item-container">
174 <div class="il-item il-std-item ">
175 <div class="il-item-title">title2</div>
176 </div>
177 </li>
178 </ul>
179 </div>
180</div>
181EOT;
182 $this->assertHTMLEquals(
183 $this->brutallyTrimHTML($expected),
184 $this->brutallyTrimHTML($html)
185 );
186 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.

References $c, Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_with_actions()

ItemGroupTest::test_with_actions ( )

Definition at line 74 of file ItemGroupTest.php.

74 : void
75 {
76 $f = $this->getFactory();
77
78 $actions = new I\Component\Dropdown\Standard(array(
79 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
80 new I\Component\Button\Shy("GitHub", "https://www.github.com")
81 ));
82 $items = array(
83 $f->standard("title1"),
84 $f->standard("title2")
85 );
86
87 $c = $f->group("group", $items)->withActions($actions);
88
89 $this->assertEquals($c->getActions(), $actions);
90 }

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

+ Here is the call graph for this function:

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