ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilSystemStyleMessageTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once('vendor/composer/vendor/autoload.php');
22 
24 
26 {
28  protected string $messageString = 'This is a message';
29 
30  public function testConstructor(): void
31  {
33  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
34  $this->assertTrue($this->ilSystemStyleMessage->getMessage() === $this->messageString);
35 
36  $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageString, ilSystemStyleMessage::TYPE_SUCCESS);
37  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
38  $this->assertTrue($this->ilSystemStyleMessage->getMessage() === $this->messageString);
39 
40  $this->ilSystemStyleMessage = new ilSystemStyleMessage($this->messageString, ilSystemStyleMessage::TYPE_ERROR);
41  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
42  $this->assertTrue($this->ilSystemStyleMessage->getMessage() === $this->messageString);
43  }
44 
45  public function testGetAndSetMessage(): void
46  {
48  $this->ilSystemStyleMessage->setMessage('This is an altered message');
49  $this->assertTrue($this->ilSystemStyleMessage->getMessage() === 'This is an altered message');
50  }
51 
52  public function testGetAndSetTypeID(): void
53  {
56  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_SUCCESS);
57 
59  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_ERROR);
60 
62  $this->assertTrue($this->ilSystemStyleMessage->getTypeId() === ilSystemStyleMessage::TYPE_INFO);
63  }
64 
65  public function testGetMessageOutput(): void
66  {
68  $this->assertTrue($this->ilSystemStyleMessage->getMessageOutput() === 'This is a message</br>');
69  }
70 }
ilSystemStyleMessage $ilSystemStyleMessage