TYPO3  7.6
PhpErrorCodeViewHelperTest.php
Go to the documentation of this file.
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 
18 
22 class PhpErrorCodeViewHelperTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
23 {
27  protected $viewHelper;
28 
32  protected function setUp()
33  {
34  $this->viewHelper = $this->getMock(\TYPO3\CMS\Install\ViewHelpers\Format\PhpErrorCodeViewHelper::class, array('dummy'));
36  $renderingContext = $this->getMock(RenderingContext::class);
37  $this->viewHelper->setRenderingContext($renderingContext);
38  }
39 
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 
71  public function renderPhpCodesCorrectly($errorCode, $expectedString)
72  {
73  $actualString = $this->viewHelper->render($errorCode);
74  $this->assertEquals($expectedString, $actualString);
75  }
76 }