[TASK] Drop eval() from BackendUtility test 96/43296/3
authorMathias Brodala <mbrodala@pagemachine.de>
Mon, 14 Sep 2015 13:08:24 +0000 (15:08 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Mon, 14 Sep 2015 20:44:27 +0000 (22:44 +0200)
Resolves: #69786
Releases: master
Change-Id: I211a3564830fa2ae2005807e9d2b81959965cbb7
Reviewed-on: http://review.typo3.org/43296
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php
typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php [new file with mode: 0644]

index 5836c9c..0558c7b 100644 (file)
@@ -16,13 +16,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Utility;
 
 use Prophecy\Argument;
 use Prophecy\Prophecy\ObjectProphecy;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithOneAllowedTableFixture;
-use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithMultipleAllowedTablesFixture;
-use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForSelectWithMMRelationFixture;
-use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\LabelFromItemListMergedReturnsCorrectFieldsFixture;
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\BackendUtilityFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ExcludeFieldsReturnsCorrectFieldListFixture;
 use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ExcludeFieldsReturnsCorrectListWithFlexFormFieldsFixture;
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\LabelFromItemListMergedReturnsCorrectFieldsFixture;
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithMultipleAllowedTablesFixture;
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForGroupWithOneAllowedTableFixture;
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\ProcessedValueForSelectWithMMRelationFixture;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
@@ -850,19 +851,7 @@ class BackendUtilityTest extends UnitTestCase {
                $GLOBALS['BE_USER']->expects($this->at(0))->method('getTSConfig')->will($this->returnValue($completeConfiguration));
                $GLOBALS['BE_USER']->expects($this->at(1))->method('getTSConfig')->will($this->returnValue(array('value' => NULL, 'properties' => NULL)));
 
-               $className = $this->getUniqueId('BackendUtility');
-               /** @var \PHPUnit_Framework_MockObject_MockObject|BackendUtility $subject */
-               $subject = __NAMESPACE__ . '\\' . $className;
-               eval(
-                       'namespace ' . __NAMESPACE__ . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Backend\\Utility\\BackendUtility {' .
-                       '  static public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = false) {' .
-                       '    return array();' .
-                       '  }' .
-                       '}'
-               );
-
-               $this->assertSame($completeConfiguration, $subject::getModTSconfig(42, 'notrelevant'));
+               $this->assertSame($completeConfiguration, BackendUtilityFixture::getModTSconfig(42, 'notrelevant'));
        }
 
        /**
diff --git a/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php b/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/BackendUtilityFixture.php
new file mode 100644 (file)
index 0000000..8438ace
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+namespace TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * BackendUtility fixture
+ */
+class BackendUtilityFixture extends \TYPO3\CMS\Backend\Utility\BackendUtility {
+
+       /**
+        * @param int $id
+        * @param array $rootLine
+        * @param bool $returnPartArray
+        * @return array
+        */
+       static public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE) {
+               return [];
+       }
+}