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