ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
MessageBoxTest Class Reference

Test on Message Box implementation. More...

+ Inheritance diagram for MessageBoxTest:
+ Collaboration diagram for MessageBoxTest:

Public Member Functions

 getMessageBoxFactory ()
 
 getButtonFactory ()
 
 getLinkFactory ()
 
 getUIFactory ()
 
 testImplementsFactoryInterface (string $factory_method)
 getMessageboxTypeProvider More...
 
 testMessageboxTypes (string $factory_method)
 getMessageboxTypeProvider More...
 
 testMessageboxMessagetext (string $factory_method)
 getMessageboxTypeProvider More...
 
 testWithButtons (string $factory_method)
 getMessageboxTypeProvider More...
 
 testWithLinks (string $factory_method)
 getMessageboxTypeProvider More...
 
 testWithButtonsAndLinks (string $factory_method)
 getMessageboxTypeProvider More...
 
 testRenderSimple (string $factory_method)
 getMessageboxTypeProvider More...
 
 testRenderWithButtons (string $factory_method)
 getMessageboxTypeProvider More...
 
 testRenderWithLinks (string $factory_method)
 getMessageboxTypeProvider More...
 
 testRenderWithButtonsAndLinks (string $factory_method)
 getMessageboxTypeProvider More...
 

Static Public Member Functions

static getMessageboxTypeProvider ()
 

Static Public Attributes

static array $canonical_css_classes
 
static array $canonical_role_types
 

Detailed Description

Test on Message Box implementation.

Definition at line 30 of file MessageBoxTest.php.

Member Function Documentation

◆ getButtonFactory()

MessageBoxTest::getButtonFactory ( )

Definition at line 36 of file MessageBoxTest.php.

Referenced by testRenderWithButtons(), testRenderWithButtonsAndLinks(), testWithButtons(), and testWithButtonsAndLinks().

36  : IC\Button\Factory
37  {
38  return new IC\Button\Factory();
39  }
+ Here is the caller graph for this function:

◆ getLinkFactory()

MessageBoxTest::getLinkFactory ( )

Definition at line 40 of file MessageBoxTest.php.

Referenced by testRenderWithButtonsAndLinks(), testRenderWithLinks(), testWithButtonsAndLinks(), and testWithLinks().

40  : IC\Link\Factory
41  {
42  return new IC\Link\Factory();
43  }
+ Here is the caller graph for this function:

◆ getMessageBoxFactory()

MessageBoxTest::getMessageBoxFactory ( )

Definition at line 32 of file MessageBoxTest.php.

Referenced by testImplementsFactoryInterface(), testMessageboxMessagetext(), testMessageboxTypes(), testRenderSimple(), testRenderWithButtons(), testRenderWithButtonsAndLinks(), testRenderWithLinks(), testWithButtons(), testWithButtonsAndLinks(), and testWithLinks().

32  : IC\MessageBox\Factory
33  {
34  return new IC\MessageBox\Factory();
35  }
+ Here is the caller graph for this function:

◆ getMessageboxTypeProvider()

static MessageBoxTest::getMessageboxTypeProvider ( )
static

Definition at line 45 of file MessageBoxTest.php.

References ILIAS\UI\Implementation\Component\Progress\State\Bar\FAILURE.

45  : array
46  {
47  return array( array(C\MessageBox\MessageBox::FAILURE)
48  , array(C\MessageBox\MessageBox::SUCCESS)
49  , array(C\MessageBox\MessageBox::INFO)
50  , array(C\MessageBox\MessageBox::CONFIRMATION)
51  );
52  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
The progress of the process/task cannot be calculated (yet), but it has started processing.
Definition: Status.php:41

◆ getUIFactory()

MessageBoxTest::getUIFactory ( )

Definition at line 66 of file MessageBoxTest.php.

References ILIAS\Repository\listing().

66  : NoUIFactory
67  {
68  return new class () extends NoUIFactory {
69  public function listing(): IC\Listing\Factory
70  {
71  return new IC\Listing\Factory();
72  }
73  };
74  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

MessageBoxTest::testImplementsFactoryInterface ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 79 of file MessageBoxTest.php.

References Vendor\Package\$f, and getMessageBoxFactory().

79  : void
80  {
81  $f = $this->getMessageBoxFactory();
82 
83  $this->assertInstanceOf("ILIAS\\UI\\Component\\MessageBox\\Factory", $f);
84  $this->assertInstanceOf("ILIAS\\UI\\Component\\MessageBox\\MessageBox", $f->$factory_method("Lorem ipsum dolor sit amet."));
85  }
+ Here is the call graph for this function:

◆ testMessageboxMessagetext()

MessageBoxTest::testMessageboxMessagetext ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 102 of file MessageBoxTest.php.

References Vendor\Package\$f, and getMessageBoxFactory().

102  : void
103  {
104  $f = $this->getMessageBoxFactory();
105  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
106 
107  $this->assertNotNull($g);
108  $this->assertEquals("Lorem ipsum dolor sit amet.", $g->getMessageText());
109  }
+ Here is the call graph for this function:

◆ testMessageboxTypes()

MessageBoxTest::testMessageboxTypes ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 90 of file MessageBoxTest.php.

References Vendor\Package\$f, and getMessageBoxFactory().

90  : void
91  {
92  $f = $this->getMessageBoxFactory();
93  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
94 
95  $this->assertNotNull($g);
96  $this->assertEquals($factory_method, $g->getType());
97  }
+ Here is the call graph for this function:

◆ testRenderSimple()

MessageBoxTest::testRenderSimple ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 170 of file MessageBoxTest.php.

References Vendor\Package\$f, $r, and getMessageBoxFactory().

170  : void
171  {
172  $f = $this->getMessageBoxFactory();
173  $r = $this->getDefaultRenderer();
174  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
175  $css_classes = self::$canonical_css_classes[$factory_method];
176  $role_type = self::$canonical_role_types[$factory_method];
177 
178  $html = $this->normalizeHTML($r->render($g));
179  $expected = "<div class=\"alert $css_classes\" role=\"$role_type\">" .
180  "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
181  $g->getType() . "_message</a></div>Lorem ipsum dolor sit amet.</div>";
182  $this->assertHTMLEquals($expected, $html);
183  }
$r
+ Here is the call graph for this function:

◆ testRenderWithButtons()

MessageBoxTest::testRenderWithButtons ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 188 of file MessageBoxTest.php.

References Vendor\Package\$f, $r, getButtonFactory(), and getMessageBoxFactory().

188  : void
189  {
190  $f = $this->getMessageBoxFactory();
191  $bf = $this->getButtonFactory();
192  $r = $this->getDefaultRenderer();
193  $css_classes = self::$canonical_css_classes[$factory_method];
194  $role_type = self::$canonical_role_types[$factory_method];
195 
196  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
197 
198  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withButtons($buttons);
199 
200  $html = $this->normalizeHTML($r->render($g));
201  $expected = "<div class=\"alert $css_classes\" role=\"$role_type\">" .
202  "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
203  $g->getType() . "_message</a></div>Lorem ipsum dolor sit amet." .
204  "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
205  "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div></div>";
206  $this->assertHTMLEquals($expected, $html);
207  }
$r
+ Here is the call graph for this function:

◆ testRenderWithButtonsAndLinks()

MessageBoxTest::testRenderWithButtonsAndLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 239 of file MessageBoxTest.php.

References Vendor\Package\$f, $r, getButtonFactory(), getLinkFactory(), and getMessageBoxFactory().

239  : void
240  {
241  $f = $this->getMessageBoxFactory();
242  $bf = $this->getButtonFactory();
243  $lf = $this->getLinkFactory();
244  $r = $this->getDefaultRenderer();
245  $css_classes = self::$canonical_css_classes[$factory_method];
246  $role_type = self::$canonical_role_types[$factory_method];
247 
248  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
249  $links = [
250  $lf->standard("Open Exercise Assignment", "#"),
251  $lf->standard("Open other screen", "#"),
252  ];
253 
254  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withButtons($buttons)->withLinks($links);
255 
256  $html = $this->normalizeHTML($r->render($g));
257  $expected = "<div class=\"alert $css_classes\" role=\"$role_type\">" .
258  "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
259  $g->getType() . "_message</a></div>Lorem ipsum dolor sit amet." .
260  "<div><button class=\"btn btn-default\" data-action=\"#\" id=\"id_1\">Confirm</button>" .
261  "<button class=\"btn btn-default\" data-action=\"#\" id=\"id_2\">Cancel</button></div>" .
262  "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
263  "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
264  $this->assertHTMLEquals($expected, $html);
265  }
$r
+ Here is the call graph for this function:

◆ testRenderWithLinks()

MessageBoxTest::testRenderWithLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 212 of file MessageBoxTest.php.

References Vendor\Package\$f, $r, getLinkFactory(), and getMessageBoxFactory().

212  : void
213  {
214  $f = $this->getMessageBoxFactory();
215  $lf = $this->getLinkFactory();
216  $r = $this->getDefaultRenderer();
217  $css_classes = self::$canonical_css_classes[$factory_method];
218  $role_type = self::$canonical_role_types[$factory_method];
219 
220  $links = [
221  $lf->standard("Open Exercise Assignment", "#"),
222  $lf->standard("Open other screen", "#"),
223  ];
224 
225  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withLinks($links);
226 
227  $html = $this->normalizeHTML($r->render($g));
228  $expected = "<div class=\"alert $css_classes\" role=\"$role_type\">" .
229  "<div class=\"ilAccHeadingHidden\"><a name=\"il_message_focus\">" .
230  $g->getType() . "_message</a></div>Lorem ipsum dolor sit amet." .
231  "<ul><li><a href=\"#\" >Open Exercise Assignment</a></li>" .
232  "<li><a href=\"#\" >Open other screen</a></li></ul></div>";
233  $this->assertHTMLEquals($expected, $html);
234  }
$r
+ Here is the call graph for this function:

◆ testWithButtons()

MessageBoxTest::testWithButtons ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 114 of file MessageBoxTest.php.

References Vendor\Package\$f, getButtonFactory(), and getMessageBoxFactory().

114  : void
115  {
116  $f = $this->getMessageBoxFactory();
117  $bf = $this->getButtonFactory();
118  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
119 
120  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
121  $g2 = $g->withButtons($buttons);
122 
123  $this->assertEmpty($g->getButtons());
124  $this->assertNotEmpty($g2->getButtons());
125  }
+ Here is the call graph for this function:

◆ testWithButtonsAndLinks()

MessageBoxTest::testWithButtonsAndLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 149 of file MessageBoxTest.php.

References Vendor\Package\$f, getButtonFactory(), getLinkFactory(), and getMessageBoxFactory().

149  : void
150  {
151  $f = $this->getMessageBoxFactory();
152  $bf = $this->getButtonFactory();
153  $lf = $this->getLinkFactory();
154  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
155 
156  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
157  $links = [
158  $lf->standard("Open Exercise Assignment", "#"),
159  $lf->standard("Open other screen", "#"),
160  ];
161  $g2 = $g->withButtons($buttons)->withLinks($links);
162 
163  $this->assertFalse(count($g->getButtons()) > 0 && count($g->getLinks()) > 0);
164  $this->assertTrue(count($g2->getButtons()) > 0 && count($g2->getLinks()) > 0);
165  }
+ Here is the call graph for this function:

◆ testWithLinks()

MessageBoxTest::testWithLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 130 of file MessageBoxTest.php.

References Vendor\Package\$f, getLinkFactory(), and getMessageBoxFactory().

130  : void
131  {
132  $f = $this->getMessageBoxFactory();
133  $lf = $this->getLinkFactory();
134  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
135 
136  $links = [
137  $lf->standard("Open Exercise Assignment", "#"),
138  $lf->standard("Open other screen", "#"),
139  ];
140  $g2 = $g->withLinks($links);
141 
142  $this->assertEmpty($g->getLinks());
143  $this->assertNotEmpty($g2->getLinks());
144  }
+ Here is the call graph for this function:

Field Documentation

◆ $canonical_css_classes

array MessageBoxTest::$canonical_css_classes
static
Initial value:
= array( C\MessageBox\MessageBox::FAILURE => "alert-danger"
, C\MessageBox\MessageBox::SUCCESS => "alert-success"
, C\MessageBox\MessageBox::INFO => "alert-info"
, C\MessageBox\MessageBox::CONFIRMATION => "alert-warning"
)

Definition at line 54 of file MessageBoxTest.php.

◆ $canonical_role_types

array MessageBoxTest::$canonical_role_types
static
Initial value:
= array( C\MessageBox\MessageBox::FAILURE => "alert"
, C\MessageBox\MessageBox::SUCCESS => "status"
, C\MessageBox\MessageBox::INFO => "status"
, C\MessageBox\MessageBox::CONFIRMATION => "status"
)

Definition at line 60 of file MessageBoxTest.php.


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