ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Test listing panels.

Definition at line 14 of file PanelListingTest.php.

Member Function Documentation

◆ getFactory()

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

Definition at line 20 of file PanelListingTest.php.

21 {
22 return new I\Component\Panel\Listing\Factory();
23 }

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 42 of file PanelListingTest.php.

43 {
44 $f = $this->getFactory();
45
46 $groups = array(
47 new I\Component\Item\Group("Subtitle 1", array(
48 new I\Component\Item\Standard("title1"),
49 new I\Component\Item\Standard("title2")
50 )),
51 new I\Component\Item\Group("Subtitle 2", array(
52 new I\Component\Item\Standard("title3")
53 ))
54 );
55
56 $c = $f->standard("title", $groups);
57
58 $this->assertEquals($c->getTitle(), "title");
59 $this->assertEquals($c->getItemGroups(), $groups);
60 }

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

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

PanelListingTest::test_implements_factory_interface ( )

Definition at line 25 of file PanelListingTest.php.

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

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

+ Here is the call graph for this function:

◆ test_render_base()

PanelListingTest::test_render_base ( )

Definition at line 79 of file PanelListingTest.php.

80 {
81 $f = $this->getFactory();
82 $r = $this->getDefaultRenderer();
83
84 $groups = array(
85 new I\Component\Item\Group("Subtitle 1", array(
86 new I\Component\Item\Standard("title1"),
87 new I\Component\Item\Standard("title2")
88 )),
89 new I\Component\Item\Group("Subtitle 2", array(
90 new I\Component\Item\Standard("title3")
91 ))
92 );
93
94 $c = $f->standard("title", $groups);
95
96 $html = $r->render($c);
97
98 $expected = <<<EOT
99<div class="panel il-panel-listing-std-container clearfix">
100 <h2>title</h2>
101 <div class="il-item-group">
102 <h3>Subtitle 1</h3>
103 <div class="il-item-group-items">
104 <div class="il-std-item-container"><div class="il-item il-std-item ">
105 <div class="il-item-title">title1</div>
106 </div></div><div class="il-std-item-container"><div class="il-item il-std-item ">
107 <div class="il-item-title">title2</div>
108 </div></div>
109 </div>
110 </div><div class="il-item-group">
111 <h3>Subtitle 2</h3>
112 <div class="il-item-group-items">
113 <div class="il-std-item-container"><div class="il-item il-std-item ">
114 <div class="il-item-title">title3</div>
115 </div></div>
116 </div>
117</div>
118</div>
119EOT;
120 $this->assertHTMLEquals(
121 $this->brutallyTrimHTML($expected),
122 $this->brutallyTrimHTML($html)
123 );
124 }
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:326
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:268
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:346

References Vendor\Package\$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()

PanelListingTest::test_render_with_actions ( )

Definition at line 126 of file PanelListingTest.php.

127 {
128 $f = $this->getFactory();
129 $r = $this->getDefaultRenderer();
130
131 $groups = array();
132
133 $actions = new I\Component\Dropdown\Standard(array(
134 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
135 new I\Component\Button\Shy("GitHub", "https://www.github.com")
136 ));
137
138 $c = $f->standard("title", $groups)
139 ->withActions($actions);
140
141 $html = $r->render($c);
142
143 $expected = <<<EOT
144<div class="panel il-panel-listing-std-container clearfix">
145<h2>title</h2><div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false"> <span class="caret"></span></button>
146<ul class="dropdown-menu">
147 <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
148 <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
149</ul>
150</div>
151</div>
152EOT;
153 $this->assertHTMLEquals($expected, $html);
154 }
Class ChatMainBarProvider \MainMenu\Provider.

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

+ Here is the call graph for this function:

◆ test_with_actions()

PanelListingTest::test_with_actions ( )

Definition at line 62 of file PanelListingTest.php.

63 {
64 $f = $this->getFactory();
65
66 $actions = new I\Component\Dropdown\Standard(array(
67 new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
68 new I\Component\Button\Shy("GitHub", "https://www.github.com")
69 ));
70
71 $groups = array();
72
73 $c = $f->standard("title", $groups)
74 ->withActions($actions);
75
76 $this->assertEquals($c->getActions(), $actions);
77 }

References Vendor\Package\$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: