ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
RepositoryObjectTest Class Reference

TODO change the custom icons to standard icons Test on Repository Object card implementation. More...

+ Inheritance diagram for RepositoryObjectTest:
+ Collaboration diagram for RepositoryObjectTest:

Public Member Functions

 getFactory ()
 
 test_implements_factory_interface ()
 
 test_with_object_icon ()
 
 test_with_progress ()
 
 test_with_certificate_icon ()
 
 test_with_actions ()
 
 test_render_with_object_icon ()
 
 test_render_with_certificate_icon ()
 
 test_render_with_progressmeter ()
 
 test_render_with_actions ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Private Member Functions

 getCardFactory ()
 
 getBaseCard ()
 

Detailed Description

TODO change the custom icons to standard icons Test on Repository Object card implementation.

Definition at line 15 of file RepositoryObjectTest.php.

Member Function Documentation

◆ getBaseCard()

RepositoryObjectTest::getBaseCard ( )
private

Definition at line 52 of file RepositoryObjectTest.php.

References getCardFactory().

Referenced by test_implements_factory_interface(), test_render_with_actions(), test_render_with_certificate_icon(), test_render_with_object_icon(), test_render_with_progressmeter(), test_with_actions(), test_with_certificate_icon(), test_with_object_icon(), and test_with_progress().

53  {
54  $cf = $this->getCardFactory();
55  $image = new I\Component\Image\Image("standard", "src", "alt");
56 
57  return $cf->repositoryObject("Card Title", $image);
58  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCardFactory()

RepositoryObjectTest::getCardFactory ( )
private

Definition at line 47 of file RepositoryObjectTest.php.

Referenced by getBaseCard().

48  {
49  return new \ILIAS\UI\Implementation\Component\Card\Factory();
50  }
+ Here is the caller graph for this function:

◆ getFactory()

RepositoryObjectTest::getFactory ( )
Returns

Definition at line 21 of file RepositoryObjectTest.php.

Referenced by test_render_with_actions(), and test_with_actions().

22  {
23  return new \ILIAS\UI\Implementation\Factory(
24  $this->createMock(C\Counter\Factory::class),
25  $this->createMock(C\Glyph\Factory::class),
26  $this->createMock(C\Button\Factory::class),
27  $this->createMock(C\Listing\Factory::class),
28  $this->createMock(C\Image\Factory::class),
29  $this->createMock(C\Panel\Factory::class),
30  $this->createMock(C\Modal\Factory::class),
31  $this->createMock(C\Dropzone\Factory::class),
32  $this->createMock(C\Popover\Factory::class),
33  $this->createMock(C\Divider\Factory::class),
34  $this->createMock(C\Link\Factory::class),
35  $this->createMock(C\Dropdown\Factory::class),
36  $this->createMock(C\Item\Factory::class),
37  $this->createMock(C\Icon\Factory::class),
38  $this->createMock(C\ViewControl\Factory::class),
39  $this->createMock(C\Chart\Factory::class),
40  $this->createMock(C\Input\Factory::class),
41  $this->createMock(C\Table\Factory::class),
42  $this->createMock(C\MessageBox\Factory::class),
43  $this->createMock(C\Card\Factory::class)
44  );
45  }
+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

RepositoryObjectTest::test_implements_factory_interface ( )

Definition at line 60 of file RepositoryObjectTest.php.

References getBaseCard().

61  {
62  $this->assertInstanceOf("ILIAS\\UI\\Component\\Card\\RepositoryObject", $this->getBaseCard());
63  }
+ Here is the call graph for this function:

◆ test_render_with_actions()

RepositoryObjectTest::test_render_with_actions ( )

Definition at line 239 of file RepositoryObjectTest.php.

References $c, $f, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), data, getBaseCard(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

240  {
241  $f = $this->getFactory();
242  $r = $this->getDefaultRenderer();
243  $c = $this->getBaseCard();
244  $items = array(
245  new I\Component\Button\Shy("Visit ILIAS", "https://www.ilias.de")
246  );
247  $dropdown = new I\Component\Dropdown\Standard($items);
248  $c = $c->withActions($dropdown);
249  $html = $r->render($c);
250 
251  $expected_html = <<<EOT
252 <div class="il-card thumbnail">
253 
254  <div class="il-card-repository-head">
255  <div>
256 
257  </div>
258  <div>
259 
260  </div>
261  <div class="il-card-repository-dropdown">
262  <div class="dropdown"><button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-label="actions" aria-haspopup="true" aria-expanded="false" > <span class="caret"></span></button>
263 <ul class="dropdown-menu">
264  <li><button class="btn btn-link" data-action="https://www.ilias.de" id="id_1" >Visit ILIAS</button>
265 </li>
266 </ul>
267 </div>
268 
269  </div>
270  </div>
271 <img src="src" class="img-standard" alt="alt" />
272  <div class="card-no-highlight"></div>
273  <div class="caption">
274  <h5 class="card-title">Card Title</h5>
275  </div>
276 
277 </div>
278 EOT;
279 
280  $this->assertHTMLEquals($expected_html, $html);
281  }
Class BaseForm.
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$this data['403_header']
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_certificate_icon()

RepositoryObjectTest::test_render_with_certificate_icon ( )

Definition at line 153 of file RepositoryObjectTest.php.

References $c, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), getBaseCard(), and ILIAS_UI_TestBase\getDefaultRenderer().

154  {
155  $r = $this->getDefaultRenderer();
156  $c = $this->getBaseCard();
157 
158  //TODO get skin fail?
159  $c = $c->withCertificateIcon(true);
160 
161  $html = $r->render($c);
162 
163  $expected_html = <<<EOT
164 <div class="il-card thumbnail">
165 
166  <div class="il-card-repository-head">
167  <div>
168 
169  </div>
170  <div>
171  <div class="icon cert medium outlined" aria-label="Certificate">
172 
173 
174 </div>
175 
176  </div>
177  <div class="il-card-repository-dropdown">
178 
179  </div>
180  </div>
181 <img src="src" class="img-standard" alt="alt" />
182  <div class="card-no-highlight"></div>
183  <div class="caption">
184  <h5 class="card-title">Card Title</h5>
185  </div>
186 
187 </div>
188 EOT;
189 
190  $this->assertHTMLEquals($expected_html, $html);
191  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_object_icon()

RepositoryObjectTest::test_render_with_object_icon ( )

Definition at line 113 of file RepositoryObjectTest.php.

References $c, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), getBaseCard(), and ILIAS_UI_TestBase\getDefaultRenderer().

114  {
115  $r = $this->getDefaultRenderer();
116 
117  $icon = new I\Component\Icon\Standard("crs", 'Course', 'medium', false);
118  $c = $this->getBaseCard();
119  $c = $c->withObjectIcon($icon);
120 
121  $html = $r->render($c);
122 
123  $expected_html = <<<EOT
124 <div class="il-card thumbnail">
125 
126  <div class="il-card-repository-head">
127  <div>
128  <div class="icon crs medium" aria-label="Course">
129 
130 
131 </div>
132 
133  </div>
134  <div>
135 
136  </div>
137  <div class="il-card-repository-dropdown">
138 
139  </div>
140  </div>
141 <img src="src" class="img-standard" alt="alt" />
142  <div class="card-no-highlight"></div>
143  <div class="caption">
144  <h5 class="card-title">Card Title</h5>
145  </div>
146 
147 </div>
148 EOT;
149 
150  $this->assertHTMLEquals($expected_html, $html);
151  }
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_progressmeter()

RepositoryObjectTest::test_render_with_progressmeter ( )

Definition at line 193 of file RepositoryObjectTest.php.

References $c, $html, $r, ILIAS_UI_TestBase\assertHTMLEquals(), getBaseCard(), and ILIAS_UI_TestBase\getDefaultRenderer().

194  {
195  $r = $this->getDefaultRenderer();
196  $c = $this->getBaseCard();
197  $prg = new I\Component\Chart\ProgressMeter\Mini(100, 80);
198  $c = $c->withProgress($prg);
199 
200  $html = $r->render($c);
201 
202  $expected_html = <<<EOT
203 <div class="il-card thumbnail">
204 
205  <div class="il-card-repository-head">
206  <div>
207 
208  </div>
209  <div>
210  <div class="il-chart-progressmeter-box il-chart-progressmeter-mini">
211 <div class="il-chart-progressmeter-container">
212 <svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">
213 <path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100"
214 d="M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>
215 <path class="il-chart-progressmeter-circle no-success" stroke-dasharray="69.2, 100"
216 d="M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>
217 <path class="il-chart-progressmeter-needle no-needle" stroke-dasharray="100, 100"
218 d="M25,10 l0,15" style="transform: rotate(deg)"></path>
219 </svg>
220 </div>
221 </div>
222  </div>
223  <div class="il-card-repository-dropdown">
224 
225  </div>
226  </div>
227 <img src="src" class="img-standard" alt="alt" />
228  <div class="card-no-highlight"></div>
229  <div class="caption">
230  <h5 class="card-title">Card Title</h5>
231  </div>
232 
233 </div>
234 EOT;
235 
236  $this->assertHTMLEquals($expected_html, $html);
237  }
"color:#CC0000 style
Definition: example_001.php:92
Title class.
Definition: Title.php:36
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
$r
Definition: example_031.php:79
assertHTMLEquals($expected_html_as_string, $html_as_string)
Definition: Base.php:270
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_with_actions()

RepositoryObjectTest::test_with_actions ( )

Definition at line 95 of file RepositoryObjectTest.php.

References $f, getBaseCard(), and getFactory().

96  {
97  $f = $this->getFactory();
98  $items = array(
99  $f->button()->shy("Go to Course", "#"),
100  $f->button()->shy("Go to Portfolio", "#"),
101  $f->divider()->horizontal(),
102  $f->button()->shy("ilias.de", "http://www.ilias.de")
103  );
104 
105  $dropdown = new I\Component\Dropdown\Standard($items);
106  $card = $this->getBaseCard();
107  $card = $card->withActions($dropdown);
108 
109  $this->assertInstanceOf("ILIAS\\UI\\Component\\Dropdown\\Standard", $dropdown);
110  $this->assertEquals($card->getActions(), $dropdown);
111  }
+ Here is the call graph for this function:

◆ test_with_certificate_icon()

RepositoryObjectTest::test_with_certificate_icon ( )

Definition at line 84 of file RepositoryObjectTest.php.

References getBaseCard().

85  {
86  $card = $this->getBaseCard();
87  $card_with_cert_true = $card->withCertificateIcon(true);
88  $card_with_cert_false = $card->withCertificateIcon(false);
89 
90  $this->assertNull($card->getCertificateIcon());
91  $this->assertTrue($card_with_cert_true->getCertificateIcon());
92  $this->assertFalse($card_with_cert_false->getCertificateIcon());
93  }
+ Here is the call graph for this function:

◆ test_with_object_icon()

RepositoryObjectTest::test_with_object_icon ( )

Definition at line 65 of file RepositoryObjectTest.php.

References getBaseCard().

66  {
67  $icon = new I\Component\Icon\Standard("crs", 'Course', 'medium', false);
68  $card = $this->getBaseCard();
69  $card = $card->withObjectIcon($icon);
70 
71  $this->assertEquals($card->getObjectIcon(), $icon);
72  }
+ Here is the call graph for this function:

◆ test_with_progress()

RepositoryObjectTest::test_with_progress ( )

Definition at line 74 of file RepositoryObjectTest.php.

References getBaseCard().

75  {
76  $progressmeter = new I\Component\Chart\ProgressMeter\Mini(100, 70);
77  $card = $this->getBaseCard();
78  $card = $card->withProgress($progressmeter);
79 
80  $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Mini", $progressmeter);
81  $this->assertEquals($progressmeter, $card->getProgress());
82  }
+ Here is the call graph for this function:

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