ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 145 of file ilSystemStyleMessageStackTest.php.

146 {
149 }
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 68 of file ilSystemStyleMessageStackTest.php.

69 {
70 $this->createTestEnvironment();
71
73
76
77 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
79 $this->messages = $this->ilSystemStyleMessageStack->getMessages();
80
81 $this->assertTrue($this->messages[2]->getMessage() === $this->messageStringThree);
82 $this->assertTrue($this->messages[2]->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
83
84 $this->assertTrue($this->messages[1]->getMessage() === $this->messageStringTwo);
85 $this->assertTrue($this->messages[1]->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
86
87 $this->assertTrue($this->messages[0]->getMessage() === $this->messageStringOne);
88 $this->assertTrue($this->messages[0]->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
89 }
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 120 of file ilSystemStyleMessageStackTest.php.

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

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

+ Here is the call graph for this function:

◆ testHasMessages()

ilSystemStyleMessageStackTest::testHasMessages ( )

Definition at line 134 of file ilSystemStyleMessageStackTest.php.

135 {
136 $this->createTestEnvironment();
137
138 $this->assertFalse($this->ilSystemStyleMessageStack->hasMessages());
139
141
142 $this->assertTrue($this->ilSystemStyleMessageStack->hasMessages());
143 }
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 91 of file ilSystemStyleMessageStackTest.php.

92 {
93 $this->createTestEnvironment();
94
96
99
102
103 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
105
108
109 $this->ilSystemStyleMessage = new ilSystemStyleMessage("YET another ERROR message", ilSystemStyleMessage::TYPE_ERROR);
111
112 $this->assertTrue(count($this->ilSystemStyleMessageStack->getJoinedMessages()) === 3);
113 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[0] === $this->messageStringOne . "</br>");
114 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[1] === $this->messageStringTwo .
115 "</br>" . "Another SUCCESS message" . "</br>");
116 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[2] === $this->messageStringThree .
117 "</br>" . "Another ERROR message" . "</br>" . "YET another ERROR message" . "</br>");
118 }
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 45 of file ilSystemStyleMessageStackTest.php.

46 {
47 $this->createTestEnvironment();
48
50
53
54 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
56 $this->messages = $this->ilSystemStyleMessageStack->getMessages();
57
58 $this->assertTrue($this->messages[0]->getMessage() === $this->messageStringThree);
59 $this->assertTrue($this->messages[0]->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
60
61 $this->assertTrue($this->messages[1]->getMessage() === $this->messageStringTwo);
62 $this->assertTrue($this->messages[1]->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
63
64 $this->assertTrue($this->messages[2]->getMessage() === $this->messageStringOne);
65 $this->assertTrue($this->messages[2]->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
66 }
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 18 of file ilSystemStyleMessageStackTest.php.

◆ $ilSystemStyleMessageStack

ilSystemStyleMessageStackTest::$ilSystemStyleMessageStack
protected

Definition at line 43 of file ilSystemStyleMessageStackTest.php.

◆ $messages

ilSystemStyleMessageStackTest::$messages = array()
protected

Definition at line 38 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringOne

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

Definition at line 23 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringThree

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

Definition at line 33 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringTwo

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

Definition at line 28 of file ilSystemStyleMessageStackTest.php.


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