ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PanelTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for PanelTest:
+ Collaboration diagram for PanelTest:

Public Member Functions

 getPanelFactory ()
 
 getFactory ()
 
 test_implements_factory_interface ()
 
 test_standard_get_title ()
 
 test_standard_get_content ()
 
 test_sub_with_card ()
 
 test_report_get_title ()
 
 test_report_get_content ()
 
 test_render_standard ()
 
 test_render_sub ()
 
 test_render_report ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer ()
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Detailed Description

Test on button implementation.

Definition at line 19 of file PanelTest.php.

Member Function Documentation

◆ getFactory()

PanelTest::getFactory ( )
Returns

Definition at line 31 of file PanelTest.php.

31  {
32  return new \ILIAS\UI\Implementation\Factory();
33  }

◆ getPanelFactory()

PanelTest::getPanelFactory ( )
Returns

Definition at line 24 of file PanelTest.php.

24  {
25  return new \ILIAS\UI\Implementation\Component\Panel\Factory();
26  }

◆ test_implements_factory_interface()

PanelTest::test_implements_factory_interface ( )

Definition at line 35 of file PanelTest.php.

References array.

35  {
36  $f = $this->getPanelFactory();
37 
38  $this->assertInstanceOf("ILIAS\\UI\\Component\\Panel\\Factory", $f);
39  $this->assertInstanceOf
40  ( "ILIAS\\UI\\Component\\Panel\\Standard"
41  , $f->standard("Title",array(new ComponentDummy()))
42  );
43  $this->assertInstanceOf
44  ( "ILIAS\\UI\\Component\\Panel\\Sub"
45  , $f->sub("Title",array(new ComponentDummy()))
46  );
47  $this->assertInstanceOf
48  ( "ILIAS\\UI\\Component\\Panel\\Report"
49  , $f->report("Title",$f->sub("Title",array(new ComponentDummy())))
50  );
51  }
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

◆ test_render_report()

PanelTest::test_render_report ( )

Definition at line 149 of file PanelTest.php.

References $html, $r, and array.

149  {
150  $f = $this->getFactory();
151  $fp = $this->getPanelFactory();
152  $r = $this->getDefaultRenderer();
153  $sub = $fp->sub("Title",array());
154  $card = $f->card("Card Title");
155  $sub = $sub->withCard($card);
156  $report = $fp->report("Title",$sub);
157 
158  $html = $r->render($report);
159 
160  $expected_html =
161  "<div class=\"panel panel-primary il-panel-report\">".
162  " <div class=\"panel-heading ilHeader\">".
163  "<h3 class=\"ilHeader\">Title</h3>".
164  " </div>".
165  " <div class=\"panel-body\">".
166  "
167  <div class=\"panel panel-primary\">".
168  " <div class=\"panel-heading ilBlockHeader\">".
169  " <h4>Title</h4>".
170  " </div>".
171  " <div class=\"panel-body\"><div class=\"row\">".
172  " <div class=\"col-sm-8\"></div>".
173  " <div class=\"col-sm-4\">".
174  " <div class=\"il-card thumbnail\"><div class=\"caption\"><h5 class=\"card-title\">Card Title</h5></div></div>".
175  " </div>".
176  " </div></div>".
177  " </div>".
178  " </div>".
179  "</div>";
180 
181  $this->assertHTMLEquals($expected_html, $html);
182  }
getFactory()
Definition: PanelTest.php:31
getPanelFactory()
Definition: PanelTest.php:24
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
Create styles array
The data for the language used.
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87

◆ test_render_standard()

PanelTest::test_render_standard ( )

Definition at line 99 of file PanelTest.php.

References $html, $r, and array.

99  {
100  $f = $this->getPanelFactory();
101  $r = $this->getDefaultRenderer();
102  $p = $f->standard("Title",array());
103 
104  $html = new DOMDocument();
105  $html->formatOutput = true;
106  $html->preserveWhiteSpace = false;
107 
108  $expected = new DOMDocument();
109  $expected->formatOutput = true;
110  $expected->preserveWhiteSpace = false;
111 
112  $html = $r->render($p);
113 
114  $expected_html =
115  "<div class=\"panel panel-primary\">".
116  " <div class=\"panel-heading ilHeader\">".
117  " <h3 class=\"ilHeader\">Title</h3>".
118  " </div>".
119  " <div class=\"panel-body\"></div>".
120  "</div>";
121 
122  $this->assertHTMLEquals($expected_html, $html);
123  }
getPanelFactory()
Definition: PanelTest.php:24
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
Create styles array
The data for the language used.
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87

◆ test_render_sub()

PanelTest::test_render_sub ( )

Definition at line 125 of file PanelTest.php.

References $html, $r, and array.

125  {
126  $f = $this->getFactory();
127  $fp = $this->getPanelFactory();
128  $r = $this->getDefaultRenderer();
129  $p = $fp->sub("Title",array());
130  $card = $f->card("Card Title");
131  $p = $p->withCard($card);
132  $html = $r->render($p);
133 
134  $expected_html =
135  "<div class=\"panel panel-primary\">".
136  " <div class=\"panel-heading ilBlockHeader\">".
137  " <h4>Title</h4>".
138  " </div>".
139  " <div class=\"panel-body\"><div class=\"row\">".
140  " <div class=\"col-sm-8\"></div>".
141  " <div class=\"col-sm-4\">".
142  " <div class=\"il-card thumbnail\"><div class=\"caption\"><h5 class=\"card-title\">Card Title</h5></div></div>".
143  " </div>".
144  " </div></div>".
145  "</div>";
146 
147  $this->assertHTMLEquals($expected_html, $html);
148  }
getFactory()
Definition: PanelTest.php:31
getPanelFactory()
Definition: PanelTest.php:24
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:118
Create styles array
The data for the language used.
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87

◆ test_report_get_content()

PanelTest::test_report_get_content ( )

Definition at line 90 of file PanelTest.php.

References array.

90  {
91  $f = $this->getPanelFactory();
92  $sub = $f->sub("Title",array(new ComponentDummy()));
93  $p = $f->report("Title",$sub);
94 
95  $this->assertEquals($p->getContent(), array($sub));
96  }
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

◆ test_report_get_title()

PanelTest::test_report_get_title ( )

Definition at line 82 of file PanelTest.php.

References array.

82  {
83  $f = $this->getPanelFactory();
84  $sub = $f->sub("Title",array(new ComponentDummy()));
85  $p = $f->report("Title",array($sub));
86 
87  $this->assertEquals($p->getTitle(), "Title");
88  }
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

◆ test_standard_get_content()

PanelTest::test_standard_get_content ( )

Definition at line 60 of file PanelTest.php.

References array.

60  {
61  $f = $this->getPanelFactory();
62  $c = new ComponentDummy();
63  $p = $f->standard("Title",array($c));
64 
65  $this->assertEquals($p->getContent(), array($c));
66  }
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

◆ test_standard_get_title()

PanelTest::test_standard_get_title ( )

Definition at line 53 of file PanelTest.php.

References array.

53  {
54  $f = $this->getPanelFactory();
55  $p = $f->standard("Title",array(new ComponentDummy()));
56 
57  $this->assertEquals($p->getTitle(), "Title");
58  }
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

◆ test_sub_with_card()

PanelTest::test_sub_with_card ( )

Definition at line 69 of file PanelTest.php.

References array.

69  {
70  $fp = $this->getPanelFactory();
71  $f = $this->getFactory();
72 
73  $p = $fp->sub("Title",array(new ComponentDummy()));
74 
75  $card = $f->card("Card Title");
76 
77  $p = $p->withCard($card);
78 
79  $this->assertEquals($p->getCard(), $card);
80  }
getFactory()
Definition: PanelTest.php:31
getPanelFactory()
Definition: PanelTest.php:24
Create styles array
The data for the language used.

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