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