ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ImageTest Class Reference

Test on button implementation. More...

+ Inheritance diagram for ImageTest:
+ Collaboration diagram for ImageTest:

Public Member Functions

 getImageFactory ()
 
 testImplementsFactoryInterface ()
 
 testGetType ()
 
 testGetSource ()
 
 testGetAlt ()
 
 testSetSource ()
 
 testSetAlt ()
 
 testSetStringAction ()
 
 testSetSignalAction ()
 
 testSetAdditionalHighResSources ()
 
 testInvalidSource ()
 
 testInvalidAlt ()
 
 testInvalidAdditionalHighResSource ()
 
 testInvalidAdditionalHighResSourceSize ()
 
 testRenderStandard ()
 
 testRenderResponsive ()
 
 testRenderAltEscaping ()
 
 testRenderWithStringAction ()
 
 testRenderWithSignalAction ()
 
 testWithEmptyActionAndNoAdditionalOnLoadCode ()
 
 testWithAdditionalOnLoadCode ()
 

Detailed Description

Test on button implementation.

Definition at line 31 of file ImageTest.php.

Member Function Documentation

◆ getImageFactory()

◆ testGetAlt()

ImageTest::testGetAlt ( )

Definition at line 67 of file ImageTest.php.

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

67  : void
68  {
69  $f = $this->getImageFactory();
70  $i = $f->standard("source", "alt");
71 
72  $this->assertEquals("alt", $i->getAlt());
73  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testGetSource()

ImageTest::testGetSource ( )

Definition at line 59 of file ImageTest.php.

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

59  : void
60  {
61  $f = $this->getImageFactory();
62  $i = $f->standard("source", "alt");
63 
64  $this->assertEquals("source", $i->getSource());
65  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testGetType()

ImageTest::testGetType ( )

Definition at line 51 of file ImageTest.php.

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

51  : void
52  {
53  $f = $this->getImageFactory();
54  $i = $f->standard("source", "alt");
55 
56  $this->assertEquals($i::STANDARD, $i->getType());
57  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

ImageTest::testImplementsFactoryInterface ( )

Definition at line 42 of file ImageTest.php.

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

42  : void
43  {
44  $f = $this->getImageFactory();
45 
46  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Factory", $f);
47  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->standard("source", "alt"));
48  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->responsive("source", "alt"));
49  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testInvalidAdditionalHighResSource()

ImageTest::testInvalidAdditionalHighResSource ( )

Definition at line 136 of file ImageTest.php.

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

136  : void
137  {
138  $this->expectException(TypeError::class);
139  $f = $this->getImageFactory();
140  $f->standard("source", 1)->withAdditionalHighResSource(
141  1,
142  1
143  );
144  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testInvalidAdditionalHighResSourceSize()

ImageTest::testInvalidAdditionalHighResSourceSize ( )

Definition at line 146 of file ImageTest.php.

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

146  : void
147  {
148  $this->expectException(TypeError::class);
149  $f = $this->getImageFactory();
150  $f->standard("source", 1)->withAdditionalHighResSource(
151  '#',
152  '#'
153  );
154  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testInvalidAlt()

ImageTest::testInvalidAlt ( )

Definition at line 129 of file ImageTest.php.

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

129  : void
130  {
131  $this->expectException(TypeError::class);
132  $f = $this->getImageFactory();
133  $f->standard("source", 1);
134  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testInvalidSource()

ImageTest::testInvalidSource ( )

Definition at line 122 of file ImageTest.php.

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

122  : void
123  {
124  $this->expectException(TypeError::class);
125  $f = $this->getImageFactory();
126  $f->standard(1, "alt");
127  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testRenderAltEscaping()

ImageTest::testRenderAltEscaping ( )

Definition at line 182 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

182  : void
183  {
184  $f = $this->getImageFactory();
185  $r = $this->getDefaultRenderer();
186  $i = $f->responsive("source", "\"=test;\")(blah\"");
187 
188  $html = $this->normalizeHTML($r->render($i));
189 
190  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"&quot;=test;&quot;)(blah&quot;\" />";
191 
192  $this->assertEquals($expected, $html);
193  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

◆ testRenderResponsive()

ImageTest::testRenderResponsive ( )

Definition at line 169 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

169  : void
170  {
171  $f = $this->getImageFactory();
172  $r = $this->getDefaultRenderer();
173  $i = $f->responsive("source", "alt");
174 
175  $html = $this->normalizeHTML($r->render($i));
176 
177  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"alt\" />";
178 
179  $this->assertEquals($expected, $html);
180  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

◆ testRenderStandard()

ImageTest::testRenderStandard ( )

Definition at line 156 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

156  : void
157  {
158  $f = $this->getImageFactory();
159  $r = $this->getDefaultRenderer();
160  $i = $f->standard("source", "alt");
161 
162  $html = $this->normalizeHTML($r->render($i));
163 
164  $expected = "<img src=\"source\" class=\"img-standard\" alt=\"alt\" />";
165 
166  $this->assertEquals($expected, $html);
167  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

◆ testRenderWithSignalAction()

ImageTest::testRenderWithSignalAction ( )

Definition at line 208 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

208  : void
209  {
210  $f = $this->getImageFactory();
211  $r = $this->getDefaultRenderer();
212  $signal = $this->createMock(Signal::class);
213 
214  $i = $f->standard("source", "alt")->withAction($signal);
215 
216  $html = $this->normalizeHTML($r->render($i));
217 
218  $expected = "<a href=\"#\" id=\"id_1\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
219 
220  $this->assertEquals($expected, $html);
221  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

◆ testRenderWithStringAction()

ImageTest::testRenderWithStringAction ( )

Definition at line 195 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

195  : void
196  {
197  $f = $this->getImageFactory();
198  $r = $this->getDefaultRenderer();
199  $i = $f->standard("source", "alt")->withAction("action");
200 
201  $html = $this->normalizeHTML($r->render($i));
202 
203  $expected = "<a href=\"action\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
204 
205  $this->assertEquals($expected, $html);
206  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

◆ testSetAdditionalHighResSources()

ImageTest::testSetAdditionalHighResSources ( )

Definition at line 108 of file ImageTest.php.

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

108  : void
109  {
110  $additional_sources = [
111  600 => 'image1',
112  300 => 'image2'
113  ];
114  $f = $this->getImageFactory();
115  $i = $f->standard("source", "alt");
116  foreach($additional_sources as $min_width_in_pixels => $source) {
117  $i = $i->withAdditionalHighResSource($source, $min_width_in_pixels);
118  }
119  $this->assertEquals($additional_sources, $i->getAdditionalHighResSources());
120  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testSetAlt()

ImageTest::testSetAlt ( )

Definition at line 83 of file ImageTest.php.

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

83  : void
84  {
85  $f = $this->getImageFactory();
86  $i = $f->standard("source", "alt");
87  $i = $i->withAlt("newAlt");
88  $this->assertEquals("newAlt", $i->getAlt());
89  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testSetSignalAction()

ImageTest::testSetSignalAction ( )

Definition at line 99 of file ImageTest.php.

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

99  : void
100  {
101  $f = $this->getImageFactory();
102  $signal = $this->createMock(C\Signal::class);
103  $i = $f->standard("source", "alt");
104  $i = $i->withAction($signal);
105  $this->assertEquals([$signal], $i->getAction());
106  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testSetSource()

ImageTest::testSetSource ( )

Definition at line 75 of file ImageTest.php.

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

75  : void
76  {
77  $f = $this->getImageFactory();
78  $i = $f->standard("source", "alt");
79  $i = $i->withSource("newSource");
80  $this->assertEquals("newSource", $i->getSource());
81  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testSetStringAction()

ImageTest::testSetStringAction ( )

Definition at line 91 of file ImageTest.php.

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

91  : void
92  {
93  $f = $this->getImageFactory();
94  $i = $f->standard("source", "alt");
95  $i = $i->withAction("newAction");
96  $this->assertEquals("newAction", $i->getAction());
97  }
getImageFactory()
Definition: ImageTest.php:36
+ Here is the call graph for this function:

◆ testWithAdditionalOnLoadCode()

ImageTest::testWithAdditionalOnLoadCode ( )

Definition at line 237 of file ImageTest.php.

References Vendor\Package\$f, $id, $r, and getImageFactory().

237  : void
238  {
239  $f = $this->getImageFactory();
240  $r = $this->getDefaultRenderer();
241 
242  $i = $f->standard("source", "alt")->withAction("#")->withOnLoadCode(function ($id) {
243  return "Something";
244  });
245 
246  $html = $this->normalizeHTML($r->render($i));
247 
248  $expected = "<a href=\"#\"><img src=\"source\" class=\"img-standard\" id='id_1' alt=\"alt\" /></a>";
249 
250  $this->assertEquals($expected, $html);
251  }
getImageFactory()
Definition: ImageTest.php:36
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$r
+ Here is the call graph for this function:

◆ testWithEmptyActionAndNoAdditionalOnLoadCode()

ImageTest::testWithEmptyActionAndNoAdditionalOnLoadCode ( )

Definition at line 223 of file ImageTest.php.

References Vendor\Package\$f, $r, and getImageFactory().

223  : void
224  {
225  $f = $this->getImageFactory();
226  $r = $this->getDefaultRenderer();
227 
228  $i = $f->standard("source", "alt")->withAction("#");
229 
230  $html = $this->normalizeHTML($r->render($i));
231 
232  $expected = "<a href=\"#\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
233 
234  $this->assertEquals($expected, $html);
235  }
getImageFactory()
Definition: ImageTest.php:36
$r
+ Here is the call graph for this function:

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