ILIAS  release_8 Revision v8.24
ToastTest Class Reference
+ Inheritance diagram for ToastTest:
+ Collaboration diagram for ToastTest:

Public Member Functions

 getToastFactory ()
 
 getIconFactory ()
 
 getLinkFactory ()
 
 test_implements_factory_interface ()
 
 test_toast (string $title, string $description, int $vanish_time, int $delay_time, string $action)
 @dataProvider toast_provider More...
 
 test_toast_container (string $title, string $description, int $vanish_time)
 @dataProvider toast_provider More...
 
 toast_provider ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Definition at line 28 of file ToastTest.php.

Member Function Documentation

◆ getIconFactory()

ToastTest::getIconFactory ( )

Definition at line 35 of file ToastTest.php.

36 {
38 }
This is how the factory for UI elements looks.
Definition: Factory.php:38

Referenced by test_toast(), and test_toast_container().

+ Here is the caller graph for this function:

◆ getLinkFactory()

ToastTest::getLinkFactory ( )

Definition at line 40 of file ToastTest.php.

Referenced by test_toast().

+ Here is the caller graph for this function:

◆ getToastFactory()

ToastTest::getToastFactory ( )

Definition at line 30 of file ToastTest.php.

31 {
33 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

Referenced by test_implements_factory_interface(), test_toast(), and test_toast_container().

+ Here is the caller graph for this function:

◆ test_implements_factory_interface()

ToastTest::test_implements_factory_interface ( )

Definition at line 45 of file ToastTest.php.

45 : void
46 {
47 $f = $this->getToastFactory();
48
49 $this->assertInstanceOf("ILIAS\\UI\\Component\\Toast\\Factory", $f);
50
51 $this->assertInstanceOf("ILIAS\\UI\\Component\\Toast\\Toast", $f->standard('', $this->getIconFactory()->standard('', '')));
52 $this->assertInstanceOf("ILIAS\\UI\\Component\\Toast\\Container", $f->container());
53 }
getToastFactory()
Definition: ToastTest.php:30

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

+ Here is the call graph for this function:

◆ test_toast()

ToastTest::test_toast ( string  $title,
string  $description,
int  $vanish_time,
int  $delay_time,
string  $action 
)

@dataProvider toast_provider

Definition at line 58 of file ToastTest.php.

58 : void
59 {
60 $toast = $this->getToastFactory()->standard($title, $this->getIconFactory()->standard('', ''))
61 ->withDescription($description)
62 ->withVanishTime($vanish_time)
63 ->withDelayTime($delay_time)
64 ->withAction($action)
65 ->withAdditionalLink($this->getLinkFactory()->standard('', ''));
66
67 $this->assertNotNull($toast);
68 $this->assertEquals($title, $toast->getTitle());
69 $this->assertEquals($description, $toast->getDescription());
70 $this->assertEquals($vanish_time, $toast->getVanishTime());
71 $this->assertEquals($delay_time, $toast->getDelayTime());
72 $this->assertEquals($action, $toast->getAction());
73 $this->assertCount(1, $toast->getLinks());
74 $this->assertInstanceOf(Link::class, $toast->getLinks()[0]);
75 $this->assertCount(0, $toast->withoutLinks()->getLinks());
76 $this->assertInstanceOf(Icon::class, $toast->getIcon());
77 }
getLinkFactory()
Definition: ToastTest.php:40
getIconFactory()
Definition: ToastTest.php:35
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it.
Definition: standard.php:16

References getIconFactory(), getLinkFactory(), getToastFactory(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

+ Here is the call graph for this function:

◆ test_toast_container()

ToastTest::test_toast_container ( string  $title,
string  $description,
int  $vanish_time 
)

@dataProvider toast_provider

Definition at line 82 of file ToastTest.php.

82 : void
83 {
84 $container = $this->getToastFactory()->container()->withAdditionalToast(
85 $this->getToastFactory()->standard('', $this->getIconFactory()->standard('', ''))
86 );
87
88 $this->assertNotNull($container);
89 $this->assertCount(1, $container->getToasts());
90 $this->assertInstanceOf(Toast::class, $container->getToasts()[0]);
91 $this->assertCount(0, $container->withoutToasts()->getToasts());
92 }
$container
@noRector
Definition: wac.php:14

References $container, getIconFactory(), getToastFactory(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

+ Here is the call graph for this function:

◆ toast_provider()

ToastTest::toast_provider ( )

Definition at line 94 of file ToastTest.php.

94 : array
95 {
96 return [
97 ['title', 'description', 5000, 500, 'test.php'],
98 ['', '', -5000, -500, ''],
99 ['"/><script>alert("hack")</script>', '"/><script>alert("hack")</script>', PHP_INT_MAX, PHP_INT_MIN, 'test.php']
100 ];
101 }

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