ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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  }

◆ testBulkyLinkRenderWithDisabled()

BulkyLinkTest::testBulkyLinkRenderWithDisabled ( )

Definition at line 291 of file BulkyLinkTest.php.

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

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>
301 EXP;
302  $this->assertHTMLEquals($expected_html, $r->render($b));
303  }
disabled()
description: > Example showing how to plug a disabled checkbox into a form
Definition: disabled.php:16
$r
+ 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  }

◆ 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  }

◆ 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  }

◆ 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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testRenderingGlyph()

BulkyLinkTest::testRenderingGlyph ( )

Definition at line 119 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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  }
$r

◆ testRenderingIcon()

BulkyLinkTest::testRenderingIcon ( )

Definition at line 138 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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  }
$r

◆ testRenderingWithId()

BulkyLinkTest::testRenderingWithId ( )

Definition at line 154 of file BulkyLinkTest.php.

References Vendor\Package\$b, $id, and $r.

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:24
$r

◆ testRenderWithAriaRoleMenuitem()

BulkyLinkTest::testRenderWithAriaRoleMenuitem ( )

Definition at line 174 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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  }
$r

◆ testRenderWithDuplicateRelationship()

BulkyLinkTest::testRenderWithDuplicateRelationship ( )

Definition at line 272 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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>
285 EXP;
286 
287  $html = $r->render($b);
288  $this->assertHTMLEquals($expected_html, $html);
289  }
$r

◆ testRenderWithHelpTopic()

BulkyLinkTest::testRenderWithHelpTopic ( )

Definition at line 234 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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>
249 EXP;
250 
251  $this->assertHTMLEquals($expected_html, $html);
252  }
Interface Observer Contains several chained tasks and infos about them.
$r

◆ testRenderWithLabelAndAltImageSame()

BulkyLinkTest::testRenderWithLabelAndAltImageSame ( )

Definition at line 192 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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  }
$r

◆ testRenderWithLanguage()

BulkyLinkTest::testRenderWithLanguage ( )

Definition at line 210 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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  }
$r

◆ testRenderWithRelationships()

BulkyLinkTest::testRenderWithRelationships ( )

Definition at line 254 of file BulkyLinkTest.php.

References Vendor\Package\$b, and $r.

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>
266 EXP;
267 
268  $html = $r->render($b);
269  $this->assertHTMLEquals($expected_html, $html);
270  }
$r

◆ testWithAriaRole()

BulkyLinkTest::testWithAriaRole ( )

Definition at line 61 of file BulkyLinkTest.php.

References Vendor\Package\$b, and Vendor\Package\$e.

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  }

◆ testWithAriaRoleIncorrect()

BulkyLinkTest::testWithAriaRoleIncorrect ( )

Definition at line 72 of file BulkyLinkTest.php.

References Vendor\Package\$e.

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  }

◆ 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  }

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: