ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ItemShyTest Class Reference

Test items shy. More...

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

Public Member Functions

 getFactory ()
 
 testImplementsFactoryInterface ()
 
 testWithDescription ()
 
 testWithProperty ()
 
 testWithClose ()
 
 testWithLeadIcon ()
 
 testRenderBase ()
 
 testRenderCritical ()
 
 testRenderWithDescription ()
 
 testRenderWithProperty ()
 
 testRenderWithLeadIcon ()
 
 testRenderWithClose ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 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

Test items shy.

Definition at line 30 of file ItemShyTest.php.

Member Function Documentation

◆ getFactory()

ItemShyTest::getFactory ( )

Definition at line 32 of file ItemShyTest.php.

Referenced by testImplementsFactoryInterface(), testRenderBase(), testRenderCritical(), testWithClose(), testWithDescription(), testWithLeadIcon(), and testWithProperty().

32  : C\Item\Factory
33  {
34  return new I\Component\Item\Factory();
35  }
+ Here is the caller graph for this function:

◆ testImplementsFactoryInterface()

ItemShyTest::testImplementsFactoryInterface ( )

Definition at line 37 of file ItemShyTest.php.

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

37  : void
38  {
39  $f = $this->getFactory();
40 
41  $shy = $f->shy('shy');
42 
43  $this->assertInstanceOf('ILIAS\\UI\\Component\\Item\\Shy', $shy);
44  }
+ Here is the call graph for this function:

◆ testRenderBase()

ItemShyTest::testRenderBase ( )

Definition at line 76 of file ItemShyTest.php.

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

76  : void
77  {
78  $c = $this->getFactory()->shy('shy');
79 
80  $expected = <<<EOT
81 <div class="il-item il-item-shy">
82  <div class="content">
83  <div class="il-item-title">shy</div>
84  </div>
85 </div>
86 EOT;
87 
88  $this->assertHTMLEquals(
89  $this->brutallyTrimHTML($expected),
90  $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
91  );
92  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458
+ Here is the call graph for this function:

◆ testRenderCritical()

ItemShyTest::testRenderCritical ( )

Definition at line 94 of file ItemShyTest.php.

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

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

◆ testRenderWithClose()

ItemShyTest::testRenderWithClose ( )

Definition at line 176 of file ItemShyTest.php.

176  : void
177  {
178  $c = $this->getFactory()->shy('shy')->withClose(new I\Component\Button\Close());
179 
180  $expected = <<<EOT
181 <div class="il-item il-item-shy">
182  <div class="content">
183  <div class="il-item-title">shy</div>
184  <button type="button" class="close" aria-label="close">
185  <span aria-hidden="true">&times;</span>
186  </button>
187  </div>
188 </div>
189 EOT;
190 
191  $this->assertEquals(
192  $this->brutallyTrimHTML($expected),
193  $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
194  );
195  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
button(string $caption, string $cmd)
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...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475

◆ testRenderWithDescription()

ItemShyTest::testRenderWithDescription ( )

Definition at line 112 of file ItemShyTest.php.

112  : void
113  {
114  $c = $this->getFactory()->shy('shy')->withDescription('This is a shy');
115 
116  $expected = <<<EOT
117 <div class="il-item il-item-shy">
118  <div class="content">
119  <div class="il-item-title">shy</div>
120  <div class="il-item-description">This is a shy</div>
121  </div>
122 </div>
123 EOT;
124 
125  $this->assertHTMLEquals(
126  $this->brutallyTrimHTML($expected),
127  $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
128  );
129  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458

◆ testRenderWithLeadIcon()

ItemShyTest::testRenderWithLeadIcon ( )

Definition at line 155 of file ItemShyTest.php.

155  : void
156  {
157  $c = $this->getFactory()->shy('shy')->withLeadIcon(
158  new I\Component\Symbol\Icon\Standard('name', 'aria_label', 'small', false)
159  );
160 
161  $expected = <<<EOT
162 <div class="il-item il-item-shy">
163  <img class="icon name small" src="./templates/default/images/standard/icon_default.svg" alt="aria_label" />
164  <div class="content">
165  <div class="il-item-title">shy</div>
166  </div>
167 </div>
168 EOT;
169 
170  $this->assertHTMLEquals(
171  $this->brutallyTrimHTML($expected),
172  $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
173  );
174  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
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...
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458

◆ testRenderWithProperty()

ItemShyTest::testRenderWithProperty ( )

Definition at line 131 of file ItemShyTest.php.

131  : void
132  {
133  $c = $this->getFactory()->shy('shy')->withProperties(['name' => 'value']);
134 
135  $expected = <<<EOT
136 <div class="il-item il-item-shy">
137  <div class="content">
138  <div class="il-item-title">shy</div>
139  <hr class="il-item-divider" />
140  <div class="il-item-properties">
141  <div class="il-item-property-name">name</div>
142  <div class="il-item-property-value">value</div>
143  </div>
144  </div>
145 </div>
146 EOT;
147 
148  $this->assertHTMLEquals(
149  $this->brutallyTrimHTML($expected),
150  $this->brutallyTrimHTML($this->getDefaultRenderer()->render($c))
151  );
152  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:458

◆ testWithClose()

ItemShyTest::testWithClose ( )

Definition at line 60 of file ItemShyTest.php.

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

60  : void
61  {
62  $f = $this->getFactory();
63  $c = $f->shy('shy')->withClose((new I\Component\Button\Factory())->close());
64  $this->assertInstanceOf(I\Component\Button\Close::class, $c->getClose());
65  }
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...
+ Here is the call graph for this function:

◆ testWithDescription()

ItemShyTest::testWithDescription ( )

Definition at line 46 of file ItemShyTest.php.

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

46  : void
47  {
48  $f = $this->getFactory();
49  $c = $f->shy('shy')->withDescription('This is a shy');
50  $this->assertEquals('This is a shy', $c->getDescription());
51  }
+ Here is the call graph for this function:

◆ testWithLeadIcon()

ItemShyTest::testWithLeadIcon ( )

Definition at line 67 of file ItemShyTest.php.

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

67  : void
68  {
69  $f = $this->getFactory();
70  $c = $f->shy('shy')->withLeadIcon(
71  (new I\Component\Symbol\Icon\Factory())->standard('name', 'label')
72  );
73  $this->assertInstanceOf(I\Component\Symbol\Icon\Icon::class, $c->getLeadIcon());
74  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it...
Definition: standard.php:16
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testWithProperty()

ItemShyTest::testWithProperty ( )

Definition at line 53 of file ItemShyTest.php.

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

53  : void
54  {
55  $f = $this->getFactory();
56  $c = $f->shy('shy')->withProperties(['name' => 'value']);
57  $this->assertEquals(['name' => 'value'], $c->getProperties());
58  }
+ Here is the call graph for this function:

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