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

Test on button implementation. More...

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

Public Member Functions

 getImageFactory ()
 
 test_implements_factory_interface ()
 
 test_get_type ()
 
 test_get_source ()
 
 test_get_alt ()
 
 test_set_source ()
 
 test_set_alt ()
 
 test_set_string_action ()
 
 test_set_signal_action ()
 
 test_invalid_source ()
 
 test_invalid_alt ()
 
 test_render_standard ()
 
 test_render_responsive ()
 
 test_render_alt_escaping ()
 
 test_render_with_string_action ()
 
 test_render_with_signal_action ()
 
- 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)
 

Detailed Description

Test on button implementation.

Definition at line 14 of file ImageTest.php.

Member Function Documentation

◆ getImageFactory()

ImageTest::getImageFactory ( )

◆ test_get_alt()

ImageTest::test_get_alt ( )

Definition at line 51 of file ImageTest.php.

References $f, $i, and getImageFactory().

52  {
53  $f = $this->getImageFactory();
54  $i = $f->standard("source", "alt");
55 
56  $this->assertEquals("alt", $i->getAlt());
57  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_get_source()

ImageTest::test_get_source ( )

Definition at line 43 of file ImageTest.php.

References $f, $i, and getImageFactory().

44  {
45  $f = $this->getImageFactory();
46  $i = $f->standard("source", "alt");
47 
48  $this->assertEquals("source", $i->getSource());
49  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_get_type()

ImageTest::test_get_type ( )

Definition at line 35 of file ImageTest.php.

References $f, $i, and getImageFactory().

36  {
37  $f = $this->getImageFactory();
38  $i = $f->standard("source", "alt");
39 
40  $this->assertEquals($i::STANDARD, $i->getType());
41  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ImageTest::test_implements_factory_interface ( )

Definition at line 26 of file ImageTest.php.

References $f, and getImageFactory().

27  {
28  $f = $this->getImageFactory();
29 
30  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Factory", $f);
31  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->standard("source", "alt"));
32  $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->responsive("source", "alt"));
33  }
getImageFactory()
Definition: ImageTest.php:20
+ Here is the call graph for this function:

◆ test_invalid_alt()

ImageTest::test_invalid_alt ( )

Definition at line 104 of file ImageTest.php.

References $f, and getImageFactory().

105  {
106  $f = $this->getImageFactory();
107 
108  try {
109  $f->standard("source", 1);
110  $this->assertFalse("This should not happen");
111  } catch (InvalidArgumentException $e) {
112  }
113  }
getImageFactory()
Definition: ImageTest.php:20
+ Here is the call graph for this function:

◆ test_invalid_source()

ImageTest::test_invalid_source ( )

Definition at line 93 of file ImageTest.php.

References $f, and getImageFactory().

94  {
95  $f = $this->getImageFactory();
96 
97  try {
98  $f->standard(1, "alt");
99  $this->assertFalse("This should not happen");
100  } catch (InvalidArgumentException $e) {
101  }
102  }
getImageFactory()
Definition: ImageTest.php:20
+ Here is the call graph for this function:

◆ test_render_alt_escaping()

ImageTest::test_render_alt_escaping ( )

Definition at line 141 of file ImageTest.php.

References $f, $html, $i, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getImageFactory(), and ILIAS_UI_TestBase\normalizeHTML().

142  {
143  $f = $this->getImageFactory();
144  $r = $this->getDefaultRenderer();
145  $i = $f->responsive("source", "\"=test;\")(blah\"");
146 
147  $html = $this->normalizeHTML($r->render($i));
148 
149  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"&quot;=test;&quot;)(blah&quot;\" />";
150 
151  $this->assertEquals($expected, $html);
152  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_responsive()

ImageTest::test_render_responsive ( )

Definition at line 128 of file ImageTest.php.

References $f, $html, $i, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getImageFactory(), and ILIAS_UI_TestBase\normalizeHTML().

129  {
130  $f = $this->getImageFactory();
131  $r = $this->getDefaultRenderer();
132  $i = $f->responsive("source", "alt");
133 
134  $html = $this->normalizeHTML($r->render($i));
135 
136  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"alt\" />";
137 
138  $this->assertEquals($expected, $html);
139  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_standard()

ImageTest::test_render_standard ( )

Definition at line 115 of file ImageTest.php.

References $f, $html, $i, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getImageFactory(), and ILIAS_UI_TestBase\normalizeHTML().

116  {
117  $f = $this->getImageFactory();
118  $r = $this->getDefaultRenderer();
119  $i = $f->standard("source", "alt");
120 
121  $html = $this->normalizeHTML($r->render($i));
122 
123  $expected = "<img src=\"source\" class=\"img-standard\" alt=\"alt\" />";
124 
125  $this->assertEquals($expected, $html);
126  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_signal_action()

ImageTest::test_render_with_signal_action ( )

Definition at line 167 of file ImageTest.php.

References $f, $html, $i, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getImageFactory(), and ILIAS_UI_TestBase\normalizeHTML().

168  {
169  $f = $this->getImageFactory();
170  $r = $this->getDefaultRenderer();
171  $signal = $this->createMock(Signal::class);
172 
173  $i = $f->standard("source", "alt")->withAction($signal);
174 
175  $html = $this->normalizeHTML($r->render($i));
176 
177  $expected = "<a id=\"id_1\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
178 
179  $this->assertEquals($expected, $html);
180  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_string_action()

ImageTest::test_render_with_string_action ( )

Definition at line 154 of file ImageTest.php.

References $f, $html, $i, $r, ILIAS_UI_TestBase\getDefaultRenderer(), getImageFactory(), and ILIAS_UI_TestBase\normalizeHTML().

155  {
156  $f = $this->getImageFactory();
157  $r = $this->getDefaultRenderer();
158  $i = $f->standard("source", "alt")->withAction("action");
159 
160  $html = $this->normalizeHTML($r->render($i));
161 
162  $expected = "<a href=\"action\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
163 
164  $this->assertEquals($expected, $html);
165  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:228
normalizeHTML($html)
Definition: Base.php:261
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_set_alt()

ImageTest::test_set_alt ( )

Definition at line 68 of file ImageTest.php.

References $f, $i, and getImageFactory().

69  {
70  $f = $this->getImageFactory();
71  $i = $f->standard("source", "alt");
72  $i = $i->withAlt("newAlt");
73  $this->assertEquals("newAlt", $i->getAlt());
74  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_set_signal_action()

ImageTest::test_set_signal_action ( )

Definition at line 84 of file ImageTest.php.

References $f, $i, and getImageFactory().

85  {
86  $f = $this->getImageFactory();
87  $signal = $this->createMock(C\Signal::class);
88  $i = $f->standard("source", "alt");
89  $i = $i->withAction($signal);
90  $this->assertEquals([$signal], $i->getAction());
91  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_set_source()

ImageTest::test_set_source ( )

Definition at line 60 of file ImageTest.php.

References $f, $i, and getImageFactory().

61  {
62  $f = $this->getImageFactory();
63  $i = $f->standard("source", "alt");
64  $i = $i->withSource("newSource");
65  $this->assertEquals("newSource", $i->getSource());
66  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ test_set_string_action()

ImageTest::test_set_string_action ( )

Definition at line 76 of file ImageTest.php.

References $f, $i, and getImageFactory().

77  {
78  $f = $this->getImageFactory();
79  $i = $f->standard("source", "alt");
80  $i = $i->withAction("newAction");
81  $this->assertEquals("newAction", $i->getAction());
82  }
getImageFactory()
Definition: ImageTest.php:20
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

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