ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FooterTest Class Reference
+ Inheritance diagram for FooterTest:
+ Collaboration diagram for FooterTest:

Public Member Functions

 testRenderWithPermanentUrl ()
 
 testRenderWithAdditionalLinkGroup ()
 
 testRenderWithAdditionalLink ()
 
 testRenderWithAdditionalIcon ()
 
 testRenderWithAdditionalText ()
 
 testRenderWithModalsAndTrigger ()
 
 testRenderEmptyFooter ()
 
 getUIFactory ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

I Link Standard $link_mock
 
I Symbol Icon Icon $icon_mock
 
I Button Shy $shy_mock
 
I Button Standard $button_mock
 
I Listing Unordered $unordered_mock
 
I Button Factory $button_factory
 
I Link Factory $link_factory
 
I Listing Factory $listing_factory
 
ILIAS Data URI $uri_mock
 
string $link_html
 
string $icon_html
 
string $shy_html
 
string $button_html
 
string $unordered_html
 

Detailed Description

Definition at line 28 of file FooterTest.php.

Member Function Documentation

◆ getUIFactory()

FooterTest::getUIFactory ( )

Definition at line 281 of file FooterTest.php.

282 {
283 return new class (
284 $this->createMock(I\SignalGeneratorInterface::class),
285 $this->createMock(I\Counter\Factory::class),
286 $this->createMock(I\Symbol\Factory::class),
290 ) extends NoUIFactory {
291 public function __construct(
292 protected I\SignalGeneratorInterface $signal_generator,
293 protected I\Counter\Factory $counter_factory,
294 protected I\Symbol\Factory $symbol_factory,
295 protected I\Button\Factory $button_factory,
296 protected I\Link\Factory $link_factory,
297 protected I\Listing\Factory $listing_factory,
298 ) {
299 }
300 public function mainControls(): I\MainControls\Factory
301 {
302 return new I\MainControls\Factory(
303 $this->signal_generator,
304 new I\MainControls\Slate\Factory(
305 $this->signal_generator,
306 $this->counter_factory,
307 $this->symbol_factory,
308 ),
309 );
310 }
311 public function button(): I\Button\Factory
312 {
314 }
315 public function link(): I\Link\Factory
316 {
317 return $this->link_factory;
318 }
319 public function listing(): I\Listing\Factory
320 {
322 }
323 };
324 }
I Link Factory $link_factory
Definition: FooterTest.php:36
I Button Factory $button_factory
Definition: FooterTest.php:35
I Listing Factory $listing_factory
Definition: FooterTest.php:37
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
button(string $caption, string $cmd)
link(string $caption, string $href, bool $new_viewport=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

References $button_factory, $link_factory, $listing_factory, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\button(), ILIAS\Repository\link(), and ILIAS\Repository\listing().

Referenced by testRenderEmptyFooter(), testRenderWithAdditionalIcon(), testRenderWithAdditionalLink(), testRenderWithAdditionalLinkGroup(), testRenderWithAdditionalText(), testRenderWithModalsAndTrigger(), and testRenderWithPermanentUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

FooterTest::setUp ( )
protected

Definition at line 45 of file FooterTest.php.

45 : void
46 {
47 $this->link_html = sha1(C\Link\Standard::class);
48 $this->icon_html = sha1(C\Symbol\Icon\Icon::class);
49 $this->shy_html = sha1(C\Button\Shy::class);
50 $this->button_html = sha1(C\Button\Standard::class);
51 $this->unordered_html = sha1(C\Listing\Unordered::class);
52
53 $this->link_mock = $this->createMock(I\Link\Standard::class);
54 $this->link_mock->method('getCanonicalName')->willReturn($this->link_html);
55
56 $this->icon_mock = $this->createMock(I\Symbol\Icon\Icon::class);
57 $this->icon_mock->method('getCanonicalName')->willReturn($this->icon_html);
58
59 $this->shy_mock = $this->createMock(I\Button\Shy::class);
60 $this->shy_mock->method('getCanonicalName')->willReturn($this->shy_html);
61
62 $this->button_mock = $this->createMock(I\Button\Standard::class);
63 $this->button_mock->method('getCanonicalName')->willReturn($this->button_html);
64
65 $this->unordered_mock = $this->createMock(I\Listing\Unordered::class);
66 $this->unordered_mock->method('getCanonicalName')->willReturn($this->unordered_html);
67
68 $this->button_factory = $this->createMock(I\Button\Factory::class);
69 $this->button_factory->method('shy')->willReturn($this->shy_mock);
70 $this->button_factory->method('standard')->willReturn($this->button_mock);
71
72 $this->link_factory = $this->createMock(I\Link\Factory::class);
73 $this->link_factory->method('standard')->willReturn($this->link_mock);
74
75 $this->listing_factory = $this->createMock(I\Listing\Factory::class);
76 $this->listing_factory->method('unordered')->willReturn($this->unordered_mock);
77
78 $this->uri_mock = $this->createMock(\ILIAS\Data\URI::class);
79
80 parent::setUp();
81 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

◆ testRenderEmptyFooter()

FooterTest::testRenderEmptyFooter ( )

Definition at line 269 of file FooterTest.php.

269 : void
270 {
271 $footer = $this->getUIFactory()->mainControls()->footer();
272
273 $renderer = $this->getDefaultRenderer();
274 $actual_html = $renderer->render($footer);
275
276 $expected_html = '';
277
278 $this->assertEquals($expected_html, $actual_html);
279 }
$renderer

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithAdditionalIcon()

FooterTest::testRenderWithAdditionalIcon ( )

Definition at line 186 of file FooterTest.php.

186 : void
187 {
188 $footer = $this->getUIFactory()->mainControls()->footer();
189 $footer = $footer->withAdditionalIcon($this->icon_mock);
190
191 $renderer = $this->getDefaultRenderer(null, [$this->icon_mock]);
192 $actual_html = $renderer->render($footer);
193
194 $expected_html = <<<EOT
195<footer class="c-maincontrols c-maincontrols__footer">
196 <section class="c-maincontrols__footer-grid" data-section="icons" aria-label="footer_icons" tabindex="0">
197 <div class="c-maincontrols__footer-grid__item l-bar__group">
198 <span class="l-bar__element">$this->icon_html</span>
199 </div>
200 </section>
201</footer>
202EOT;
203
204 $this->assertEquals(
205 $this->brutallyTrimHTML($expected_html),
206 $this->brutallyTrimHTML($actual_html)
207 );
208 }

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithAdditionalLink()

FooterTest::testRenderWithAdditionalLink ( )

Definition at line 164 of file FooterTest.php.

164 : void
165 {
166 $footer = $this->getUIFactory()->mainControls()->footer();
167 $footer = $footer->withAdditionalLink($this->link_mock);
168
169 $renderer = $this->getDefaultRenderer(null, [$this->link_mock]);
170 $actual_html = $renderer->render($footer);
171
172 $expected_html = <<<EOT
173<footer class="c-maincontrols c-maincontrols__footer">
174 <section class="c-maincontrols__footer-grid" data-section="links" aria-label="footer_links" tabindex="0">
175 <div class="c-maincontrols__footer-grid__item text-left">$this->link_html</div>
176 </section>
177</footer>
178EOT;
179
180 $this->assertEquals(
181 $this->brutallyTrimHTML($expected_html),
182 $this->brutallyTrimHTML($actual_html)
183 );
184 }

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithAdditionalLinkGroup()

FooterTest::testRenderWithAdditionalLinkGroup ( )

Definition at line 136 of file FooterTest.php.

136 : void
137 {
138 $link_group_title = sha1('link_group_1');
139
140 $footer = $this->getUIFactory()->mainControls()->footer();
141 $footer = $footer->withAdditionalLinkGroup($link_group_title, [$this->link_mock]);
142
143 $this->listing_factory->expects($this->once())->method('unordered')->with([$this->link_mock]);
144
145 $renderer = $this->getDefaultRenderer(null, [$this->unordered_mock]);
146 $actual_html = $renderer->render($footer);
147
148 $expected_html = <<<EOT
149<footer class="c-maincontrols c-maincontrols__footer">
150 <section class="c-maincontrols__footer-grid" data-section="link-groups" aria-label="footer_link_groups" tabindex="0">
151 <div class="c-maincontrols__footer-grid__item text-left">
152 <strong>$link_group_title</strong>$this->unordered_html
153 </div>
154 </section>
155</footer>
156EOT;
157
158 $this->assertEquals(
159 $this->brutallyTrimHTML($expected_html),
160 $this->brutallyTrimHTML($actual_html)
161 );
162 }

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithAdditionalText()

FooterTest::testRenderWithAdditionalText ( )

Definition at line 210 of file FooterTest.php.

210 : void
211 {
212 $text = sha1('text_1');
213
214 $footer = $this->getUIFactory()->mainControls()->footer();
215 $footer = $footer->withAdditionalText($text);
216
217 $renderer = $this->getDefaultRenderer();
218 $actual_html = $renderer->render($footer);
219
220 $expected_html = <<<EOT
221<footer class="c-maincontrols c-maincontrols__footer">
222 <section class="c-maincontrols__footer-grid" data-section="texts" aria-label="footer_texts" tabindex="0">
223 <div class="c-maincontrols__footer-grid__item text-left">$text</div>
224 </section>
225</footer>
226EOT;
227
228 $this->assertEquals(
229 $this->brutallyTrimHTML($expected_html),
230 $this->brutallyTrimHTML($actual_html)
231 );
232 }

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithModalsAndTrigger()

FooterTest::testRenderWithModalsAndTrigger ( )

Definition at line 234 of file FooterTest.php.

234 : void
235 {
236 $modal_html = sha1(C\Modal\RoundTrip::class);
237 $modal_mock = $this->createMock(C\Modal\RoundTrip::class);
238 $modal_mock->method('getCanonicalName')->willReturn($modal_html);
239 $modal_mock->method('getShowSignal')->willReturn(
240 $this->createMock(C\Signal::class)
241 );
242
244 $shy_mock->method('withOnClick')->willReturnSelf();
245
246 $shy_mock = $shy_mock->withOnClick($modal_mock->getShowSignal());
247
248 $footer = $this->getUIFactory()->mainControls()->footer();
249 $footer = $footer->withAdditionalLink($shy_mock);
250 $footer = $footer->withAdditionalModal($modal_mock);
251
252 $renderer = $this->getDefaultRenderer(null, [$modal_mock, $shy_mock]);
253 $actual_html = $renderer->render($footer);
254
255 $expected_html = <<<EOT
256<footer class="c-maincontrols c-maincontrols__footer">
257 <section class="c-maincontrols__footer-grid" data-section="links" aria-label="footer_links" tabindex="0">
258 <div class="c-maincontrols__footer-grid__item text-left">$this->shy_html</div>
259 </section>
260</footer>$modal_html
261EOT;
262
263 $this->assertEquals(
264 $this->brutallyTrimHTML($expected_html),
265 $this->brutallyTrimHTML($actual_html)
266 );
267 }
I Button Shy $shy_mock
Definition: FooterTest.php:32

References $renderer, $shy_mock, and getUIFactory().

+ Here is the call graph for this function:

◆ testRenderWithPermanentUrl()

FooterTest::testRenderWithPermanentUrl ( )

Definition at line 104 of file FooterTest.php.

104 : void
105 {
106 $footer = $this->getUIFactory()->mainControls()->footer();
107 $footer = $footer->withPermanentURL($this->uri_mock);
108
109 $this->button_factory->expects($this->once())->method('standard')->with('copy_perma_link', '');
110 $this->button_mock->expects($this->once())->method('withAdditionalOnLoadCode')->willReturnSelf();
111
112 $renderer = $this->getDefaultRenderer(null, [$this->button_mock]);
113 $actual_html = $renderer->render($footer);
114
115 $expected_html = <<<EOT
116<footer class="c-maincontrols c-maincontrols__footer">
117 <section class="c-maincontrols__footer-grid" data-section="permanent-link" aria-label="footer_permanent_link" tabindex="0">
118 <div class="c-maincontrols__footer-grid__item text-left">
119 <div class="c-tooltip__container c-tooltip--top" aria-live="polite">
120 $this->button_html
121 <div class="c-tooltip c-tooltip--hidden" role="tooltip">
122 perma_link_copied
123 </div>
124 </div>
125 </div>
126 </section>
127</footer>
128EOT;
129
130 $this->assertEquals(
131 $this->brutallyTrimHTML($expected_html),
132 $this->brutallyTrimHTML($actual_html)
133 );
134 }

References $renderer, and getUIFactory().

+ Here is the call graph for this function:

Field Documentation

◆ $button_factory

I Button Factory FooterTest::$button_factory
protected

Definition at line 35 of file FooterTest.php.

Referenced by getUIFactory().

◆ $button_html

string FooterTest::$button_html
protected

Definition at line 42 of file FooterTest.php.

◆ $button_mock

I Button Standard FooterTest::$button_mock
protected

Definition at line 33 of file FooterTest.php.

◆ $icon_html

string FooterTest::$icon_html
protected

Definition at line 40 of file FooterTest.php.

◆ $icon_mock

I Symbol Icon Icon FooterTest::$icon_mock
protected

Definition at line 31 of file FooterTest.php.

◆ $link_factory

I Link Factory FooterTest::$link_factory
protected

Definition at line 36 of file FooterTest.php.

Referenced by getUIFactory().

◆ $link_html

string FooterTest::$link_html
protected

Definition at line 39 of file FooterTest.php.

◆ $link_mock

I Link Standard FooterTest::$link_mock
protected

Definition at line 30 of file FooterTest.php.

◆ $listing_factory

I Listing Factory FooterTest::$listing_factory
protected

Definition at line 37 of file FooterTest.php.

Referenced by getUIFactory().

◆ $shy_html

string FooterTest::$shy_html
protected

Definition at line 41 of file FooterTest.php.

◆ $shy_mock

I Button Shy FooterTest::$shy_mock
protected

Definition at line 32 of file FooterTest.php.

Referenced by testRenderWithModalsAndTrigger().

◆ $unordered_html

string FooterTest::$unordered_html
protected

Definition at line 43 of file FooterTest.php.

◆ $unordered_mock

I Listing Unordered FooterTest::$unordered_mock
protected

Definition at line 34 of file FooterTest.php.

◆ $uri_mock

ILIAS Data URI FooterTest::$uri_mock
protected

Definition at line 38 of file FooterTest.php.


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