ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
All Data Structures Namespaces Files Functions Variables Typedefs Modules Pages
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

Definition at line 18 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_set_alt(), and test_set_source().

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

◆ test_get_alt()

ImageTest::test_get_alt ( )

Definition at line 45 of file ImageTest.php.

References getImageFactory().

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

◆ test_get_source()

ImageTest::test_get_source ( )

Definition at line 38 of file ImageTest.php.

References getImageFactory().

38  {
39  $f = $this->getImageFactory();
40  $i = $f->standard("source","alt");
41 
42  $this->assertEquals("source", $i->getSource());
43  }
getImageFactory()
Definition: ImageTest.php:18
+ Here is the call graph for this function:

◆ test_get_type()

ImageTest::test_get_type ( )

Definition at line 31 of file ImageTest.php.

References getImageFactory().

31  {
32  $f = $this->getImageFactory();
33  $i = $f->standard("source","alt");
34 
35  $this->assertEquals($i::STANDARD, $i->getType());
36  }
getImageFactory()
Definition: ImageTest.php:18
+ 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.

References getImageFactory().

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  }
getImageFactory()
Definition: ImageTest.php:18
+ Here is the call graph for this function:

◆ test_invalid_alt()

ImageTest::test_invalid_alt ( )

Definition at line 76 of file ImageTest.php.

References getImageFactory().

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  }
getImageFactory()
Definition: ImageTest.php:18
+ Here is the call graph for this function:

◆ test_invalid_source()

ImageTest::test_invalid_source ( )

Definition at line 67 of file ImageTest.php.

References getImageFactory().

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  }
getImageFactory()
Definition: ImageTest.php:18
+ 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.

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

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
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:18
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_responsive()

ImageTest::test_render_responsive ( )

Definition at line 97 of file ImageTest.php.

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

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  }
normalizeHTML($html)
Definition: Base.php:110
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:18
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_render_standard()

ImageTest::test_render_standard ( )

Definition at line 85 of file ImageTest.php.

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

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  }
normalizeHTML($html)
Definition: Base.php:110
$r
Definition: example_031.php:79
getImageFactory()
Definition: ImageTest.php:18
getDefaultRenderer()
Definition: Base.php:100
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ test_set_alt()

ImageTest::test_set_alt ( )

Definition at line 60 of file ImageTest.php.

References getImageFactory().

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

◆ test_set_source()

ImageTest::test_set_source ( )

Definition at line 53 of file ImageTest.php.

References getImageFactory().

53  {
54  $f = $this->getImageFactory();
55  $i = $f->standard("source","alt");
56  $i = $i->withSource("newSource");
57  $this->assertEquals("newSource", $i->getSource());
58  }
getImageFactory()
Definition: ImageTest.php:18
+ Here is the call graph for this function:

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