‪TYPO3CMS  10.4
MessageTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪MessageTest extends UnitTestCase
25 {
30  {
31  $messageMessage = 'The message';
32  $error = new ‪Message($messageMessage, 0);
33  self::assertEquals($messageMessage, $error->getMessage());
34  }
35 
40  {
41  $messageCode = 123456789;
42  $error = new ‪Message('', $messageCode);
43  self::assertEquals($messageCode, $error->getCode());
44  }
45 
50  {
51  $messageArguments = ['foo', 'bar'];
52  $error = new ‪Message('', 1, $messageArguments);
53  self::assertEquals($messageArguments, $error->getArguments());
54  }
55 
60  {
61  $messageTitle = 'Title';
62  $error = new ‪Message('', 1, [], $messageTitle);
63  self::assertEquals($messageTitle, $error->getTitle());
64  }
65 
70  {
71  $error = new ‪Message('Message', 1);
72  self::assertEquals('Message', $error->render());
73  }
74 
79  {
80  $error = new ‪Message('Foo is %s and Bar is %s', 1, ['baz', 'qux']);
81  self::assertEquals('Foo is baz and Bar is qux', $error->render());
82  }
83 
87  public function ‪toStringCallsRender()
88  {
89  $error = new ‪Message('Foo is %s and Bar is %s', 1, ['baz', 'qux']);
90  self::assertEquals('Foo is baz and Bar is qux', $error);
91  }
92 }
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\theConstructorSetsTheMessageTitleCorrectly
‪theConstructorSetsTheMessageTitleCorrectly()
Definition: MessageTest.php:59
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\theConstructorSetsTheMessageArgumentsCorrectly
‪theConstructorSetsTheMessageArgumentsCorrectly()
Definition: MessageTest.php:49
‪TYPO3\CMS\Extbase\Error\Message
Definition: Message.php:24
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\renderRendersCorrectlyWithoutArguments
‪renderRendersCorrectlyWithoutArguments()
Definition: MessageTest.php:69
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\renderRendersCorrectlyWithArguments
‪renderRendersCorrectlyWithArguments()
Definition: MessageTest.php:78
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest
Definition: MessageTest.php:25
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\toStringCallsRender
‪toStringCallsRender()
Definition: MessageTest.php:87
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\theConstructorSetsTheMessageCodeCorrectly
‪theConstructorSetsTheMessageCodeCorrectly()
Definition: MessageTest.php:39
‪TYPO3\CMS\Extbase\Tests\Unit\Error
Definition: ErrorTest.php:16
‪TYPO3\CMS\Extbase\Tests\Unit\Error\MessageTest\theConstructorSetsTheMessageMessageCorrectly
‪theConstructorSetsTheMessageMessageCorrectly()
Definition: MessageTest.php:29