ILIAS  release_7 Revision v7.30-3-g800a261c036
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 ($footer)
 testConstruction More...
 
 testGetText ($footer)
 testConstruction More...
 
 testGetAndSetModalsWithTrigger (C\MainControls\Footer $footer)
 testConstruction More...
 
 testPermanentURL ($footer)
 testConstruction More...
 
 getUIFactory ()
 
 testRendering ($footer)
 testConstruction More...
 
 testRenderingNoLinks ($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 ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

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

Private Attributes

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

Detailed Description

Tests for the Footer.

Definition at line 15 of file FooterTest.php.

Member Function Documentation

◆ getFactory()

FooterTest::getFactory ( )
protected

Definition at line 32 of file FooterTest.php.

References $factory.

Referenced by testConstruction(), and testConstructionNoLinks().

33  {
34  $sig_gen = new I\SignalGenerator();
35  $counter_factory = new I\Counter\Factory();
36  $slate_factory = new I\MainControls\Slate\Factory(
37  $sig_gen,
38  $counter_factory,
39  new I\Symbol\Factory(
40  new I\Symbol\Icon\Factory(),
41  new I\Symbol\Glyph\Factory(),
42  new I\Symbol\Avatar\Factory()
43  )
44  );
45  $factory = new I\MainControls\Factory($sig_gen, $slate_factory);
46  return $factory;
47  }
$factory
Definition: metadata.php:58
+ Here is the caller graph for this function:

◆ getUIFactory()

FooterTest::getUIFactory ( )

Definition at line 132 of file FooterTest.php.

References $factory.

133  {
134  $factory = new class extends NoUIFactory {
135  public function listing()
136  {
137  return new I\Listing\Factory();
138  }
139  };
140  return $factory;
141  }
$factory
Definition: metadata.php:58

◆ setUp()

FooterTest::setUp ( )

Definition at line 21 of file FooterTest.php.

References Vendor\Package\$f.

21  : void
22  {
23  $f = new I\Link\Factory();
24  $this->links = [
25  $f->standard("Goto ILIAS", "http://www.ilias.de"),
26  $f->standard("go up", "#")
27  ];
28  $this->text = 'footer text';
29  $this->perm_url = 'http://www.ilias.de/goto.php?target=xxx_123';
30  }

◆ testConstruction()

FooterTest::testConstruction ( )

Definition at line 49 of file FooterTest.php.

References getFactory().

50  {
51  $footer = $this->getFactory()->footer($this->links, $this->text);
52  $this->assertInstanceOf(
53  "ILIAS\\UI\\Component\\MainControls\\Footer",
54  $footer
55  );
56  return $footer;
57  }
+ Here is the call graph for this function:

◆ testConstructionNoLinks()

FooterTest::testConstructionNoLinks ( )

Definition at line 59 of file FooterTest.php.

References getFactory().

60  {
61  $footer = $this->getFactory()->footer([], $this->text);
62  $this->assertInstanceOf(
63  "ILIAS\\UI\\Component\\MainControls\\Footer",
64  $footer
65  );
66  return $footer;
67  }
+ Here is the call graph for this function:

◆ testGetAndSetModalsWithTrigger()

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

testConstruction

Definition at line 94 of file FooterTest.php.

95  {
96  $bf = new I\Button\Factory();
97  $signalGenerator = new SignalGenerator();
98  $mf = new I\Modal\Factory($signalGenerator);
99  $legacy = new ILIAS\UI\Implementation\Component\Legacy\Legacy('PhpUnit', $signalGenerator);
100 
101  $shyButton1 = $bf->shy('Button1', '#');
102  $shyButton2 = $bf->shy('Button2', '#');
103 
104  $modal1 = $mf->roundtrip('Modal1', $legacy);
105  $modal2 = $mf->roundtrip('Modal2', $legacy);
106 
107  $footer = $footer
108  ->withAdditionalModalAndTrigger($modal1, $shyButton1)
109  ->withAdditionalModalAndTrigger($modal2, $shyButton2);
110 
111  $this->assertCount(2, $footer->getModals());
112 
113  return $footer;
114  }

◆ testGetLinks()

FooterTest::testGetLinks (   $footer)

testConstruction

Definition at line 72 of file FooterTest.php.

73  {
74  $this->assertEquals(
75  $this->links,
76  $footer->getLinks()
77  );
78  }

◆ testGetText()

FooterTest::testGetText (   $footer)

testConstruction

Definition at line 83 of file FooterTest.php.

84  {
85  $this->assertEquals(
86  $this->text,
87  $footer->getText()
88  );
89  }

◆ testPermanentURL()

FooterTest::testPermanentURL (   $footer)

testConstruction

Definition at line 119 of file FooterTest.php.

References $perm_url.

120  {
121  $df = new \ILIAS\Data\Factory();
122  $footer = $footer->withPermanentURL($df->uri($this->perm_url));
123  $perm_url = $footer->getPermanentURL();
124  $this->assertInstanceOf("\\ILIAS\\Data\\URI", $perm_url);
125  $this->assertEquals(
126  $perm_url->getBaseURI() . '?' . $perm_url->getQuery(),
128  );
129  return $footer;
130  }

◆ testRendering()

FooterTest::testRendering (   $footer)

testConstruction

Definition at line 146 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and up().

147  {
148  $r = $this->getDefaultRenderer();
149  $html = $r->render($footer);
150 
151  $expected = <<<EOT
152  <div class="il-maincontrols-footer">
153  <div class="il-footer-content">
154  <div class="il-footer-text">
155  footer text
156  </div>
157 
158  <div class="il-footer-links">
159  <ul>
160  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
161  <li><a href="#" >go up</a></li>
162  </ul>
163  </div>
164  </div>
165  </div>
166 EOT;
167 
168  $this->assertEquals(
169  $this->brutallyTrimHTML($expected),
170  $this->brutallyTrimHTML($html)
171  );
172  }
Class ChatMainBarProvider .
up()
Definition: up.php:2
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ testRenderingModalsWithTriggers()

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

testGetAndSetModalsWithTrigger

Definition at line 233 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and up().

234  {
235  $r = $this->getDefaultRenderer();
236  $html = $r->render($footer);
237 
238  $expected = <<<EOT
239  <div class="il-maincontrols-footer">
240  <div class="il-footer-content">
241  <div class="il-footer-text">footer text</div>
242 
243  <div class="il-footer-links">
244  <ul>
245  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
246  <li><a href="#" >go up</a></li>
247  <li><button class="btn btn-link" id="id_1" >Button1</button></li>
248  <li><button class="btn btn-link" id="id_2">Button2</button></li>
249  </ul>
250  </div>
251  </div>
252  <div class="il-footer-modals">
253  <div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_3">
254  <div class="modal-dialog" role="document" data-replace-marker="component">
255  <div class="modal-content">
256  <div class="modal-header">
257  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
258  <span aria-hidden="true">&times;</span>
259  </button>
260  <span class="modal-title">Modal1</span>
261  </div>
262  <div class="modal-body">PhpUnit</div>
263  <div class="modal-footer">
264  <button class="btn btn-default" data-dismiss="modal" aria-label="Close">cancel</button>
265  </div>
266  </div>
267  </div>
268  </div>
269  <div class="modal fade il-modal-roundtrip" tabindex="-1" role="dialog" id="id_5">
270  <div class="modal-dialog" role="document" data-replace-marker="component">
271  <div class="modal-content">
272  <div class="modal-header">
273  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
274  <span aria-hidden="true">&times;</span>
275  </button>
276  <span class="modal-title">Modal2</span>
277  </div>
278  <div class="modal-body">PhpUnit</div>
279  <div class="modal-footer">
280  <button class="btn btn-default" data-dismiss="modal" aria-label="Close">cancel</button>
281  </div>
282  </div>
283  </div>
284  </div>
285  </div>
286  </div>
287 EOT;
288 
289  $this->assertEquals(
290  $this->brutallyTrimHTML($expected),
291  $this->brutallyTrimHTML($html)
292  );
293  }
Class ChatMainBarProvider .
up()
Definition: up.php:2
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ testRenderingNoLinks()

FooterTest::testRenderingNoLinks (   $footer)

testConstructionNoLinks

Definition at line 177 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), footer(), and ILIAS_UI_TestBase\getDefaultRenderer().

178  {
179  $r = $this->getDefaultRenderer();
180  $html = $r->render($footer);
181 
182  $expected = <<<EOT
183  <div class="il-maincontrols-footer">
184  <div class="il-footer-content">
185  <div class="il-footer-text">
186  footer text
187  </div>
188  </div>
189  </div>
190 EOT;
191 
192  $this->assertEquals(
193  $this->brutallyTrimHTML($expected),
194  $this->brutallyTrimHTML($html)
195  );
196  }
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

◆ testRenderingPermUrl()

FooterTest::testRenderingPermUrl (   $footer)

testPermanentURL

Definition at line 201 of file FooterTest.php.

References ILIAS_UI_TestBase\brutallyTrimHTML(), footer(), ILIAS_UI_TestBase\getDefaultRenderer(), and up().

202  {
203  $r = $this->getDefaultRenderer();
204  $html = $r->render($footer);
205 
206  $expected = <<<EOT
207  <div class="il-maincontrols-footer">
208  <div class="il-footer-content">
209  <div class="il-footer-permanent-url"><label for="current_perma_link">perma_link</label><input id="current_perma_link" type="text" value="http://www.ilias.de/goto.php?target=xxx_123" readonly="readOnly">
210  </div>
211 
212  <div class="il-footer-text">footer text</div>
213 
214  <div class="il-footer-links">
215  <ul>
216  <li><a href="http://www.ilias.de" >Goto ILIAS</a></li>
217  <li><a href="#" >go up</a></li>
218  </ul>
219  </div>
220  </div>
221  </div>
222 EOT;
223 
224  $this->assertEquals(
225  $this->brutallyTrimHTML($expected),
226  $this->brutallyTrimHTML($html)
227  );
228  }
Class ChatMainBarProvider .
up()
Definition: up.php:2
brutallyTrimHTML($html)
A more radical version of normalizeHTML.
Definition: Base.php:392
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])
Definition: Base.php:311
+ Here is the call graph for this function:

Field Documentation

◆ $links

FooterTest::$links = []
private

Definition at line 17 of file FooterTest.php.

◆ $perm_url

FooterTest::$perm_url = ''
private

Definition at line 19 of file FooterTest.php.

Referenced by testPermanentURL().

◆ $text

FooterTest::$text = ''
private

Definition at line 18 of file FooterTest.php.


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