ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
FooterTest Class Reference

Tests for the Footer. More...

+ Inheritance diagram for FooterTest:
+ Collaboration diagram for FooterTest:

Public Member Functions

 setUp ()
 
 testConstruction ()
 
 testConstructionNoLinks ()
 
 testGetLinks (C\MainControls\Footer $footer)
 testConstruction More...
 
 testGetText (C\MainControls\Footer $footer)
 testConstruction More...
 
 testGetAndSetModalsWithTrigger (C\MainControls\Footer $footer)
 testConstruction More...
 
 testPermanentURL (C\MainControls\Footer $footer)
 testConstruction More...
 
 getUIFactory ()
 
 testRendering (C\MainControls\Footer $footer)
 testConstruction More...
 
 testRenderingNoLinks (C\MainControls\Footer $footer)
 testConstructionNoLinks More...
 
 testRenderingPermUrl ($footer)
 testPermanentURL More...
 
 testRenderingModalsWithTriggers (C\MainControls\Footer $footer)
 testGetAndSetModalsWithTrigger More...
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getFactory ()
 
 getModalFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Private Attributes

array $links = []
 
string $text = ''
 
string $perm_url = ''
 

Detailed Description

Tests for the Footer.

Definition at line 34 of file FooterTest.php.

Member Function Documentation

◆ getFactory()

FooterTest::getFactory ( )
protected

Definition at line 51 of file FooterTest.php.

Referenced by testConstruction(), and testConstructionNoLinks().

51  : I\MainControls\Factory
52  {
53  $sig_gen = new I\SignalGenerator();
54  $counter_factory = new I\Counter\Factory();
55  $slate_factory = new I\MainControls\Slate\Factory(
56  $sig_gen,
57  $counter_factory,
58  new I\Symbol\Factory(
59  new I\Symbol\Icon\Factory(),
60  new I\Symbol\Glyph\Factory(),
61  new I\Symbol\Avatar\Factory()
62  )
63  );
64  return new I\MainControls\Factory($sig_gen, $slate_factory);
65  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getModalFactory()

FooterTest::getModalFactory ( )
protected

Definition at line 317 of file FooterTest.php.

Referenced by testGetAndSetModalsWithTrigger().

317  : I\Modal\Factory
318  {
319  $group_mock = $this->createMock(Group::class);
320  $group_mock->method('withNameFrom')->willReturnSelf();
321 
322  $factory_mock = $this->createMock(FieldFactory::class);
323  $factory_mock->method('group')->willReturn($group_mock);
324 
325  return new I\Modal\Factory(new SignalGeneratorMock(), $factory_mock);
326  }
+ Here is the caller graph for this function:

◆ getUIFactory()

FooterTest::getUIFactory ( )

Definition at line 150 of file FooterTest.php.

150  : NoUIFactory
151  {
152  return new class () extends NoUIFactory {
153  public function listing(): C\Listing\Factory
154  {
155  return new I\Listing\Factory();
156  }
157 
158  public function link(): C\Link\Factory
159  {
160  return new I\Link\Factory();
161  }
162  };
163  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ setUp()

FooterTest::setUp ( )

Definition at line 40 of file FooterTest.php.

References Vendor\Package\$f.

40  : void
41  {
42  $f = new I\Link\Factory();
43  $this->links = [
44  $f->standard("Goto ILIAS", "http://www.ilias.de"),
45  $f->standard("go up", "#")
46  ];
47  $this->text = 'footer text';
48  $this->perm_url = 'http://www.ilias.de/goto.php?target=xxx_123';
49  }

◆ testConstruction()

FooterTest::testConstruction ( )

Definition at line 67 of file FooterTest.php.

References getFactory().

67  : C\MainControls\Footer
68  {
69  $footer = $this->getFactory()->footer($this->links, $this->text);
70  $this->assertInstanceOf(
71  "ILIAS\\UI\\Component\\MainControls\\Footer",
72  $footer
73  );
74  return $footer;
75  }
+ Here is the call graph for this function:

◆ testConstructionNoLinks()

FooterTest::testConstructionNoLinks ( )

Definition at line 77 of file FooterTest.php.

References getFactory().

77  : C\MainControls\Footer
78  {
79  $footer = $this->getFactory()->footer([], $this->text);
80  $this->assertInstanceOf(
81  "ILIAS\\UI\\Component\\MainControls\\Footer",
82  $footer
83  );
84  return $footer;
85  }
+ Here is the call graph for this function:

◆ testGetAndSetModalsWithTrigger()

FooterTest::testGetAndSetModalsWithTrigger ( C\MainControls\Footer  $footer)

testConstruction

Definition at line 112 of file FooterTest.php.

References getModalFactory().

112  : C\MainControls\Footer
113  {
114  $bf = new I\Button\Factory();
115  $signalGenerator = new SignalGenerator();
116  $mf = $this->getModalFactory();
117  $legacy = new ILIAS\UI\Implementation\Component\Legacy\Legacy('PhpUnit', $signalGenerator);
118 
119  $shyButton1 = $bf->shy('Button1', '#');
120  $shyButton2 = $bf->shy('Button2', '#');
121 
122  $modal1 = $mf->roundtrip('Modal1', $legacy);
123  $modal2 = $mf->roundtrip('Modal2', $legacy);
124 
125  $footer = $footer
126  ->withAdditionalModalAndTrigger($modal1, $shyButton1)
127  ->withAdditionalModalAndTrigger($modal2, $shyButton2);
128 
129  $this->assertCount(2, $footer->getModals());
130 
131  return $footer;
132  }
+ Here is the call graph for this function:

◆ testGetLinks()

FooterTest::testGetLinks ( C\MainControls\Footer  $footer)

testConstruction

Definition at line 90 of file FooterTest.php.

90  : void
91  {
92  $this->assertEquals(
93  $this->links,
94  $footer->getLinks()
95  );
96  }

◆ testGetText()

FooterTest::testGetText ( C\MainControls\Footer  $footer)

testConstruction

Definition at line 101 of file FooterTest.php.

101  : void
102  {
103  $this->assertEquals(
104  $this->text,
105  $footer->getText()
106  );
107  }

◆ testPermanentURL()

FooterTest::testPermanentURL ( C\MainControls\Footer  $footer)

testConstruction

Definition at line 137 of file FooterTest.php.

References $perm_url.

137  : C\MainControls\Footer
138  {
139  $df = new Data\Factory();
140  $footer = $footer->withPermanentURL($df->uri($this->perm_url));
141  $perm_url = $footer->getPermanentURL();
142  $this->assertInstanceOf("\\ILIAS\\Data\\URI", $perm_url);
143  $this->assertEquals(
144  $perm_url->getBaseURI() . '?' . $perm_url->getQuery(),
146  );
147  return $footer;
148  }
string $perm_url
Definition: FooterTest.php:38

◆ testRendering()

FooterTest::testRendering ( C\MainControls\Footer  $footer)

testConstruction

Definition at line 168 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\MainControls\Footer\footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS\UI\examples\Symbol\Glyph\Up\up().

168  : void
169  {
170  $r = $this->getDefaultRenderer();
171  $html = $r->render($footer);
172 
173  $expected = <<<EOT
174  <div class="il-maincontrols-footer">
175  <div class="il-footer-content">
176  <div class="il-footer-text">
177  footer text
178  </div>
179 
180  <div class="il-footer-links">
181  <ul>
182  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
183  <li><a href="#" >go up</a></li>
184  </ul>
185  </div>
186  </div>
187  </div>
188 EOT;
189 
190  $this->assertEquals(
191  $this->brutallyTrimHTML($expected),
192  $this->brutallyTrimHTML($html)
193  );
194  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Class ChatMainBarProvider .
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

◆ testRenderingModalsWithTriggers()

FooterTest::testRenderingModalsWithTriggers ( C\MainControls\Footer  $footer)

testGetAndSetModalsWithTrigger

Definition at line 255 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\MainControls\Footer\footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS\UI\examples\Symbol\Glyph\Up\up().

255  : void
256  {
257  $r = $this->getDefaultRenderer();
258  $html = $r->render($footer);
259 
260  $expected = <<<EOT
261  <div class="il-maincontrols-footer">
262  <div class="il-footer-content">
263  <div class="il-footer-text">footer text</div>
264 
265  <div class="il-footer-links">
266  <ul>
267  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
268  <li><a href="#" >go up</a></li>
269  <li><button class="btn btn-link" id="id_1" >Button1</button></li>
270  <li><button class="btn btn-link" id="id_2">Button2</button></li>
271  </ul>
272  </div>
273  </div>
274  <div class="il-footer-modals">
275  <div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_3">
276  <div class="modal-dialog" role="document" data-replace-marker="component">
277  <div class="modal-content">
278  <div class="modal-header">
279  <button type="button" class="close" data-dismiss="modal" aria-label="close">
280  <span aria-hidden="true">&times;</span>
281  </button>
282  <span class="modal-title">Modal1</span>
283  </div>
284  <div class="modal-body">PhpUnit</div>
285  <div class="modal-footer">
286  <button class="btn btn-default" data-dismiss="modal">cancel</button>
287  </div>
288  </div>
289  </div>
290  </div>
291  <div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_5">
292  <div class="modal-dialog" role="document" data-replace-marker="component">
293  <div class="modal-content">
294  <div class="modal-header">
295  <button type="button" class="close" data-dismiss="modal" aria-label="close">
296  <span aria-hidden="true">&times;</span>
297  </button>
298  <span class="modal-title">Modal2</span>
299  </div>
300  <div class="modal-body">PhpUnit</div>
301  <div class="modal-footer">
302  <button class="btn btn-default" data-dismiss="modal">cancel</button>
303  </div>
304  </div>
305  </div>
306  </div>
307  </div>
308  </div>
309 EOT;
310 
311  $this->assertEquals(
312  $this->brutallyTrimHTML($expected),
313  $this->brutallyTrimHTML($html)
314  );
315  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Class ChatMainBarProvider .
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

◆ testRenderingNoLinks()

FooterTest::testRenderingNoLinks ( C\MainControls\Footer  $footer)

testConstructionNoLinks

Definition at line 199 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\MainControls\Footer\footer(), and ILIAS_UI_TestBase\getDefaultRenderer().

199  : void
200  {
201  $r = $this->getDefaultRenderer();
202  $html = $r->render($footer);
203 
204  $expected = <<<EOT
205  <div class="il-maincontrols-footer">
206  <div class="il-footer-content">
207  <div class="il-footer-text">
208  footer text
209  </div>
210  </div>
211  </div>
212 EOT;
213 
214  $this->assertEquals(
215  $this->brutallyTrimHTML($expected),
216  $this->brutallyTrimHTML($html)
217  );
218  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

◆ testRenderingPermUrl()

FooterTest::testRenderingPermUrl (   $footer)

testPermanentURL

Definition at line 223 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS\UI\examples\MainControls\Footer\footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS\UI\examples\Symbol\Glyph\Up\up().

223  : void
224  {
225  $r = $this->getDefaultRenderer();
226  $html = $r->render($footer);
227 
228  $expected = <<<EOT
229  <div class="il-maincontrols-footer">
230  <div class="il-footer-content">
231  <div class="il-footer-permanent-url"><a href="http://www.ilias.de/goto.php?target=xxx_123">perma_link</a>
232  </div>
233 
234  <div class="il-footer-text">footer text</div>
235 
236  <div class="il-footer-links">
237  <ul>
238  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
239  <li><a href="#" >go up</a></li>
240  </ul>
241  </div>
242  </div>
243  </div>
244 EOT;
245 
246  $this->assertEquals(
247  $this->brutallyTrimHTML($expected),
248  $this->brutallyTrimHTML($html)
249  );
250  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
Class ChatMainBarProvider .
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
+ Here is the call graph for this function:

Field Documentation

◆ $links

array FooterTest::$links = []
private

Definition at line 36 of file FooterTest.php.

◆ $perm_url

string FooterTest::$perm_url = ''
private

Definition at line 38 of file FooterTest.php.

Referenced by testPermanentURL().

◆ $text

string FooterTest::$text = ''
private

Definition at line 37 of file FooterTest.php.


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