19 declare(strict_types=1);
21 require_once(__DIR__ .
"/../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
34 return new IC\MessageBox\Factory();
38 return new IC\Button\Factory();
42 return new IC\Link\Factory();
48 , array(
C\MessageBox\MessageBox::SUCCESS)
49 , array(
C\MessageBox\MessageBox::INFO)
50 , array(
C\MessageBox\MessageBox::CONFIRMATION)
55 ,
C\MessageBox\MessageBox::SUCCESS =>
"alert-success" 56 ,
C\MessageBox\MessageBox::INFO =>
"alert-info" 57 ,
C\MessageBox\MessageBox::CONFIRMATION =>
"alert-warning" 61 ,
C\MessageBox\MessageBox::SUCCESS =>
"status" 62 ,
C\MessageBox\MessageBox::INFO =>
"status" 63 ,
C\MessageBox\MessageBox::CONFIRMATION =>
"status" 69 public function listing(): IC\Listing\Factory
71 return new IC\Listing\Factory(
72 new IC\Listing\Workflow\Factory(),
73 new IC\Listing\CharacteristicValue\Factory(),
74 new IC\Listing\Entity\Factory(),
87 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\Factory",
$f);
88 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\MessageBox\\MessageBox",
$f->$factory_method(
"Lorem ipsum dolor sit amet."));
97 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
99 $this->assertNotNull($g);
100 $this->assertEquals($factory_method, $g->getType());
109 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
111 $this->assertNotNull($g);
112 $this->assertEquals(
"Lorem ipsum dolor sit amet.", $g->getMessageText());
122 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
124 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
125 $g2 = $g->withButtons($buttons);
127 $this->assertEmpty($g->getButtons());
128 $this->assertNotEmpty($g2->getButtons());
138 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
141 $lf->standard(
"Open Exercise Assignment",
"#"),
142 $lf->standard(
"Open other screen",
"#"),
144 $g2 = $g->withLinks($links);
146 $this->assertEmpty($g->getLinks());
147 $this->assertNotEmpty($g2->getLinks());
158 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
160 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
162 $lf->standard(
"Open Exercise Assignment",
"#"),
163 $lf->standard(
"Open other screen",
"#"),
165 $g2 = $g->withButtons($buttons)->withLinks($links);
167 $this->assertFalse(count($g->getButtons()) > 0 && count($g->getLinks()) > 0);
168 $this->assertTrue(count($g2->getButtons()) > 0 && count($g2->getLinks()) > 0);
177 $r = $this->getDefaultRenderer();
178 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.");
179 $css_classes = self::$canonical_css_classes[$factory_method];
180 $role_type = self::$canonical_role_types[$factory_method];
182 $html = $this->normalizeHTML(
$r->render($g));
183 $expected =
"<div class=\"alert $css_classes\" role=\"$role_type\">" .
184 "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
185 $g->getType() .
"_message</a></div>Lorem ipsum dolor sit amet.</div>";
186 $this->assertHTMLEquals($expected, $html);
196 $r = $this->getDefaultRenderer();
197 $css_classes = self::$canonical_css_classes[$factory_method];
198 $role_type = self::$canonical_role_types[$factory_method];
200 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
202 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons);
204 $html = $this->normalizeHTML(
$r->render($g));
205 $expected =
"<div class=\"alert $css_classes\" role=\"$role_type\">" .
206 "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
207 $g->getType() .
"_message</a></div>Lorem ipsum dolor sit amet." .
208 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
209 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div></div>";
210 $this->assertHTMLEquals($expected, $html);
220 $r = $this->getDefaultRenderer();
221 $css_classes = self::$canonical_css_classes[$factory_method];
222 $role_type = self::$canonical_role_types[$factory_method];
225 $lf->standard(
"Open Exercise Assignment",
"#"),
226 $lf->standard(
"Open other screen",
"#"),
229 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withLinks($links);
231 $html = $this->normalizeHTML(
$r->render($g));
232 $expected =
"<div class=\"alert $css_classes\" role=\"$role_type\">" .
233 "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
234 $g->getType() .
"_message</a></div>Lorem ipsum dolor sit amet." .
235 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
236 "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
237 $this->assertHTMLEquals($expected, $html);
248 $r = $this->getDefaultRenderer();
249 $css_classes = self::$canonical_css_classes[$factory_method];
250 $role_type = self::$canonical_role_types[$factory_method];
252 $buttons = [$bf->standard(
"Confirm",
"#"), $bf->standard(
"Cancel",
"#")];
254 $lf->standard(
"Open Exercise Assignment",
"#"),
255 $lf->standard(
"Open other screen",
"#"),
258 $g =
$f->$factory_method(
"Lorem ipsum dolor sit amet.")->withButtons($buttons)->withLinks($links);
260 $html = $this->normalizeHTML(
$r->render($g));
261 $expected =
"<div class=\"alert $css_classes\" role=\"$role_type\">" .
262 "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
263 $g->getType() .
"_message</a></div>Lorem ipsum dolor sit amet." .
264 "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
265 "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div>" .
266 "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
267 "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
268 $this->assertHTMLEquals($expected, $html);
static getMessageboxTypeProvider()
testWithButtons(string $factory_method)
getMessageboxTypeProvider
testImplementsFactoryInterface(string $factory_method)
getMessageboxTypeProvider
Test on Message Box implementation.
The progress of the process/task cannot be calculated (yet), but it has started processing.
testRenderWithButtons(string $factory_method)
getMessageboxTypeProvider
testWithButtonsAndLinks(string $factory_method)
getMessageboxTypeProvider
testWithLinks(string $factory_method)
getMessageboxTypeProvider
testRenderWithButtonsAndLinks(string $factory_method)
getMessageboxTypeProvider
testRenderWithLinks(string $factory_method)
getMessageboxTypeProvider
static array $canonical_role_types
testMessageboxTypes(string $factory_method)
getMessageboxTypeProvider
testRenderSimple(string $factory_method)
getMessageboxTypeProvider
testMessageboxMessagetext(string $factory_method)
getMessageboxTypeProvider
static array $canonical_css_classes