ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PanelListingTest Class Reference

Test listing panels. More...

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

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_get_title_get_groups ()
 
 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 listing panels.

Definition at line 13 of file PanelListingTest.php.

Member Function Documentation

◆ getFactory()

PanelListingTest::getFactory ( )
Returns
\ILIAS\UI\Implementation\Factory

Definition at line 19 of file PanelListingTest.php.

20 {
21 return new \ILIAS\UI\Implementation\Factory();
22 }

Referenced by test_get_title_get_groups(), 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_title_get_groups()

PanelListingTest::test_get_title_get_groups ( )

Definition at line 41 of file PanelListingTest.php.

42 {
43 $f = $this->getFactory();
44
45 $groups = array(
46 $f->item()->group("Subtitle 1", array(
47 $f->item()->standard("title1"),
48 $f->item()->standard("title2")
49 )),
50 $f->item()->group("Subtitle 2", array(
51 $f->item()->standard("title3")
52 ))
53 );
54
55 $c = $f->panel()->listing()->standard("title", $groups);
56
57 $this->assertEquals($c->getTitle(), "title");
58 $this->assertEquals($c->getItemGroups(), $groups);
59 }

References getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PanelListingTest::test_implements_factory_interface ( )

Definition at line 24 of file PanelListingTest.php.

25 {
26 $f = $this->getFactory();
27
28 $std_list = $f->panel()->listing()->standard("List Title", array(
29 $f->item()->group("Subtitle 1", array(
30 $f->item()->standard("title1"),
31 $f->item()->standard("title2")
32 )),
33 $f->item()->group("Subtitle 2", array(
34 $f->item()->standard("title3")
35 ))
36 ));
37
38 $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Listing\\Standard", $std_list);
39 }

References getFactory().

+ Here is the call graph for this function:

◆ test_render_base()

PanelListingTest::test_render_base ( )

Definition at line 78 of file PanelListingTest.php.

79 {
80 $f = $this->getFactory();
81 $r = $this->getDefaultRenderer();
82
83 $groups = array(
84 $f->item()->group("Subtitle 1", array(
85 $f->item()->standard("title1"),
86 $f->item()->standard("title2")
87 )),
88 $f->item()->group("Subtitle 2", array(
89 $f->item()->standard("title3")
90 ))
91 );
92
93 $c = $f->panel()->listing()->standard("title", $groups);
94
95 $html = $r->render($c);
96
97 $expected = <<<EOT
98<div class="il-panel-listing-std-container clearfix">
99 <h3>title</h3>
100 <div class="il-item-group">
101 <h4>Subtitle 1</h4>
102 <div class="il-item-group-items">
103 <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
104 <h5>title1</h5>
105 </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
106 <h5>title2</h5>
107 </div></div>
108 </div>
109 </div><div class="il-item-group">
110 <h4>Subtitle 2</h4>
111 <div class="il-item-group-items">
112 <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
113 <h5>title3</h5>
114 </div></div>
115 </div>
116</div>
117</div>
118EOT;
119 $this->assertHTMLEquals($expected, $html);
120 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:252
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

◆ test_render_with_actions()

PanelListingTest::test_render_with_actions ( )

Definition at line 122 of file PanelListingTest.php.

123 {
124 $f = $this->getFactory();
125 $r = $this->getDefaultRenderer();
126
127 $groups = array();
128
129 $actions = $f->dropdown()->standard(array(
130 $f->button()->shy("ILIAS", "https://www.ilias.de"),
131 $f->button()->shy("GitHub", "https://www.github.com")
132 ));
133
134 $c = $f->panel()->listing()->standard("title", $groups)
135 ->withActions($actions);
136
137 $html = $r->render($c);
138
139 $expected = <<<EOT
140<div class="il-panel-listing-std-container clearfix">
141<h3>title</h3><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>
142<ul class="dropdown-menu">
143 <li><a class="btn btn-link" href="https://www.ilias.de" data-action="https://www.ilias.de">ILIAS</a></li>
144 <li><a class="btn btn-link" href="https://www.github.com" data-action="https://www.github.com">GitHub</a></li>
145</ul>
146</div>
147</div>
148EOT;
149 $this->assertHTMLEquals($expected, $html);
150 }
Class BaseForm.
$this data['403_header']

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

+ Here is the call graph for this function:

◆ test_with_actions()

PanelListingTest::test_with_actions ( )

Definition at line 61 of file PanelListingTest.php.

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
70 $groups = array();
71
72 $c = $f->panel()->listing()->standard("title", $groups)
73 ->withActions($actions);
74
75 $this->assertEquals($c->getActions(), $actions);
76 }

References getFactory().

+ Here is the call graph for this function:

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