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.

References ilSystemStyleMessage\TYPE_INFO.

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

146  {
147  $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringOne, ilSystemStyleMessage::TYPE_INFO);
149  }
Used to stack messages to be shown to the user.
+ Here is the caller graph for this function:

◆ testAddMessage()

ilSystemStyleMessageStackTest::testAddMessage ( )

Definition at line 68 of file ilSystemStyleMessageStackTest.php.

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

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.
Used to stack messages to be shown to the user.
+ Here is the call graph for this function:

◆ testGetAndSetMessages()

ilSystemStyleMessageStackTest::testGetAndSetMessages ( )

Definition at line 120 of file ilSystemStyleMessageStackTest.php.

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

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  }
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
Used to stack messages to be shown to the user.
+ Here is the call graph for this function:

◆ testHasMessages()

ilSystemStyleMessageStackTest::testHasMessages ( )

Definition at line 134 of file ilSystemStyleMessageStackTest.php.

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

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.
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
Used to stack messages to be shown to the user.
+ Here is the call graph for this function:

◆ testJoinedMessages()

ilSystemStyleMessageStackTest::testJoinedMessages ( )

Definition at line 91 of file ilSystemStyleMessageStackTest.php.

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

92  {
93  $this->createTestEnvironment();
94 
96 
99 
100  $this->ilSystemStyleMessage = new ilSystemStyleMessage("Another SUCCESS message", ilSystemStyleMessage::TYPE_SUCCESS);
102 
103  $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageStringThree, ilSystemStyleMessage::TYPE_ERROR);
105 
106  $this->ilSystemStyleMessage = new ilSystemStyleMessage("Another ERROR message", ilSystemStyleMessage::TYPE_ERROR);
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  }
addMessage(ilSystemStyleMessage $message)
Add a message to be displayed by the stack.
Used to stack messages to be shown to the user.
getJoinedMessages()
Return an array containing a string with all messages for each type.
+ Here is the call graph for this function:

◆ testPrependMessage()

ilSystemStyleMessageStackTest::testPrependMessage ( )

Definition at line 45 of file ilSystemStyleMessageStackTest.php.

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

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.
Used to stack messages to be shown to the user.
+ 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.

Referenced by testGetAndSetMessages().


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