5 require_once(__DIR__ .
"/../../../../libs/composer/vendor/autoload.php");
6 require_once(__DIR__ .
"/../../Base.php");
8 use \ILIAS\UI\Component as
C;
9 use \ILIAS\UI\Implementation\Component\Signal;
22 return new \ILIAS\UI\Implementation\Component\Image\Factory();
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"));
38 $i =
$f->standard(
"source",
"alt");
40 $this->assertEquals($i::STANDARD,
$i->getType());
46 $i =
$f->standard(
"source",
"alt");
48 $this->assertEquals(
"source",
$i->getSource());
54 $i =
$f->standard(
"source",
"alt");
56 $this->assertEquals(
"alt",
$i->getAlt());
63 $i =
$f->standard(
"source",
"alt");
64 $i =
$i->withSource(
"newSource");
65 $this->assertEquals(
"newSource",
$i->getSource());
71 $i =
$f->standard(
"source",
"alt");
72 $i =
$i->withAlt(
"newAlt");
73 $this->assertEquals(
"newAlt",
$i->getAlt());
79 $i =
$f->standard(
"source",
"alt");
80 $i =
$i->withAction(
"newAction");
81 $this->assertEquals(
"newAction",
$i->getAction());
87 $signal = $this->createMock(
C\Signal::class);
88 $i =
$f->standard(
"source",
"alt");
89 $i =
$i->withAction($signal);
90 $this->assertEquals([$signal],
$i->getAction());
98 $f->standard(1,
"alt");
99 $this->assertFalse(
"This should not happen");
109 $f->standard(
"source", 1);
110 $this->assertFalse(
"This should not happen");
119 $i =
$f->standard(
"source",
"alt");
123 $expected =
"<img src=\"source\" class=\"img-standard\" alt=\"alt\" />";
125 $this->assertEquals($expected,
$html);
132 $i =
$f->responsive(
"source",
"alt");
136 $expected =
"<img src=\"source\" class=\"img-responsive\" alt=\"alt\" />";
138 $this->assertEquals($expected,
$html);
145 $i =
$f->responsive(
"source",
"\"=test;\")(blah\"");
149 $expected =
"<img src=\"source\" class=\"img-responsive\" alt=\""=test;")(blah"\" />";
151 $this->assertEquals($expected,
$html);
158 $i =
$f->standard(
"source",
"alt")->withAction(
"action");
162 $expected =
"<a href=\"action\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
164 $this->assertEquals($expected,
$html);
171 $signal = $this->createMock(Signal::class);
173 $i =
$f->standard(
"source",
"alt")->withAction($signal);
177 $expected =
"<a id=\"id_1\"><img src=\"source\" class=\"img-standard\" alt=\"alt\" /></a>";
179 $this->assertEquals($expected,
$html);
test_render_with_signal_action()
Test on button implementation.
getDefaultRenderer(JavaScriptBinding $js_binding=null)
test_render_with_string_action()
Provides common functionality for UI tests.
test_implements_factory_interface()
test_render_alt_escaping()