ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BulkyLinkTest Class Reference

Testing behavior of the Bulky Link. More...

+ Inheritance diagram for BulkyLinkTest:
+ Collaboration diagram for BulkyLinkTest:

Public Member Functions

 setUp ()
 
 testImplementsInterfaces ()
 
 testWrongConstruction ()
 
 testWithAriaRole ()
 
 testWithAriaRoleIncorrect ()
 
 testGetLabell ()
 
 testGetGlyphSymbol ()
 
 testGetAction ()
 
 testRenderingGlyph ()
 
 testRenderingIcon ()
 
 testRenderingWithId ()
 
 testRenderWithAriaRoleMenuitem ()
 
 testRenderWithLabelAndAltImageSame ()
 
 testRenderWithLanguage ()
 
 testRenderWithHelpTopic ()
 
 testRenderWithRelationships ()
 
 testRenderWithDuplicateRelationship ()
 
 testBulkyLinkRenderWithDisabled ()
 

Protected Attributes

I Link Factory $factory
 
I Symbol Glyph Glyph $glyph
 
I Symbol Icon Standard $icon
 
Data URI $target
 

Detailed Description

Testing behavior of the Bulky Link.

Definition at line 33 of file BulkyLinkTest.php.

Member Function Documentation

◆ setUp()

BulkyLinkTest::setUp ( )

Definition at line 40 of file BulkyLinkTest.php.

40 : void
41 {
42 $this->factory = new I\Link\Factory();
43 $this->glyph = new I\Symbol\Glyph\Glyph("briefcase", "briefcase");
44 $this->icon = new I\Symbol\Icon\Standard("someExample", "Example", "small", false);
45 $this->target = new Data\URI("http://www.ilias.de");
46 }
factory()

References factory().

+ Here is the call graph for this function:

◆ testBulkyLinkRenderWithDisabled()

BulkyLinkTest::testBulkyLinkRenderWithDisabled ( )

Definition at line 291 of file BulkyLinkTest.php.

291 : void
292 {
293 $r = $this->getDefaultRenderer();
294 $b = $this->factory->bulky($this->icon, "label", $this->target)
295 ->withDisabled(true);
296 $expected_html = <<<EXP
297 <a class="il-link link-bulky" aria-disabled="true">
298 <img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>
299 <span class="bulky-label">label</span>
300 </a>
301EXP;
302 $this->assertHTMLEquals($expected_html, $r->render($b));
303 }

References Vendor\Package\$b, ILIAS\UI\examples\Input\Field\Checkbox\disabled(), and factory().

+ Here is the call graph for this function:

◆ testGetAction()

BulkyLinkTest::testGetAction ( )

Definition at line 98 of file BulkyLinkTest.php.

98 : void
99 {
100 $plain = "http://www.ilias.de";
101 $with_query = $plain . "?query1=1";
102 $with_multi_query = $with_query . "&query2=2";
103 $with_fragment = $plain . "#fragment";
104 $with_multi_query_and_fragment_uri = $with_multi_query . $with_fragment;
105
106 $plain_uri = new Data\URI($plain);
107 $with_query_uri = new Data\URI($with_query);
108 $with_multi_query_uri = new Data\URI($with_multi_query);
109 $with_fragment_uri = new Data\URI($with_fragment);
110 $with_multi_query_and_fragment_uri = new Data\URI($with_multi_query_and_fragment_uri);
111
112 $this->assertEquals($plain, $this->factory->bulky($this->glyph, "label", $plain_uri)->getAction());
113 $this->assertEquals($with_query, $this->factory->bulky($this->glyph, "label", $with_query_uri)->getAction());
114 $this->assertEquals($with_multi_query, $this->factory->bulky($this->glyph, "label", $with_multi_query_uri)->getAction());
115 $this->assertEquals($with_fragment_uri, $this->factory->bulky($this->glyph, "label", $with_fragment_uri)->getAction());
116 $this->assertEquals($with_multi_query_and_fragment_uri, $this->factory->bulky($this->glyph, "label", $with_multi_query_and_fragment_uri)->getAction());
117 }

References factory().

+ Here is the call graph for this function:

◆ testGetGlyphSymbol()

BulkyLinkTest::testGetGlyphSymbol ( )

Definition at line 90 of file BulkyLinkTest.php.

90 : void
91 {
92 $link = $this->factory->bulky($this->glyph, "label", $this->target);
93 $this->assertEquals($this->glyph, $link->getSymbol());
94 $link = $this->factory->bulky($this->icon, "label", $this->target);
95 $this->assertEquals($this->icon, $link->getSymbol());
96 }

References factory().

+ Here is the call graph for this function:

◆ testGetLabell()

BulkyLinkTest::testGetLabell ( )

Definition at line 83 of file BulkyLinkTest.php.

83 : void
84 {
85 $label = 'some label for the link';
86 $link = $this->factory->bulky($this->glyph, $label, $this->target);
87 $this->assertEquals($label, $link->getLabel());
88 }

References factory().

+ Here is the call graph for this function:

◆ testImplementsInterfaces()

BulkyLinkTest::testImplementsInterfaces ( )

Definition at line 48 of file BulkyLinkTest.php.

48 : void
49 {
50 $link = $this->factory->bulky($this->glyph, "label", $this->target);
51 $this->assertInstanceOf(C\Bulky::class, $link);
52 $this->assertInstanceOf(C\Link::class, $link);
53 }

References factory().

+ Here is the call graph for this function:

◆ testRenderingGlyph()

BulkyLinkTest::testRenderingGlyph ( )

Definition at line 119 of file BulkyLinkTest.php.

119 : void
120 {
121 $r = $this->getDefaultRenderer();
122 $b = $this->factory->bulky($this->glyph, "label", $this->target);
123
124 $expected = ''
125 . '<a class="il-link link-bulky" href="http://www.ilias.de">'
126 . ' <span class="glyph" role="img">'
127 . ' <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>'
128 . ' </span>'
129 . ' <span class="bulky-label">label</span>'
130 . '</a>';
131
132 $this->assertHTMLEquals(
133 $expected,
134 $r->render($b)
135 );
136 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderingIcon()

BulkyLinkTest::testRenderingIcon ( )

Definition at line 138 of file BulkyLinkTest.php.

138 : void
139 {
140 $r = $this->getDefaultRenderer();
141 $b = $this->factory->bulky($this->icon, "label", $this->target);
142
143 $expected = ''
144 . '<a class="il-link link-bulky" href="http://www.ilias.de">'
145 . ' <img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>'
146 . ' <span class="bulky-label">label</span>'
147 . '</a>';
148
149 $this->assertHTMLEquals(
150 $expected,
151 $r->render($b)
152 );
153 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderingWithId()

BulkyLinkTest::testRenderingWithId ( )

Definition at line 154 of file BulkyLinkTest.php.

154 : void
155 {
156 $r = $this->getDefaultRenderer();
157 $b = $this->factory->bulky($this->icon, "label", $this->target)
158 ->withAdditionalOnloadCode(function ($id) {
159 return '';
160 });
161
162 $expected = ''
163 . '<a class="il-link link-bulky" href="http://www.ilias.de" id="id_1">'
164 . '<img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>'
165 . ' <span class="bulky-label">label</span>'
166 . '</a>';
167
168 $this->assertHTMLEquals(
169 $expected,
170 $r->render($b)
171 );
172 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References Vendor\Package\$b, $id, and factory().

+ Here is the call graph for this function:

◆ testRenderWithAriaRoleMenuitem()

BulkyLinkTest::testRenderWithAriaRoleMenuitem ( )

Definition at line 174 of file BulkyLinkTest.php.

174 : void
175 {
176 $r = $this->getDefaultRenderer();
177 $b = $this->factory->bulky($this->icon, "label", $this->target)
178 ->withAriaRole(I\Button\Bulky::MENUITEM);
179
180 $expected = ''
181 . '<a class="il-link link-bulky" href="http://www.ilias.de" role="menuitem">'
182 . '<img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>'
183 . ' <span class="bulky-label">label</span>'
184 . '</a>';
185
186 $this->assertHTMLEquals(
187 $expected,
188 $r->render($b)
189 );
190 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderWithDuplicateRelationship()

BulkyLinkTest::testRenderWithDuplicateRelationship ( )

Definition at line 272 of file BulkyLinkTest.php.

272 : void
273 {
274 $r = $this->getDefaultRenderer();
275 $b = $this->factory->bulky($this->icon, "label", $this->target)
276 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE)
277 ->withAdditionalRelationshipToReferencedResource(Relationship::NOOPENER)
278 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE);
279
280 $expected_html = <<<EXP
281 <a class="il-link link-bulky" href="http://www.ilias.de" rel="license noopener">
282 <img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>
283 <span class="bulky-label">label</span>
284 </a>
285EXP;
286
287 $html = $r->render($b);
288 $this->assertHTMLEquals($expected_html, $html);
289 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderWithHelpTopic()

BulkyLinkTest::testRenderWithHelpTopic ( )

Definition at line 234 of file BulkyLinkTest.php.

234 : void
235 {
236 $r = $this->getDefaultRenderer();
237 $b = $this->factory->bulky($this->icon, "label", $this->target)
238 ->withHelpTopics(new \ILIAS\UI\Help\Topic("a"));
239
240 $html = $r->render($b);
241 $expected_html = <<<EXP
242 <div class="c-tooltip__container">
243 <a class="il-link link-bulky" aria-describedby="id_1" href="http://www.ilias.de" id="id_2">
244 <img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt="" />
245 <span class="bulky-label">label</span>
246 </a>
247 <div id="id_1" role="tooltip" class="c-tooltip c-tooltip--hidden"><p>tooltip: a</p></div>
248 </div>
249EXP;
250
251 $this->assertHTMLEquals($expected_html, $html);
252 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderWithLabelAndAltImageSame()

BulkyLinkTest::testRenderWithLabelAndAltImageSame ( )

Definition at line 192 of file BulkyLinkTest.php.

192 : void
193 {
194 $r = $this->getDefaultRenderer();
195 $b = $this->factory->bulky($this->icon, "Example", $this->target)
196 ->withAriaRole(I\Button\Bulky::MENUITEM);
197
198 $expected = ''
199 . '<a class="il-link link-bulky" href="http://www.ilias.de" role="menuitem">'
200 . '<img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>'
201 . ' <span class="bulky-label">Example</span>'
202 . '</a>';
203
204 $this->assertHTMLEquals(
205 $expected,
206 $r->render($b)
207 );
208 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderWithLanguage()

BulkyLinkTest::testRenderWithLanguage ( )

Definition at line 210 of file BulkyLinkTest.php.

210 : void
211 {
212 $language = $this->getMockBuilder(LanguageTag::class)->getMock();
213 $language->method('__toString')->willReturn('en');
214 $reference = $this->getMockBuilder(LanguageTag::class)->getMock();
215 $reference->method('__toString')->willReturn('fr');
216
217 $r = $this->getDefaultRenderer();
218 $b = $this->factory->bulky($this->icon, "label", $this->target)
219 ->withContentLanguage($language)
220 ->withLanguageOfReferencedContent($reference);
221
222 $expected = ''
223 . '<a lang="en" hreflang="fr" class="il-link link-bulky" href="http://www.ilias.de">'
224 . '<img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>'
225 . ' <span class="bulky-label">label</span>'
226 . '</a>';
227
228 $this->assertHTMLEquals(
229 $expected,
230 $r->render($b)
231 );
232 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testRenderWithRelationships()

BulkyLinkTest::testRenderWithRelationships ( )

Definition at line 254 of file BulkyLinkTest.php.

254 : void
255 {
256 $r = $this->getDefaultRenderer();
257 $b = $this->factory->bulky($this->icon, "label", $this->target)
258 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE)
259 ->withAdditionalRelationshipToReferencedResource(Relationship::NOOPENER);
260
261 $expected_html = <<<EXP
262 <a class="il-link link-bulky" href="http://www.ilias.de" rel="license noopener">
263 <img class="icon someExample small" src="./assets/images/standard/icon_default.svg" alt=""/>
264 <span class="bulky-label">label</span>
265 </a>
266EXP;
267
268 $html = $r->render($b);
269 $this->assertHTMLEquals($expected_html, $html);
270 }

References Vendor\Package\$b, and factory().

+ Here is the call graph for this function:

◆ testWithAriaRole()

BulkyLinkTest::testWithAriaRole ( )

Definition at line 61 of file BulkyLinkTest.php.

61 : void
62 {
63 try {
64 $b = $this->factory->bulky($this->glyph, "label", $this->target)
65 ->withAriaRole(I\Button\Bulky::MENUITEM);
66 $this->assertEquals("menuitem", $b->getAriaRole());
67 } catch (\InvalidArgumentException $e) {
68 $this->assertFalse("This should not happen");
69 }
70 }

References Vendor\Package\$b, Vendor\Package\$e, and factory().

+ Here is the call graph for this function:

◆ testWithAriaRoleIncorrect()

BulkyLinkTest::testWithAriaRoleIncorrect ( )

Definition at line 72 of file BulkyLinkTest.php.

72 : void
73 {
74 try {
75 $this->factory->bulky($this->glyph, "label", $this->target)
76 ->withAriaRole("loremipsum");
77 $this->assertFalse("This should not happen");
78 } catch (\InvalidArgumentException $e) {
79 $this->assertTrue(true);
80 }
81 }

References Vendor\Package\$e, and factory().

+ Here is the call graph for this function:

◆ testWrongConstruction()

BulkyLinkTest::testWrongConstruction ( )

Definition at line 55 of file BulkyLinkTest.php.

55 : void
56 {
57 $this->expectException(\TypeError::class);
58 $this->factory->bulky('wrong param', "label", $this->target);
59 }

References factory().

+ Here is the call graph for this function:

Field Documentation

◆ $factory

I Link Factory BulkyLinkTest::$factory
protected

Definition at line 35 of file BulkyLinkTest.php.

◆ $glyph

I Symbol Glyph Glyph BulkyLinkTest::$glyph
protected

Definition at line 36 of file BulkyLinkTest.php.

◆ $icon

I Symbol Icon Standard BulkyLinkTest::$icon
protected

Definition at line 37 of file BulkyLinkTest.php.

◆ $target

Data URI BulkyLinkTest::$target
protected

Definition at line 38 of file BulkyLinkTest.php.


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