ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ToastTest Class Reference
+ Inheritance diagram for ToastTest:
+ Collaboration diagram for ToastTest:

Public Member Functions

 getToastFactory ()
 
 getIconFactory ()
 
 getLinkFactory ()
 
 testImplementsFactoryInterface ()
 
 testToast (string $title, string $description, string $action)
 
 testToastContainer (string $title, string $description)
 

Static Public Member Functions

static getToastProvider ()
 

Detailed Description

Definition at line 28 of file ToastTest.php.

Member Function Documentation

◆ getIconFactory()

ToastTest::getIconFactory ( )

◆ getLinkFactory()

ToastTest::getLinkFactory ( )

Definition at line 40 of file ToastTest.php.

Referenced by testToast().

+ Here is the caller graph for this function:

◆ getToastFactory()

ToastTest::getToastFactory ( )

Definition at line 30 of file ToastTest.php.

Referenced by testImplementsFactoryInterface(), testToast(), and testToastContainer().

+ Here is the caller graph for this function:

◆ getToastProvider()

static ToastTest::getToastProvider ( )
static

Definition at line 86 of file ToastTest.php.

86 : array
87 {
88 return [
89 ['title', 'description', 'test.php'],
90 ['', '', ''],
91 ['"/><script>alert("hack")</script>', '"/><script>alert("hack")</script>', 'test.php']
92 ];
93 }

◆ testImplementsFactoryInterface()

ToastTest::testImplementsFactoryInterface ( )

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:

◆ testToast()

ToastTest::testToast ( string  $title,
string  $description,
string  $action 
)

Definition at line 56 of file ToastTest.php.

56 : void
57 {
58 $toast = $this->getToastFactory()->standard($title, $this->getIconFactory()->standard('', ''))
59 ->withDescription($description)
60 ->withAction($action)
61 ->withAdditionalLink($this->getLinkFactory()->standard('', ''));
62
63 $this->assertNotNull($toast);
64 $this->assertEquals($title, $toast->getTitle());
65 $this->assertEquals($description, $toast->getDescription());
66 $this->assertEquals($action, $toast->getAction());
67 $this->assertCount(1, $toast->getLinks());
68 $this->assertInstanceOf(Link::class, $toast->getLinks()[0]);
69 $this->assertCount(0, $toast->withoutLinks()->getLinks());
70 $this->assertInstanceOf(Icon::class, $toast->getIcon());
71 }
getLinkFactory()
Definition: ToastTest.php:40
getIconFactory()
Definition: ToastTest.php:35

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

+ Here is the call graph for this function:

◆ testToastContainer()

ToastTest::testToastContainer ( string  $title,
string  $description 
)

Definition at line 74 of file ToastTest.php.

74 : void
75 {
76 $container = $this->getToastFactory()->container()->withAdditionalToast(
77 $this->getToastFactory()->standard('', $this->getIconFactory()->standard('', ''))
78 );
79
80 $this->assertNotNull($container);
81 $this->assertCount(1, $container->getToasts());
82 $this->assertInstanceOf(Toast::class, $container->getToasts()[0]);
83 $this->assertCount(0, $container->withoutToasts()->getToasts());
84 }
$container
@noRector
Definition: wac.php:37

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

+ Here is the call graph for this function:

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