ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 14 of file PanelListingTest.php.

Member Function Documentation

◆ getFactory()

PanelListingTest::getFactory ( )
Returns

Definition at line 20 of file PanelListingTest.php.

Referenced by test_get_title_get_groups(), test_implements_factory_interface(), test_render_base(), test_render_with_actions(), and test_with_actions().

21  {
22  return new I\Component\Panel\Listing\Factory();
23  }
+ 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.

References $c, $f, and getFactory().

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  }
+ 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.

References $f, and getFactory().

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  }
+ Here is the call graph for this function:

◆ test_render_base()

PanelListingTest::test_render_base ( )

Definition at line 79 of file PanelListingTest.php.

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

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="il-panel-listing-std-container clearfix">
100  <h3>title</h3>
101  <div class="il-item-group">
102  <h4>Subtitle 1</h4>
103  <div class="il-item-group-items">
104  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
105  <h5>title1</h5>
106  </div></div><div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
107  <h5>title2</h5>
108  </div></div>
109  </div>
110  </div><div class="il-item-group">
111  <h4>Subtitle 2</h4>
112  <div class="il-item-group-items">
113  <div class="il-panel-listing-std-item-container"><div class="il-item il-std-item ">
114  <h5>title3</h5>
115  </div></div>
116  </div>
117 </div>
118 </div>
119 EOT;
120  $this->assertHTMLEquals($expected, $html);
121  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_actions()

PanelListingTest::test_render_with_actions ( )

Definition at line 123 of file PanelListingTest.php.

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

124  {
125  $f = $this->getFactory();
126  $r = $this->getDefaultRenderer();
127 
128  $groups = array();
129 
130  $actions = new I\Component\Dropdown\Standard(array(
131  new I\Component\Button\Shy("ILIAS", "https://www.ilias.de"),
132  new I\Component\Button\Shy("GitHub", "https://www.github.com")
133  ));
134 
135  $c = $f->standard("title", $groups)
136  ->withActions($actions);
137 
138  $html = $r->render($c);
139 
140  $expected = <<<EOT
141 <div class="il-panel-listing-std-container clearfix">
142 <h3>title</h3><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>
143 <ul class="dropdown-menu">
144  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1">ILIAS</button></li>
145  <li><button class="btn btn-link" data-action="https://www.github.com" id="id_2">GitHub</button></li>
146 </ul>
147 </div>
148 </div>
149 EOT;
150  $this->assertHTMLEquals($expected, $html);
151  }
Class BaseForm.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_actions()

PanelListingTest::test_with_actions ( )

Definition at line 62 of file PanelListingTest.php.

References $c, $f, and getFactory().

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  }
+ Here is the call graph for this function:

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