ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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_invalid_source ()
 
 test_invalid_alt ()
 
 test_render_standard ()
 
 test_render_responsive ()
 
 test_render_alt_escaping ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getDefaultRenderer ()
 
 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
\ILIAS\UI\Implementation\Component\Image\Factory

Definition at line 18 of file ImageTest.php.

18 {
19 return new \ILIAS\UI\Implementation\Component\Image\Factory();
20 }

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_set_alt(), and test_set_source().

+ Here is the caller graph for this function:

◆ test_get_alt()

ImageTest::test_get_alt ( )

Definition at line 45 of file ImageTest.php.

45 {
46 $f = $this->getImageFactory();
47 $i = $f->standard("source","alt");
48
49 $this->assertEquals("alt", $i->getAlt());
50 }
getImageFactory()
Definition: ImageTest.php:18

References getImageFactory().

+ Here is the call graph for this function:

◆ test_get_source()

ImageTest::test_get_source ( )

Definition at line 38 of file ImageTest.php.

38 {
39 $f = $this->getImageFactory();
40 $i = $f->standard("source","alt");
41
42 $this->assertEquals("source", $i->getSource());
43 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_get_type()

ImageTest::test_get_type ( )

Definition at line 31 of file ImageTest.php.

31 {
32 $f = $this->getImageFactory();
33 $i = $f->standard("source","alt");
34
35 $this->assertEquals($i::STANDARD, $i->getType());
36 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ImageTest::test_implements_factory_interface ( )

Definition at line 23 of file ImageTest.php.

23 {
24 $f = $this->getImageFactory();
25
26 $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Factory", $f);
27 $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->standard("source","alt"));
28 $this->assertInstanceOf("ILIAS\\UI\\Component\\Image\\Image", $f->responsive("source","alt"));
29 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_invalid_alt()

ImageTest::test_invalid_alt ( )

Definition at line 76 of file ImageTest.php.

76 {
77 $f = $this->getImageFactory();
78
79 try{
80 $f->standard("source",1);
81 $this->assertFalse("This should not happen");
82 }catch(InvalidArgumentException $e){}
83 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_invalid_source()

ImageTest::test_invalid_source ( )

Definition at line 67 of file ImageTest.php.

67 {
68 $f = $this->getImageFactory();
69
70 try{
71 $f->standard(1,"alt");
72 $this->assertFalse("This should not happen");
73 }catch(InvalidArgumentException $e){}
74 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_render_alt_escaping()

ImageTest::test_render_alt_escaping ( )

Definition at line 109 of file ImageTest.php.

109 {
110 $f = $this->getImageFactory();
111 $r = $this->getDefaultRenderer();
112 $i = $f->responsive("source","\"=test;\")(blah\"");
113
114 $html = $this->normalizeHTML($r->render($i));
115
116 $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"&quot;=test;&quot;)(blah&quot;\" />";
117
118 $this->assertEquals($expected, $html);
119 }
normalizeHTML($html)
Definition: Base.php:110
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
$r
Definition: example_031.php:79

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

+ Here is the call graph for this function:

◆ test_render_responsive()

ImageTest::test_render_responsive ( )

Definition at line 97 of file ImageTest.php.

97 {
98 $f = $this->getImageFactory();
99 $r = $this->getDefaultRenderer();
100 $i = $f->responsive("source","alt");
101
102 $html = $this->normalizeHTML($r->render($i));
103
104 $expected = "<img src=\"source\" class=\"img-responsive\" alt=\"alt\" />";
105
106 $this->assertEquals($expected, $html);
107 }

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

+ Here is the call graph for this function:

◆ test_render_standard()

ImageTest::test_render_standard ( )

Definition at line 85 of file ImageTest.php.

85 {
86 $f = $this->getImageFactory();
87 $r = $this->getDefaultRenderer();
88 $i = $f->standard("source","alt");
89
90 $html = $this->normalizeHTML($r->render($i));
91
92 $expected = "<img src=\"source\" class=\"img-standard\" alt=\"alt\" />";
93
94 $this->assertEquals($expected, $html);
95 }

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

+ Here is the call graph for this function:

◆ test_set_alt()

ImageTest::test_set_alt ( )

Definition at line 60 of file ImageTest.php.

60 {
61 $f = $this->getImageFactory();
62 $i = $f->standard("source","alt");
63 $i = $i->withAlt("newAlt");
64 $this->assertEquals("newAlt", $i->getAlt());
65 }

References getImageFactory().

+ Here is the call graph for this function:

◆ test_set_source()

ImageTest::test_set_source ( )

Definition at line 53 of file ImageTest.php.

53 {
54 $f = $this->getImageFactory();
55 $i = $f->standard("source","alt");
56 $i = $i->withSource("newSource");
57 $this->assertEquals("newSource", $i->getSource());
58 }

References getImageFactory().

+ Here is the call graph for this function:

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