[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Tests / Unit / ViewHelpers / Format / PhpErrorCodeViewHelperTest.php
1 <?php
2 namespace TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format;
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 /**
18 * Test case
19 */
20 class PhpErrorCodeViewHelperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
21
22 /**
23 * @var \TYPO3\CMS\Fluid\ViewHelpers\Format\NumberViewHelper
24 */
25 protected $viewHelper;
26
27 /**
28 * Setup the test case scenario
29 */
30 public function setUp() {
31 $this->viewHelper = $this->getMock('TYPO3\CMS\Install\ViewHelpers\Format\PhpErrorCodeViewHelper', array('dummy'));
32 }
33
34 /**
35 * @return array
36 */
37 public function errorCodesDataProvider() {
38 return array(
39 array(
40 'errorCode' => E_ERROR,
41 'expectedString' => 'E_ERROR',
42 ),
43 array(
44 'errorCode' => E_ALL,
45 'expectedString' => 'E_ALL',
46 ),
47 array(
48 'errorCode' => E_ERROR ^ E_WARNING ^ E_PARSE,
49 'expectedString' => 'E_ERROR | E_WARNING | E_PARSE',
50 ),
51 array(
52 'errorCode' => E_RECOVERABLE_ERROR ^ E_USER_DEPRECATED,
53 'expectedString' => 'E_RECOVERABLE_ERROR | E_USER_DEPRECATED',
54 )
55 );
56 }
57
58 /**
59 * @param $errorCode
60 * @param $expectedString
61 * @test
62 * @dataProvider errorCodesDataProvider
63 */
64 public function renderPhpCodesCorrectly($errorCode, $expectedString) {
65 $actualString = $this->viewHelper->render($errorCode);
66 $this->assertEquals($expectedString, $actualString);
67 }
68
69 }