TYPO3  7.6
StatusUtilityTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Install\Tests\Unit\Status;
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 
18 
22 class StatusUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
23 {
28  {
29  $errorMock = $this->getMock(\TYPO3\CMS\Install\Status\ErrorStatus::class, array('dummy'));
30  $warningMock = $this->getMock(\TYPO3\CMS\Install\Status\WarningStatus::class, array('dummy'));
31  $okMock = $this->getMock(\TYPO3\CMS\Install\Status\OkStatus::class, array('dummy'));
32  $infoMock = $this->getMock(\TYPO3\CMS\Install\Status\InfoStatus::class, array('dummy'));
33  $noticeMock = $this->getMock(\TYPO3\CMS\Install\Status\NoticeStatus::class, array('dummy'));
34  $statusUtility = new StatusUtility();
35  $return = $statusUtility->sortBySeverity(array($noticeMock, $infoMock, $okMock, $warningMock, $errorMock));
36  $this->assertSame(array($errorMock), $return['error']);
37  $this->assertSame(array($warningMock), $return['warning']);
38  $this->assertSame(array($okMock), $return['ok']);
39  $this->assertSame(array($infoMock), $return['information']);
40  $this->assertSame(array($noticeMock), $return['notice']);
41  }
42 
48  {
49  $statusUtility = new StatusUtility();
50  $statusUtility->filterBySeverity(array(new \stdClass()));
51  }
52 
57  {
58  $errorMock = $this->getMock(\TYPO3\CMS\Install\Status\ErrorStatus::class, array('dummy'));
59  $warningMock = $this->getMock(\TYPO3\CMS\Install\Status\WarningStatus::class, array('dummy'));
60  $statusUtility = new StatusUtility();
61  $return = $statusUtility->filterBySeverity(array($errorMock, $warningMock), 'error');
62  $this->assertSame(array($errorMock), $return);
63  }
64 }