ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ItemGroupTest Class Reference

Test items groups. More...

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

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitle ()
 
 testGetItems ()
 
 testWithActions ()
 
 testRenderBase ()
 
 testRenderWithActions ()
 

Detailed Description

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 testGetItems(), testGetTitle(), testImplementsFactoryInterface(), testRenderBase(), testRenderWithActions(), and testWithActions().

+ Here is the caller graph for this function:

◆ testGetItems()

ItemGroupTest::testGetItems ( )

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: deliver.php:25

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

+ Here is the call graph for this function:

◆ testGetTitle()

ItemGroupTest::testGetTitle ( )

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:

◆ testImplementsFactoryInterface()

ItemGroupTest::testImplementsFactoryInterface ( )

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:

◆ testRenderBase()

ItemGroupTest::testRenderBase ( )

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 <h4 class="il-item-title">title1</h4>
115 </div>
116 </li>
117 <li class="il-std-item-container">
118 <div class="il-item il-std-item ">
119 <h4 class="il-item-title">title2</h4>
120 </div>
121 </li>
122 </ul>
123 </div>
124</div>
125EOT;
126 $this->assertHTMLEquals(
127 $this->brutallyTrimHTML($expected),
128 $this->brutallyTrimHTML($html)
129 );
130 }

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

+ Here is the call graph for this function:

◆ testRenderWithActions()

ItemGroupTest::testRenderWithActions ( )

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" id="id_3">
154 <button class="btn btn-default dropdown-toggle" type="button" 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 <h4 class="il-item-title">title1</h4>
171 </div>
172 </li>
173 <li class="il-std-item-container">
174 <div class="il-item il-std-item ">
175 <h4 class="il-item-title">title2</h4>
176 </div>
177 </li>
178 </ul>
179 </div>
180</div>
181EOT;
182 $this->assertHTMLEquals(
183 $this->brutallyTrimHTML($expected),
184 $this->brutallyTrimHTML($html)
185 );
186 }
button(string $caption, string $cmd)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

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

+ Here is the call graph for this function:

◆ testWithActions()

ItemGroupTest::testWithActions ( )

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: