65ee1567f18c6652c8bd721000e5332485440d26
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / Tests / Unit / Report / Status / Typo3StatusTest.php
1 <?php
2 namespace TYPO3\CMS\Reports\Tests\Unit\Report\Status;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Test case
29 */
30 class Typo3StatusTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
31
32 /**
33 * Set up
34 */
35 public function setUp() {
36 $GLOBALS['LANG'] = $this->getMock('TYPO3\\CMS\\Lang\\LanguageService', array(), array(), '', FALSE);
37 }
38
39 /**
40 * @test
41 */
42 public function getStatusReturnsOldXclassStatusObjectWithSeverityOkIfNoOldXclassExists() {
43 $GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'] = array();
44 $GLOBALS['TYPO3_CONF_VARS']['FE']['XCLASS'] = array();
45 $fixture = new \TYPO3\CMS\Reports\Report\Status\Typo3Status;
46 $result = $fixture->getStatus();
47 $statusObject = $result['oldXclassStatus'];
48 $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $statusObject->getSeverity());
49 }
50
51 /**
52 * @test
53 */
54 public function getStatusReturnsOldXclassStatusObjectWithSeverityNoticeIfOldXclassExists() {
55 $GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'] = array('foo' => 'bar');
56 $fixture = new \TYPO3\CMS\Reports\Report\Status\Typo3Status;
57 $result = $fixture->getStatus();
58 $statusObject = $result['oldXclassStatus'];
59 $this->assertSame(\TYPO3\CMS\Reports\Status::NOTICE, $statusObject->getSeverity());
60 }
61
62 /**
63 * @test
64 */
65 public function getStatusReturnsXclassStatusObjectWithSeverityOkIfNoXclassExists() {
66 $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] = array();
67 $fixture = new \TYPO3\CMS\Reports\Report\Status\Typo3Status;
68 $result = $fixture->getStatus();
69 $statusObject = $result['registeredXclass'];
70 $this->assertSame(\TYPO3\CMS\Reports\Status::OK, $statusObject->getSeverity());
71 }
72
73 /**
74 * @test
75 */
76 public function getStatusReturnsXclassStatusObjectWithSeverityNoticeIfXclassExists() {
77 $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'] = array(
78 'foo' => array(
79 'className' => 'bar',
80 )
81 );
82 $fixture = new \TYPO3\CMS\Reports\Report\Status\Typo3Status;
83 $result = $fixture->getStatus();
84 $statusObject = $result['registeredXclass'];
85 $this->assertSame(\TYPO3\CMS\Reports\Status::NOTICE, $statusObject->getSeverity());
86 }
87 }