‪TYPO3CMS  9.5
PhpErrorCodeViewHelperTest.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 
17 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
18 
22 class ‪PhpErrorCodeViewHelperTest extends ViewHelperBaseTestcase
23 {
27  protected ‪$viewHelper;
28 
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 
43  public function ‪errorCodesDataProvider()
44  {
45  return [
46  [
47  'errorCode' => E_ERROR,
48  'expectedString' => 'E_ERROR',
49  ],
50  [
51  'errorCode' => E_ALL,
52  'expectedString' => 'E_ALL',
53  ],
54  [
55  'errorCode' => E_ERROR ^ E_WARNING ^ E_PARSE,
56  'expectedString' => 'E_ERROR | E_WARNING | E_PARSE',
57  ],
58  [
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  $this->viewHelper->setArguments([
74  'phpErrorCode' => $errorCode
75  ]);
76  $actualString = $this->viewHelper->render();
77  $this->assertEquals($expectedString, $actualString);
78  }
79 }
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format\PhpErrorCodeViewHelperTest
Definition: PhpErrorCodeViewHelperTest.php:23
‪TYPO3
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format\PhpErrorCodeViewHelperTest\renderPhpCodesCorrectly
‪renderPhpCodesCorrectly($errorCode, $expectedString)
Definition: PhpErrorCodeViewHelperTest.php:70
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format\PhpErrorCodeViewHelperTest\setUp
‪setUp()
Definition: PhpErrorCodeViewHelperTest.php:31
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format\PhpErrorCodeViewHelperTest\errorCodesDataProvider
‪array errorCodesDataProvider()
Definition: PhpErrorCodeViewHelperTest.php:42
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format
Definition: PhpErrorCodeViewHelperTest.php:2
‪TYPO3\CMS\Install\Tests\Unit\ViewHelpers\Format\PhpErrorCodeViewHelperTest\$viewHelper
‪TYPO3 CMS Fluid ViewHelpers Format NumberViewHelper $viewHelper
Definition: PhpErrorCodeViewHelperTest.php:26