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 $factory =
new class extends NoUIFactory {
47 public function listing()
49 return new IC\Listing\Factory();
62 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\Factory",
$f);
63 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\MessageBox",
$f->$factory_method(
"Lorem ipsum dolor sit amet."));
72 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
74 $this->assertNotNull($g);
75 $this->assertEquals($factory_method, $g->getType());
84 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
86 $this->assertNotNull($g);
87 $this->assertEquals(
"Lorem ipsum dolor sit amet.", $g->getMessageText());
97 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
99 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
100 $g2 = $g->withButtons($buttons);
102 $this->assertFalse(count($g->getButtons()) > 0);
103 $this->assertTrue(count($g2->getButtons()) > 0);
113 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
116 $lf->standard(
"Open Exercise Assignment",
"#"),
117 $lf->standard(
"Open other screen",
"#"),
119 $g2 = $g->withLinks($links);
121 $this->assertFalse(count($g->getLinks()) > 0);
122 $this->assertTrue(count($g2->getLinks()) > 0);
133 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
135 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
137 $lf->standard(
"Open Exercise Assignment",
"#"),
138 $lf->standard(
"Open other screen",
"#"),
140 $g2 = $g->withButtons($buttons)->withLinks($links);
142 $this->assertFalse(count($g->getButtons()) > 0 && count($g->getLinks()) > 0);
143 $this->assertTrue(count($g2->getButtons()) > 0 && count($g2->getLinks()) > 0);
153 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
154 $css_classes = self::$canonical_css_classes[$factory_method];
157 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
158 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
159 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet.</div>";
171 $css_classes = self::$canonical_css_classes[$factory_method];
173 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
175 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons);
178 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
179 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
180 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
181 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
182 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div></div>";
194 $css_classes = self::$canonical_css_classes[$factory_method];
197 $lf->standard(
"Open Exercise Assignment",
"#"),
198 $lf->standard(
"Open other screen",
"#"),
201 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withLinks($links);
204 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
205 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
206 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
207 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
208 "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
221 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
222 $css_classes = self::$canonical_css_classes[$factory_method];
224 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
226 $lf->standard(
"Open Exercise Assignment",
"#"),
227 $lf->standard(
"Open other screen",
"#"),
230 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons)->withLinks($links);
233 $expected =
"<div class=\"alert $css_classes\" role=\"alert\">" .
234 "<h5 class=\"ilAccHeadingHidden\"><a id=\"il_message_focus\" name=\"il_message_focus\">" .
235 $g->getType() .
"_message</a></h5>Lorem ipsum dolor sit amet." .
236 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
237 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div>" .
238 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
239 "<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