ILIAS  release_8 Revision v8.24
ItemShyTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ItemShyTest:
+ Collaboration diagram for ItemShyTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_with_description ()
 
 test_with_property ()
 
 test_with_close ()
 
 test_with_lead_icon ()
 
 test_render_base ()
 
 test_render_critical ()
 
 test_render_with_description ()
 
 test_render_with_property ()
 
 test_render_with_lead_icon ()
 
 test_render_with_close ()
 
- 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)
 

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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Test items shy

Definition at line 29 of file ItemShyTest.php.

Member Function Documentation

◆ getFactory()

ItemShyTest::getFactory ( )

Definition at line 31 of file ItemShyTest.php.

31 : C\Item\Factory
32 {
33 return new I\Component\Item\Factory();
34 }

Referenced by test_implements_factory_interface(), test_render_base(), test_render_critical(), test_with_close(), test_with_description(), test_with_lead_icon(), and test_with_property().

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

ItemShyTest::test_implements_factory_interface ( )

Definition at line 36 of file ItemShyTest.php.

36 : void
37 {
38 $f = $this->getFactory();
39
40 $shy = $f->shy('shy');
41
42 $this->assertInstanceOf('ILIAS\\UI\\Component\\Item\\Shy', $shy);
43 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_render_base()

ItemShyTest::test_render_base ( )

Definition at line 75 of file ItemShyTest.php.

75 : void
76 {
77 $c = $this->getFactory()->shy('shy');
78
79 $expected = <<<EOT
80<div class="il-item il-item-shy">
81 <div class="content">
82 <div class="il-item-title">shy</div>
83 </div>
84</div>
85EOT;
86
87 $this->assertHTMLEquals(
88 $this->brutallyTrimHTML($expected),
89 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
90 );
91 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
$c
Definition: cli.php:38

References $c, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_critical()

ItemShyTest::test_render_critical ( )

Definition at line 93 of file ItemShyTest.php.

93 : void
94 {
95 $c = $this->getFactory()->shy('noid"><script>alert(\'CRITICAL\')</script');
96
97 $expected = <<<EOT
98<div class="il-item il-item-shy">
99 <div class="content">
100 <div class="il-item-title">noid"&gt;&lt;script&gt;alert('CRITICAL')&lt;/script</div>
101 </div>
102</div>
103EOT;
104
105 $this->assertHTMLEquals(
106 $this->brutallyTrimHTML($expected),
107 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
108 );
109 }

References $c, and getFactory().

+ Here is the call graph for this function:

◆ test_render_with_close()

ItemShyTest::test_render_with_close ( )

Definition at line 175 of file ItemShyTest.php.

175 : void
176 {
177 $c = $this->getFactory()->shy('shy')->withClose(new I\Component\Button\Close());
178
179 $expected = <<<EOT
180<div class="il-item il-item-shy">
181 <div class="content">
182 <div class="il-item-title">shy</div>
183 <button type="button" class="close" aria-label="close">
184 <span aria-hidden="true">&times;</span>
185 </button>
186 </div>
187</div>
188EOT;
189
190 $this->assertEquals(
191 $this->brutallyTrimHTML($expected),
192 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
193 );
194 }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ test_render_with_description()

ItemShyTest::test_render_with_description ( )

Definition at line 111 of file ItemShyTest.php.

111 : void
112 {
113 $c = $this->getFactory()->shy('shy')->withDescription('This is a shy');
114
115 $expected = <<<EOT
116<div class="il-item il-item-shy">
117 <div class="content">
118 <div class="il-item-title">shy</div>
119 <div class="il-item-description">This is a shy</div>
120 </div>
121</div>
122EOT;
123
124 $this->assertHTMLEquals(
125 $this->brutallyTrimHTML($expected),
126 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
127 );
128 }

◆ test_render_with_lead_icon()

ItemShyTest::test_render_with_lead_icon ( )

Definition at line 154 of file ItemShyTest.php.

154 : void
155 {
156 $c = $this->getFactory()->shy('shy')->withLeadIcon(
157 new I\Component\Symbol\Icon\Standard('name', 'aria_label', 'small', false)
158 );
159
160 $expected = <<<EOT
161<div class="il-item il-item-shy">
162 <img class="icon name small" src="./templates/default/images/icon_default.svg" alt="aria_label" />
163 <div class="content">
164 <div class="il-item-title">shy</div>
165 </div>
166</div>
167EOT;
168
169 $this->assertHTMLEquals(
170 $this->brutallyTrimHTML($expected),
171 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
172 );
173 }

◆ test_render_with_property()

ItemShyTest::test_render_with_property ( )

Definition at line 130 of file ItemShyTest.php.

130 : void
131 {
132 $c = $this->getFactory()->shy('shy')->withProperties(['name' => 'value']);
133
134 $expected = <<<EOT
135<div class="il-item il-item-shy">
136 <div class="content">
137 <div class="il-item-title">shy</div>
138 <hr class="il-item-divider" />
139 <div class="il-item-properties">
140 <div class="il-item-property-name">name</div>
141 <div class="il-item-property-value">value</div>
142 </div>
143 </div>
144</div>
145EOT;
146
147 $this->assertHTMLEquals(
148 $this->brutallyTrimHTML($expected),
149 $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
150 );
151 }

◆ test_with_close()

ItemShyTest::test_with_close ( )

Definition at line 59 of file ItemShyTest.php.

59 : void
60 {
61 $f = $this->getFactory();
62 $c = $f->shy('shy')->withClose((new I\Component\Button\Factory())->close());
63 $this->assertInstanceOf(I\Component\Button\Close::class, $c->getClose());
64 }

References $c, Vendor\Package\$f, ILIAS\UI\examples\Symbol\Glyph\Close\close(), and getFactory().

+ Here is the call graph for this function:

◆ test_with_description()

ItemShyTest::test_with_description ( )

Definition at line 45 of file ItemShyTest.php.

45 : void
46 {
47 $f = $this->getFactory();
48 $c = $f->shy('shy')->withDescription('This is a shy');
49 $this->assertEquals('This is a shy', $c->getDescription());
50 }

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_with_lead_icon()

ItemShyTest::test_with_lead_icon ( )

Definition at line 66 of file ItemShyTest.php.

66 : void
67 {
68 $f = $this->getFactory();
69 $c = $f->shy('shy')->withLeadIcon(
70 (new I\Component\Symbol\Icon\Factory())->standard('name', 'label')
71 );
72 $this->assertInstanceOf(I\Component\Symbol\Icon\Icon::class, $c->getLeadIcon());
73 }
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:16

References $c, Vendor\Package\$f, getFactory(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

+ Here is the call graph for this function:

◆ test_with_property()

ItemShyTest::test_with_property ( )

Definition at line 52 of file ItemShyTest.php.

52 : void
53 {
54 $f = $this->getFactory();
55 $c = $f->shy('shy')->withProperties(['name' => 'value']);
56 $this->assertEquals(['name' => 'value'], $c->getProperties());
57 }

References $c, Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

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