ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
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 ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Testing behavior of the Bulky Link.

Definition at line 31 of file BulkyLinkTest.php.

Member Function Documentation

◆ setUp()

BulkyLinkTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 38 of file BulkyLinkTest.php.

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

◆ testGetAction()

BulkyLinkTest::testGetAction ( )

Definition at line 96 of file BulkyLinkTest.php.

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

◆ testGetGlyphSymbol()

BulkyLinkTest::testGetGlyphSymbol ( )

Definition at line 88 of file BulkyLinkTest.php.

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

◆ testGetLabell()

BulkyLinkTest::testGetLabell ( )

Definition at line 81 of file BulkyLinkTest.php.

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

◆ testImplementsInterfaces()

BulkyLinkTest::testImplementsInterfaces ( )

Definition at line 46 of file BulkyLinkTest.php.

46 : void
47 {
48 $link = $this->factory->bulky($this->glyph, "label", $this->target);
49 $this->assertInstanceOf(C\Bulky::class, $link);
50 $this->assertInstanceOf(C\Link::class, $link);
51 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testRenderingGlyph()

BulkyLinkTest::testRenderingGlyph ( )

Definition at line 117 of file BulkyLinkTest.php.

117 : void
118 {
119 $r = $this->getDefaultRenderer();
120 $b = $this->factory->bulky($this->glyph, "label", $this->target);
121
122 $expected = ''
123 . '<a class="il-link link-bulky" href="http://www.ilias.de">'
124 . ' <span class="glyph" role="img">'
125 . ' <span class="glyphicon glyphicon-briefcase" aria-hidden="true"></span>'
126 . ' </span>'
127 . ' <span class="bulky-label">label</span>'
128 . '</a>';
129
130 $this->assertHTMLEquals(
131 $expected,
132 $r->render($b)
133 );
134 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingIcon()

BulkyLinkTest::testRenderingIcon ( )

Definition at line 136 of file BulkyLinkTest.php.

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

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderingWithId()

BulkyLinkTest::testRenderingWithId ( )

Definition at line 152 of file BulkyLinkTest.php.

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

References Vendor\Package\$b, $id, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderWithAriaRoleMenuitem()

BulkyLinkTest::testRenderWithAriaRoleMenuitem ( )

Definition at line 172 of file BulkyLinkTest.php.

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

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testRenderWithLabelAndAltImageSame()

BulkyLinkTest::testRenderWithLabelAndAltImageSame ( )

Definition at line 190 of file BulkyLinkTest.php.

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

References Vendor\Package\$b, ILIAS_UI_TestBase\assertHTMLEquals(), and ILIAS_UI_TestBase\getDefaultRenderer().

+ Here is the call graph for this function:

◆ testWithAriaRole()

BulkyLinkTest::testWithAriaRole ( )

Definition at line 59 of file BulkyLinkTest.php.

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

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

◆ testWithAriaRoleIncorrect()

BulkyLinkTest::testWithAriaRoleIncorrect ( )

Definition at line 70 of file BulkyLinkTest.php.

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

References Vendor\Package\$e.

◆ testWrongConstruction()

BulkyLinkTest::testWrongConstruction ( )

Definition at line 53 of file BulkyLinkTest.php.

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

Field Documentation

◆ $factory

I Link Factory BulkyLinkTest::$factory
protected

Definition at line 33 of file BulkyLinkTest.php.

◆ $glyph

I Symbol Glyph Glyph BulkyLinkTest::$glyph
protected

Definition at line 34 of file BulkyLinkTest.php.

◆ $icon

I Symbol Icon Standard BulkyLinkTest::$icon
protected

Definition at line 35 of file BulkyLinkTest.php.

◆ $target

Data URI BulkyLinkTest::$target
protected

Definition at line 36 of file BulkyLinkTest.php.


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