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 as
IC;
18 return new \ILIAS\UI\Implementation\Component\MessageBox\Factory();
22 return new \ILIAS\UI\Implementation\Component\Button\Factory();
26 return new \ILIAS\UI\Implementation\Component\Link\Factory();
31 return array( array(
C\MessageBox\MessageBox::FAILURE)
32 , array(
C\MessageBox\MessageBox::SUCCESS)
33 , array(
C\MessageBox\MessageBox::INFO)
34 , array(
C\MessageBox\MessageBox::CONFIRMATION)
39 ,
C\MessageBox\MessageBox::SUCCESS =>
"alert-success" 40 ,
C\MessageBox\MessageBox::INFO =>
"alert-info" 41 ,
C\MessageBox\MessageBox::CONFIRMATION =>
"alert-warning" 46 return new \ILIAS\UI\Implementation\Factory(
47 $this->createMock(
C\Counter\Factory::class),
48 $this->createMock(
C\Glyph\Factory::class),
49 $this->createMock(
C\
Button\Factory::class),
50 new IC\Listing\Factory(),
51 $this->createMock(
C\Image\Factory::class),
52 $this->createMock(
C\Panel\Factory::class),
53 $this->createMock(
C\Modal\Factory::class),
54 $this->createMock(
C\Dropzone\Factory::class),
55 $this->createMock(
C\Popover\Factory::class),
56 $this->createMock(
C\Divider\Factory::class),
57 $this->createMock(
C\Link\Factory::class),
58 $this->createMock(
C\Dropdown\Factory::class),
59 $this->createMock(
C\Item\Factory::class),
60 $this->createMock(
C\Icon\Factory::class),
61 $this->createMock(
C\ViewControl\Factory::class),
62 $this->createMock(
C\Chart\Factory::class),
63 $this->createMock(
C\Input\Factory::class),
64 $this->createMock(
C\Table\Factory::class),
65 $this->createMock(
C\MessageBox\Factory::class),
66 $this->createMock(
C\
Card\Factory::class)
78 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\Factory",
$f);
79 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\MessageBox",
$f->$factory_method(
"Lorem ipsum dolor sit amet."));
88 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
90 $this->assertNotNull($g);
91 $this->assertEquals($factory_method, $g->getType());
100 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
102 $this->assertNotNull($g);
103 $this->assertEquals(
"Lorem ipsum dolor sit amet.", $g->getMessageText());
113 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
115 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
116 $g2 = $g->withButtons($buttons);
118 $this->assertFalse(count($g->getButtons()) > 0);
119 $this->assertTrue(count($g2->getButtons()) > 0);
129 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
132 $lf->standard(
"Open Exercise Assignment",
"#"),
133 $lf->standard(
"Open other screen",
"#"),
135 $g2 = $g->withLinks(
$links);
137 $this->assertFalse(count($g->getLinks()) > 0);
138 $this->assertTrue(count($g2->getLinks()) > 0);
149 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
151 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
153 $lf->standard(
"Open Exercise Assignment",
"#"),
154 $lf->standard(
"Open other screen",
"#"),
156 $g2 = $g->withButtons($buttons)->withLinks(
$links);
158 $this->assertFalse(count($g->getButtons()) > 0 && count($g->getLinks()) > 0);
159 $this->assertTrue(count($g2->getButtons()) > 0 && count($g2->getLinks()) > 0);
169 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
170 $css_classes = self::$canonical_css_classes[$factory_method];
173 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
174 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
175 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet.</div>";
187 $css_classes = self::$canonical_css_classes[$factory_method];
189 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
191 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons);
194 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
195 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
196 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
197 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
198 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div></div>";
210 $css_classes = self::$canonical_css_classes[$factory_method];
213 $lf->standard(
"Open Exercise Assignment",
"#"),
214 $lf->standard(
"Open other screen",
"#"),
217 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withLinks(
$links);
220 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
221 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
222 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
223 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
224 "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
237 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
238 $css_classes = self::$canonical_css_classes[$factory_method];
240 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
242 $lf->standard(
"Open Exercise Assignment",
"#"),
243 $lf->standard(
"Open other screen",
"#"),
246 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons)->withLinks(
$links);
249 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
250 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
251 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
252 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
253 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div>" .
254 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
255 "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
test_messagebox_types($factory_method)
messagebox_type_provider
test_render_with_links($factory_method)
messagebox_type_provider
test_messagebox_messagetext($factory_method)
messagebox_type_provider
test_with_buttons($factory_method)
messagebox_type_provider
getDefaultRenderer(JavaScriptBinding $js_binding=null)
test_implements_factory_interface($factory_method)
messagebox_type_provider
static $canonical_css_classes
Test on Message Box implementation.
Provides common functionality for UI tests.
test_with_buttons_and_links($factory_method)
messagebox_type_provider
messagebox_type_provider()
assertHTMLEquals($expected_html_as_string, $html_as_string)
test_with_links($factory_method)
messagebox_type_provider
test_render_with_buttons($factory_method)
messagebox_type_provider
test_render_with_buttons_and_links($factory_method)
messagebox_type_provider
test_render_simple($factory_method)
messagebox_type_provider