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

Test listing panels. More...

+ Inheritance diagram for PanelListingTest:
+ Collaboration diagram for PanelListingTest:

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetTitleGetGroups ()
 
 testWithActions ()
 
 testRenderBase ()
 
 testRenderWithActions ()
 

Detailed Description

Test listing panels.

Definition at line 30 of file PanelListingTest.php.

Member Function Documentation

◆ getFactory()

PanelListingTest::getFactory ( )

Definition at line 32 of file PanelListingTest.php.

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

Referenced by testGetTitleGetGroups(), testImplementsFactoryInterface(), testRenderBase(), testRenderWithActions(), and testWithActions().

+ Here is the caller graph for this function:

◆ testGetTitleGetGroups()

PanelListingTest::testGetTitleGetGroups ( )

Definition at line 54 of file PanelListingTest.php.

54 : void
55 {
56 $f = $this->getFactory();
57
58 $groups = array(
59 new I\Component\Item\Group("Subtitle 1", array(
60 new I\Component\Item\Standard("title1"),
61 new I\Component\Item\Standard("title2")
62 )),
63 new I\Component\Item\Group("Subtitle 2", array(
64 new I\Component\Item\Standard("title3")
65 ))
66 );
67
68 $c = $f->standard("title", $groups);
69
70 $this->assertEquals("title", $c->getTitle());
71 $this->assertEquals($groups, $c->getItemGroups());
72 }
$c
Definition: deliver.php:25

References $c, Vendor\Package\$f, getFactory(), and ILIAS\ILIASObject\Creation\Group.

+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

PanelListingTest::testImplementsFactoryInterface ( )

Definition at line 37 of file PanelListingTest.php.

37 : void
38 {
39 $f = $this->getFactory();
40
41 $std_list = $f->standard("List Title", array(
42 new I\Component\Item\Group("Subtitle 1", array(
43 new I\Component\Item\Standard("title1"),
44 new I\Component\Item\Standard("title2")
45 )),
46 new I\Component\Item\Group("Subtitle 2", array(
47 new I\Component\Item\Standard("title3")
48 ))
49 ));
50
51 $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Listing\\Standard", $std_list);
52 }

References Vendor\Package\$f, getFactory(), and ILIAS\ILIASObject\Creation\Group.

+ Here is the call graph for this function:

◆ testRenderBase()

PanelListingTest::testRenderBase ( )

Definition at line 91 of file PanelListingTest.php.

91 : void
92 {
93 $f = $this->getFactory();
94 $r = $this->getDefaultRenderer();
95
96 $groups = array(
97 new I\Component\Item\Group("Subtitle 1", array(
98 new I\Component\Item\Standard("title1"),
99 new I\Component\Item\Standard("title2")
100 )),
101 new I\Component\Item\Group("Subtitle 2", array(
102 new I\Component\Item\Standard("title3")
103 ))
104 );
105
106 $c = $f->standard("title", $groups);
107
108 $html = $r->render($c);
109
110 $expected = <<<EOT
111<div class="panel panel-flex il-panel-listing-std-container clearfix">
112<div class="panel-heading ilHeader">
113<div class="panel-title"><h2>title</h2></div><div class="panel-controls"></div></div>
114<div class="il-item-group">
115<h3>Subtitle 1</h3>
116<div class="il-item-group-items">
117 <ul>
118 <li class="il-std-item-container">
119 <div class="il-item il-std-item ">
120 <h4 class="il-item-title">title1</h4>
121 </div>
122 </li>
123 <li class="il-std-item-container">
124 <div class="il-item il-std-item ">
125 <h4 class="il-item-title">title2</h4>
126 </div>
127 </li>
128 </ul>
129</div>
130</div>
131<div class="il-item-group">
132<h3>Subtitle 2</h3>
133<div class="il-item-group-items">
134 <ul>
135 <li class="il-std-item-container">
136 <div class="il-item il-std-item ">
137 <h4 class="il-item-title">title3</h4>
138 </div>
139 </li>
140 </ul>
141</div>
142</div>
143</div>
144EOT;
145 $this->assertHTMLEquals(
146 $this->brutallyTrimHTML($expected),
147 $this->brutallyTrimHTML($html)
148 );
149 }

References $c, Vendor\Package\$f, getFactory(), and ILIAS\ILIASObject\Creation\Group.

+ Here is the call graph for this function:

◆ testRenderWithActions()

PanelListingTest::testRenderWithActions ( )

Definition at line 151 of file PanelListingTest.php.

151 : void
152 {
153 $f = $this->getFactory();
154 $r = $this->getDefaultRenderer();
155
156 $groups = array();
157
158 $actions = new I\Component\Dropdown\Standard(array(
159 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
160 new I\Component\Button\Shy("GitHub", "https://www.github.com")
161 ));
162
163 $c = $f->standard("title", $groups)
164 ->withActions($actions);
165
166 $html = $r->render($c);
167
168 $expected = <<<EOT
169<div class="panel panel-flex il-panel-listing-std-container clearfix">
170<div class="panel-heading ilHeader">
171<div class="panel-title"><h2>title</h2></div><div class="panel-controls"><div class="dropdown" id="id_3"><button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_3_menu"> <span class="caret"></span></button>
172<ul id="id_3_menu" class="dropdown-menu">
173 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
174 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
175</ul>
176</div>
177</div>
178</div>
179</div>
180EOT;
181 $this->assertHTMLEquals($expected, $html);
182 }
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()

PanelListingTest::testWithActions ( )

Definition at line 74 of file PanelListingTest.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
83 $groups = array();
84
85 $c = $f->standard("title", $groups)
86 ->withActions($actions);
87
88 $this->assertEquals($actions, $c->getActions());
89 }

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: