Testing behavior of the Bulky Link.
More...
Testing behavior of the Bulky Link.
Definition at line 33 of file BulkyLinkTest.php.
◆ setUp()
Definition at line 40 of file BulkyLinkTest.php.
References factory().
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");
◆ testBulkyLinkRenderWithDisabled()
BulkyLinkTest::testBulkyLinkRenderWithDisabled |
( |
| ) |
|
◆ testGetAction()
BulkyLinkTest::testGetAction |
( |
| ) |
|
Definition at line 98 of file BulkyLinkTest.php.
References factory().
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;
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);
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());
◆ testGetGlyphSymbol()
BulkyLinkTest::testGetGlyphSymbol |
( |
| ) |
|
Definition at line 90 of file BulkyLinkTest.php.
References factory().
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());
◆ testGetLabell()
BulkyLinkTest::testGetLabell |
( |
| ) |
|
Definition at line 83 of file BulkyLinkTest.php.
References factory().
85 $label =
'some label for the link';
86 $link = $this->
factory->bulky($this->glyph, $label, $this->target);
87 $this->assertEquals($label, $link->getLabel());
◆ testImplementsInterfaces()
BulkyLinkTest::testImplementsInterfaces |
( |
| ) |
|
Definition at line 48 of file BulkyLinkTest.php.
References factory().
50 $link = $this->
factory->bulky($this->glyph,
"label", $this->target);
51 $this->assertInstanceOf(
C\Bulky::class, $link);
52 $this->assertInstanceOf(
C\Link::class, $link);
◆ testRenderingGlyph()
BulkyLinkTest::testRenderingGlyph |
( |
| ) |
|
Definition at line 119 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
121 $r = $this->getDefaultRenderer();
122 $b = $this->
factory->bulky($this->glyph,
"label", $this->target);
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>' 129 .
' <span class="bulky-label">label</span>' 132 $this->assertHTMLEquals(
◆ testRenderingIcon()
BulkyLinkTest::testRenderingIcon |
( |
| ) |
|
Definition at line 138 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
140 $r = $this->getDefaultRenderer();
141 $b = $this->
factory->bulky($this->icon,
"label", $this->target);
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>' 149 $this->assertHTMLEquals(
◆ testRenderingWithId()
BulkyLinkTest::testRenderingWithId |
( |
| ) |
|
Definition at line 154 of file BulkyLinkTest.php.
References Vendor\Package\$b, $id, $r, and factory().
156 $r = $this->getDefaultRenderer();
157 $b = $this->
factory->bulky($this->icon,
"label", $this->target)
158 ->withAdditionalOnloadCode(
function (
$id) {
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>' 168 $this->assertHTMLEquals(
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
◆ testRenderWithAriaRoleMenuitem()
BulkyLinkTest::testRenderWithAriaRoleMenuitem |
( |
| ) |
|
Definition at line 174 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
176 $r = $this->getDefaultRenderer();
177 $b = $this->
factory->bulky($this->icon,
"label", $this->target)
178 ->withAriaRole(
I\
Button\Bulky::MENUITEM);
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>' 186 $this->assertHTMLEquals(
◆ testRenderWithDuplicateRelationship()
BulkyLinkTest::testRenderWithDuplicateRelationship |
( |
| ) |
|
Definition at line 272 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
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);
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>
287 $html =
$r->render(
$b);
288 $this->assertHTMLEquals($expected_html, $html);
◆ testRenderWithHelpTopic()
BulkyLinkTest::testRenderWithHelpTopic |
( |
| ) |
|
Definition at line 234 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
236 $r = $this->getDefaultRenderer();
237 $b = $this->
factory->bulky($this->icon,
"label", $this->target)
238 ->withHelpTopics(
new \
ILIAS\
UI\Help\Topic(
"a"));
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>
247 <div
id=
"id_1" role=
"tooltip" class=
"c-tooltip c-tooltip--hidden"><p>tooltip: a</p></div>
251 $this->assertHTMLEquals($expected_html, $html);
Interface Observer Contains several chained tasks and infos about them.
◆ testRenderWithLabelAndAltImageSame()
BulkyLinkTest::testRenderWithLabelAndAltImageSame |
( |
| ) |
|
Definition at line 192 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
194 $r = $this->getDefaultRenderer();
195 $b = $this->
factory->bulky($this->icon,
"Example", $this->target)
196 ->withAriaRole(
I\
Button\Bulky::MENUITEM);
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>' 204 $this->assertHTMLEquals(
◆ testRenderWithLanguage()
BulkyLinkTest::testRenderWithLanguage |
( |
| ) |
|
Definition at line 210 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
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');
217 $r = $this->getDefaultRenderer();
218 $b = $this->
factory->bulky($this->icon,
"label", $this->target)
219 ->withContentLanguage($language)
220 ->withLanguageOfReferencedContent($reference);
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>' 228 $this->assertHTMLEquals(
◆ testRenderWithRelationships()
BulkyLinkTest::testRenderWithRelationships |
( |
| ) |
|
Definition at line 254 of file BulkyLinkTest.php.
References Vendor\Package\$b, $r, and factory().
256 $r = $this->getDefaultRenderer();
257 $b = $this->
factory->bulky($this->icon,
"label", $this->target)
258 ->withAdditionalRelationshipToReferencedResource(Relationship::LICENSE)
259 ->withAdditionalRelationshipToReferencedResource(Relationship::NOOPENER);
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>
268 $html =
$r->render(
$b);
269 $this->assertHTMLEquals($expected_html, $html);
◆ testWithAriaRole()
BulkyLinkTest::testWithAriaRole |
( |
| ) |
|
◆ testWithAriaRoleIncorrect()
BulkyLinkTest::testWithAriaRoleIncorrect |
( |
| ) |
|
Definition at line 72 of file BulkyLinkTest.php.
References Vendor\Package\$e, and factory().
75 $this->
factory->bulky($this->glyph,
"label", $this->target)
76 ->withAriaRole(
"loremipsum");
77 $this->assertFalse(
"This should not happen");
79 $this->assertTrue(
true);
◆ testWrongConstruction()
BulkyLinkTest::testWrongConstruction |
( |
| ) |
|
Definition at line 55 of file BulkyLinkTest.php.
References factory().
57 $this->expectException(\TypeError::class);
58 $this->
factory->bulky(
'wrong param',
"label", $this->target);
◆ $factory
◆ $glyph
I Symbol Glyph Glyph BulkyLinkTest::$glyph |
|
protected |
◆ $icon
I Symbol Icon Standard BulkyLinkTest::$icon |
|
protected |
◆ $target
The documentation for this class was generated from the following file: