[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Tests / Unit / View / JsonViewTest.php
1 <?php
2 namespace TYPO3\CMS\Install\Tests\Unit\View;
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\CMS\Core\Tests\UnitTestCase;
18
19 /**
20 * Tests for the custom json view class
21 */
22 class JsonViewTest extends UnitTestCase {
23 /**
24 * @test
25 */
26 public function transformStatusArrayToArrayReturnsArray() {
27 $jsonView = $this->getAccessibleMock('TYPO3\\CMS\\Install\\View\\JsonView', array('dummy'));
28 $this->assertInternalType('array', $jsonView->_call('transformStatusMessagesToArray'));
29 }
30
31 /**
32 * @test
33 * @expectedException \TYPO3\CMS\Install\Status\Exception
34 */
35 public function transformStatusArrayToArrayThrowsExceptionIfArrayContainsNotAMessageInterfaceMessage() {
36 $jsonView = $this->getAccessibleMock('TYPO3\\CMS\\Install\\View\\JsonView', array('dummy'));
37 $jsonView->_call('transformStatusMessagesToArray', array('foo'));
38 }
39
40 /**
41 * @test
42 */
43 public function transformStatusToArrayCreatesArrayFromStatusMessage() {
44 $status = $this->getMock('TYPO3\\CMS\\Install\\Status\\StatusInterface');
45 $status->expects($this->once())->method('getSeverity')->will($this->returnValue('aSeverity'));
46 $status->expects($this->once())->method('getTitle')->will($this->returnValue('aTitle'));
47 $status->expects($this->once())->method('getMessage')->will($this->returnValue('aMessage'));
48 $jsonView = $this->getAccessibleMock('TYPO3\\CMS\\Install\\View\\JsonView', array('dummy'));
49 $return = $jsonView->_call('transformStatusToArray', $status);
50 $this->assertSame('aSeverity', $return['severity']);
51 $this->assertSame('aTitle', $return['title']);
52 $this->assertSame('aMessage', $return['message']);
53 }
54 }