ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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_action ()
 
 test_invalid_source ()
 
 test_invalid_alt ()
 
 test_render_standard ()
 
 test_render_responsive ()
 
 test_render_alt_escaping ()
 
 test_render_with_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 13 of file ImageTest.php.

Member Function Documentation

◆ getImageFactory()

ImageTest::getImageFactory ( )
Returns

Definition at line 19 of file ImageTest.php.

Referenced by test_get_alt(), test_get_source(), test_get_type(), test_implements_factory_interface(), test_invalid_alt(), test_invalid_source(), test_render_alt_escaping(), test_render_responsive(), test_render_standard(), test_render_with_action(), test_set_action(), test_set_alt(), and test_set_source().

20  {
21  return new \ILIAS\UI\Implementation\Component\Image\Factory();
22  }
+ Here is the caller graph for this function:

◆ test_get_alt()

ImageTest::test_get_alt ( )

Definition at line 50 of file ImageTest.php.

References $i, and getImageFactory().

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

◆ test_get_source()

ImageTest::test_get_source ( )

Definition at line 42 of file ImageTest.php.

References $i, and getImageFactory().

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

◆ test_get_type()

ImageTest::test_get_type ( )

Definition at line 34 of file ImageTest.php.

References $i, and getImageFactory().

35  {
36  $f = $this->getImageFactory();
37  $i = $f->standard("source", "alt");
38 
39  $this->assertEquals($i::STANDARD, $i->getType());
40  }
getImageFactory()
Definition: ImageTest.php:19
$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 25 of file ImageTest.php.

References getImageFactory().

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

◆ test_invalid_alt()

ImageTest::test_invalid_alt ( )

Definition at line 94 of file ImageTest.php.

References getImageFactory().

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

◆ test_invalid_source()

ImageTest::test_invalid_source ( )

Definition at line 83 of file ImageTest.php.

References getImageFactory().

84  {
85  $f = $this->getImageFactory();
86 
87  try {
88  $f->standard(1, "alt");
89  $this->assertFalse("This should not happen");
90  } catch (InvalidArgumentException $e) {
91  }
92  }
getImageFactory()
Definition: ImageTest.php:19
+ Here is the call graph for this function:

◆ test_render_alt_escaping()

ImageTest::test_render_alt_escaping ( )

Definition at line 131 of file ImageTest.php.

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

132  {
133  $f = $this->getImageFactory();
134  $r = $this->getDefaultRenderer();
135  $i = $f->responsive("source", "\"=test;\")(blah\"");
136 
137  $html = $this->normalizeHTML($r->render($i));
138 
139  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"&quot;=test;&quot;)(blah&quot;\" />";
140 
141  $this->assertEquals($expected, $html);
142  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:19
$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 118 of file ImageTest.php.

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

119  {
120  $f = $this->getImageFactory();
121  $r = $this->getDefaultRenderer();
122  $i = $f->responsive("source", "alt");
123 
124  $html = $this->normalizeHTML($r->render($i));
125 
126  $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"alt\" />";
127 
128  $this->assertEquals($expected, $html);
129  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:19
$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 105 of file ImageTest.php.

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

106  {
107  $f = $this->getImageFactory();
108  $r = $this->getDefaultRenderer();
109  $i = $f->standard("source", "alt");
110 
111  $html = $this->normalizeHTML($r->render($i));
112 
113  $expected = "<img src=\"source\" class=\"img-standard\" alt=\"alt\" />";
114 
115  $this->assertEquals($expected, $html);
116  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:19
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_with_action()

ImageTest::test_render_with_action ( )

Definition at line 144 of file ImageTest.php.

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

145  {
146  $f = $this->getImageFactory();
147  $r = $this->getDefaultRenderer();
148  $i = $f->standard("source", "alt")->withAction("action");
149 
150  $html = $this->normalizeHTML($r->render($i));
151 
152  $expected = "<a href=\"action\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
153 
154  $this->assertEquals($expected, $html);
155  }
getDefaultRenderer(JavaScriptBinding $js_binding=null)
Definition: Base.php:216
normalizeHTML($html)
Definition: Base.php:243
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:19
$i
Definition: disco.tpl.php:19
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_set_action()

ImageTest::test_set_action ( )

Definition at line 75 of file ImageTest.php.

References $i, and getImageFactory().

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

◆ test_set_alt()

ImageTest::test_set_alt ( )

Definition at line 67 of file ImageTest.php.

References $i, and getImageFactory().

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

◆ test_set_source()

ImageTest::test_set_source ( )

Definition at line 59 of file ImageTest.php.

References $i, and getImageFactory().

60  {
61  $f = $this->getImageFactory();
62  $i = $f->standard("source", "alt");
63  $i = $i->withSource("newSource");
64  $this->assertEquals("newSource", $i->getSource());
65  }
getImageFactory()
Definition: ImageTest.php:19
$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: