ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilSystemStyleMessageStackTest Class Reference
+ Inheritance diagram for ilSystemStyleMessageStackTest:
+ Collaboration diagram for ilSystemStyleMessageStackTest:

Public Member Functions

 testPrependMessage ()
 
 testAddMessage ()
 
 testJoinedMessages ()
 
 testGetAndSetMessages ()
 
 testHasMessages ()
 

Protected Member Functions

 createTestEnvironment ()
 

Protected Attributes

 $ilSystemStyleMessage
 
 $messageStringOne = "This is a message"
 
 $messageStringTwo = "Godzilla has taken over the world."
 
 $messageStringThree = "A small, cute cat destroyed Godzilla."
 
 $messages = array()
 
 $ilSystemStyleMessageStack
 

Detailed Description

Member Function Documentation

◆ createTestEnvironment()

ilSystemStyleMessageStackTest::createTestEnvironment ( )
protected

Definition at line 147 of file ilSystemStyleMessageStackTest.php.

148 {
151 }
Used to stack messages to be shown to the user.

References ilSystemStyleMessage\TYPE_INFO.

Referenced by testAddMessage(), testGetAndSetMessages(), testHasMessages(), testJoinedMessages(), and testPrependMessage().

+ Here is the caller graph for this function:

◆ testAddMessage()

ilSystemStyleMessageStackTest::testAddMessage ( )

Definition at line 70 of file ilSystemStyleMessageStackTest.php.

71 {
72 $this->createTestEnvironment();
73
75
78
79 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
81 $this->messages = $this->ilSystemStyleMessageStack->getMessages();
82
83 $this->assertTrue($this->messages[2]->getMessage() === $this->messageStringThree);
84 $this->assertTrue($this->messages[2]->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
85
86 $this->assertTrue($this->messages[1]->getMessage() === $this->messageStringTwo);
87 $this->assertTrue($this->messages[1]->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
88
89 $this->assertTrue($this->messages[0]->getMessage() === $this->messageStringOne);
90 $this->assertTrue($this->messages[0]->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
91 }
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.

References ilSystemStyleMessageStack\addMessage(), createTestEnvironment(), ilSystemStyleMessageStack\getMessages(), ilSystemStyleMessage\TYPE_ERROR, ilSystemStyleMessage\TYPE_INFO, and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ testGetAndSetMessages()

ilSystemStyleMessageStackTest::testGetAndSetMessages ( )

Definition at line 122 of file ilSystemStyleMessageStackTest.php.

123 {
124 $this->createTestEnvironment();
125
127
130
131 $this->assertTrue($this->ilSystemStyleMessageStack->getMessages()[1]->getMessage() === $this->messageStringTwo);
132 $this->ilSystemStyleMessageStack->getMessages()[1]->setMessage("Godzilla has NOT taken over the world.");
133 $this->assertTrue($this->ilSystemStyleMessageStack->getMessages()[1]->getMessage() === "Godzilla has NOT taken over the world.");
134 }

References ilSystemStyleMessageStack\addMessage(), createTestEnvironment(), ilSystemStyleMessageStack\getMessages(), and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ testHasMessages()

ilSystemStyleMessageStackTest::testHasMessages ( )

Definition at line 136 of file ilSystemStyleMessageStackTest.php.

137 {
138 $this->createTestEnvironment();
139
140 $this->assertFalse($this->ilSystemStyleMessageStack->hasMessages());
141
143
144 $this->assertTrue($this->ilSystemStyleMessageStack->hasMessages());
145 }
hasMessages()
Return wheter there are any message at all stored in the stack.

References ilSystemStyleMessageStack\addMessage(), createTestEnvironment(), and ilSystemStyleMessageStack\hasMessages().

+ Here is the call graph for this function:

◆ testJoinedMessages()

ilSystemStyleMessageStackTest::testJoinedMessages ( )

Definition at line 93 of file ilSystemStyleMessageStackTest.php.

94 {
95 $this->createTestEnvironment();
96
98
101
104
105 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
107
110
111 $this->ilSystemStyleMessage = new ilSystemStyleMessage("YET another ERROR message", ilSystemStyleMessage::TYPE_ERROR);
113
114 $this->assertTrue(count($this->ilSystemStyleMessageStack->getJoinedMessages()) === 3);
115 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[0] === $this->messageStringOne . "</br>");
116 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[1] === $this->messageStringTwo .
117 "</br>" . "Another SUCCESS message" . "</br>");
118 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[2] === $this->messageStringThree .
119 "</br>" . "Another ERROR message" . "</br>" . "YET another ERROR message" . "</br>");
120 }
getJoinedMessages()
Return an array containing a string with all messages for each type.

References ilSystemStyleMessageStack\addMessage(), createTestEnvironment(), ilSystemStyleMessageStack\getJoinedMessages(), ilSystemStyleMessage\TYPE_ERROR, and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

◆ testPrependMessage()

ilSystemStyleMessageStackTest::testPrependMessage ( )

Definition at line 47 of file ilSystemStyleMessageStackTest.php.

48 {
49 $this->createTestEnvironment();
50
52
55
56 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
58 $this->messages = $this->ilSystemStyleMessageStack->getMessages();
59
60 $this->assertTrue($this->messages[0]->getMessage() === $this->messageStringThree);
61 $this->assertTrue($this->messages[0]->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
62
63 $this->assertTrue($this->messages[1]->getMessage() === $this->messageStringTwo);
64 $this->assertTrue($this->messages[1]->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
65
66 $this->assertTrue($this->messages[2]->getMessage() === $this->messageStringOne);
67 $this->assertTrue($this->messages[2]->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
68 }
prependMessage(ilSystemStyleMessage $message)
Add a message to be displayed before all others.

References createTestEnvironment(), ilSystemStyleMessageStack\getMessages(), ilSystemStyleMessageStack\prependMessage(), ilSystemStyleMessage\TYPE_ERROR, ilSystemStyleMessage\TYPE_INFO, and ilSystemStyleMessage\TYPE_SUCCESS.

+ Here is the call graph for this function:

Field Documentation

◆ $ilSystemStyleMessage

ilSystemStyleMessageStackTest::$ilSystemStyleMessage
protected

Definition at line 20 of file ilSystemStyleMessageStackTest.php.

◆ $ilSystemStyleMessageStack

ilSystemStyleMessageStackTest::$ilSystemStyleMessageStack
protected

Definition at line 45 of file ilSystemStyleMessageStackTest.php.

◆ $messages

ilSystemStyleMessageStackTest::$messages = array()
protected

Definition at line 40 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringOne

ilSystemStyleMessageStackTest::$messageStringOne = "This is a message"
protected

Definition at line 25 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringThree

ilSystemStyleMessageStackTest::$messageStringThree = "A small, cute cat destroyed Godzilla."
protected

Definition at line 35 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringTwo

ilSystemStyleMessageStackTest::$messageStringTwo = "Godzilla has taken over the world."
protected

Definition at line 30 of file ilSystemStyleMessageStackTest.php.


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