[TASK] Move ViewHelper arguments to initializeArguments() in ext:install
[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 use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
18
19 /**
20 * Test case
21 */
22 class PhpErrorCodeViewHelperTest extends ViewHelperBaseTestcase
23 {
24 /**
25 * @var \TYPO3\CMS\Fluid\ViewHelpers\Format\NumberViewHelper
26 */
27 protected $viewHelper;
28
29 /**
30 * Setup the test case scenario
31 */
32 protected function setUp()
33 {
34 parent::setUp();
35 $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Install\ViewHelpers\Format\PhpErrorCodeViewHelper::class, ['dummy']);
36 $this->injectDependenciesIntoViewHelper($this->viewHelper);
37 $this->viewHelper->initializeArguments();
38 }
39
40 /**
41 * @return array
42 */
43 public function errorCodesDataProvider()
44 {
45 return array(
46 array(
47 'errorCode' => E_ERROR,
48 'expectedString' => 'E_ERROR',
49 ),
50 array(
51 'errorCode' => E_ALL,
52 'expectedString' => 'E_ALL',
53 ),
54 array(
55 'errorCode' => E_ERROR ^ E_WARNING ^ E_PARSE,
56 'expectedString' => 'E_ERROR | E_WARNING | E_PARSE',
57 ),
58 array(
59 'errorCode' => E_RECOVERABLE_ERROR ^ E_USER_DEPRECATED,
60 'expectedString' => 'E_RECOVERABLE_ERROR | E_USER_DEPRECATED',
61 )
62 );
63 }
64
65 /**
66 * @param $errorCode
67 * @param $expectedString
68 * @test
69 * @dataProvider errorCodesDataProvider
70 */
71 public function renderPhpCodesCorrectly($errorCode, $expectedString)
72 {
73 $this->viewHelper->setArguments([
74 'phpErrorCode' => $errorCode
75 ]);
76 $actualString = $this->viewHelper->render();
77 $this->assertEquals($expectedString, $actualString);
78 }
79 }