ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 139 of file ilSystemStyleMessageStackTest.php.

139 {
142 }
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 66 of file ilSystemStyleMessageStackTest.php.

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

116 {
117 $this->createTestEnvironment();
118
120
123
124 $this->assertTrue($this->ilSystemStyleMessageStack->getMessages()[1]->getMessage() === $this->messageStringTwo);
125 $this->ilSystemStyleMessageStack->getMessages()[1]->setMessage("Godzilla has NOT taken over the world.");
126 $this->assertTrue($this->ilSystemStyleMessageStack->getMessages()[1]->getMessage() === "Godzilla has NOT taken over the world.");
127 }

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

+ Here is the call graph for this function:

◆ testHasMessages()

ilSystemStyleMessageStackTest::testHasMessages ( )

Definition at line 129 of file ilSystemStyleMessageStackTest.php.

129 {
130 $this->createTestEnvironment();
131
132 $this->assertFalse($this->ilSystemStyleMessageStack->hasMessages());
133
135
136 $this->assertTrue($this->ilSystemStyleMessageStack->hasMessages());
137 }
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 88 of file ilSystemStyleMessageStackTest.php.

88 {
89 $this->createTestEnvironment();
90
92
95
98
99 $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
101
104
105 $this->ilSystemStyleMessage = new ilSystemStyleMessage("YET another ERROR message", ilSystemStyleMessage::TYPE_ERROR);
107
108 $this->assertTrue(count($this->ilSystemStyleMessageStack->getJoinedMessages()) === 3);
109 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[0] === $this->messageStringOne . "</br>");
110 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[1] === $this->messageStringTwo .
111 "</br>" . "Another SUCCESS message" . "</br>");
112 $this->assertTrue($this->ilSystemStyleMessageStack->getJoinedMessages()[2] === $this->messageStringThree .
113 "</br>" . "Another ERROR message" . "</br>" . "YET another ERROR message" . "</br>");
114 }
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 44 of file ilSystemStyleMessageStackTest.php.

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

◆ $ilSystemStyleMessageStack

ilSystemStyleMessageStackTest::$ilSystemStyleMessageStack
protected

Definition at line 42 of file ilSystemStyleMessageStackTest.php.

◆ $messages

ilSystemStyleMessageStackTest::$messages = array()
protected

Definition at line 37 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringOne

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

Definition at line 22 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringThree

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

Definition at line 32 of file ilSystemStyleMessageStackTest.php.

◆ $messageStringTwo

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

Definition at line 27 of file ilSystemStyleMessageStackTest.php.


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