ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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  }
The progress of the process/task cannot be calculated (yet), but it has started processing.
Definition: Status.php:42

◆ 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  new IC\Listing\Workflow\Factory(),
73  new IC\Listing\CharacteristicValue\Factory(),
74  new IC\Listing\Entity\Factory(),
75  );
76  }
77  };
78  }
+ Here is the call graph for this function:

◆ testImplementsFactoryInterface()

MessageBoxTest::testImplementsFactoryInterface ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 83 of file MessageBoxTest.php.

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

83  : void
84  {
85  $f = $this->getMessageBoxFactory();
86 
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."));
89  }
+ Here is the call graph for this function:

◆ testMessageboxMessagetext()

MessageBoxTest::testMessageboxMessagetext ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 106 of file MessageBoxTest.php.

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

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

◆ testMessageboxTypes()

MessageBoxTest::testMessageboxTypes ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 94 of file MessageBoxTest.php.

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

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

◆ testRenderSimple()

MessageBoxTest::testRenderSimple ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 174 of file MessageBoxTest.php.

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

174  : void
175  {
176  $f = $this->getMessageBoxFactory();
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];
181 
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);
187  }
$r
+ Here is the call graph for this function:

◆ testRenderWithButtons()

MessageBoxTest::testRenderWithButtons ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 192 of file MessageBoxTest.php.

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

192  : void
193  {
194  $f = $this->getMessageBoxFactory();
195  $bf = $this->getButtonFactory();
196  $r = $this->getDefaultRenderer();
197  $css_classes = self::$canonical_css_classes[$factory_method];
198  $role_type = self::$canonical_role_types[$factory_method];
199 
200  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
201 
202  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withButtons($buttons);
203 
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);
211  }
$r
+ Here is the call graph for this function:

◆ testRenderWithButtonsAndLinks()

MessageBoxTest::testRenderWithButtonsAndLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 243 of file MessageBoxTest.php.

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

243  : void
244  {
245  $f = $this->getMessageBoxFactory();
246  $bf = $this->getButtonFactory();
247  $lf = $this->getLinkFactory();
248  $r = $this->getDefaultRenderer();
249  $css_classes = self::$canonical_css_classes[$factory_method];
250  $role_type = self::$canonical_role_types[$factory_method];
251 
252  $buttons = [$bf->standard("Confirm", "#"), $bf->standard("Cancel", "#")];
253  $links = [
254  $lf->standard("Open Exercise Assignment", "#"),
255  $lf->standard("Open other screen", "#"),
256  ];
257 
258  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withButtons($buttons)->withLinks($links);
259 
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);
269  }
$r
+ Here is the call graph for this function:

◆ testRenderWithLinks()

MessageBoxTest::testRenderWithLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 216 of file MessageBoxTest.php.

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

216  : void
217  {
218  $f = $this->getMessageBoxFactory();
219  $lf = $this->getLinkFactory();
220  $r = $this->getDefaultRenderer();
221  $css_classes = self::$canonical_css_classes[$factory_method];
222  $role_type = self::$canonical_role_types[$factory_method];
223 
224  $links = [
225  $lf->standard("Open Exercise Assignment", "#"),
226  $lf->standard("Open other screen", "#"),
227  ];
228 
229  $g = $f->$factory_method("Lorem ipsum dolor sit amet.")->withLinks($links);
230 
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);
238  }
$r
+ Here is the call graph for this function:

◆ testWithButtons()

MessageBoxTest::testWithButtons ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 118 of file MessageBoxTest.php.

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

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

◆ testWithButtonsAndLinks()

MessageBoxTest::testWithButtonsAndLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 153 of file MessageBoxTest.php.

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

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

◆ testWithLinks()

MessageBoxTest::testWithLinks ( string  $factory_method)

getMessageboxTypeProvider

Definition at line 134 of file MessageBoxTest.php.

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

134  : void
135  {
136  $f = $this->getMessageBoxFactory();
137  $lf = $this->getLinkFactory();
138  $g = $f->$factory_method("Lorem ipsum dolor sit amet.");
139 
140  $links = [
141  $lf->standard("Open Exercise Assignment", "#"),
142  $lf->standard("Open other screen", "#"),
143  ];
144  $g2 = $g->withLinks($links);
145 
146  $this->assertEmpty($g->getLinks());
147  $this->assertNotEmpty($g2->getLinks());
148  }
+ 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: