[TASK] Removes eval() in Unit Tests 11/40511/4
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 21 Jun 2015 15:42:25 +0000 (17:42 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 22 Jun 2015 09:46:54 +0000 (11:46 +0200)
Resolves: #67664
Releases: master
Change-Id: Ie76a225f6961055b9078ad97b4cf8bc62fd7417e
Reviewed-on: http://review.typo3.org/40511
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Tests/Unit/Utility/Fixtures/IconUtilityFixture.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Unit/Utility/IconUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Fixtures/LatestCompatibleExtensionObjectStorageFixture.php [new file with mode: 0644]
typo3/sysext/extensionmanager/Tests/Unit/Utility/DependencyUtilityTest.php
typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithFormPrefixFixture.php [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutFormPrefixFixture.php [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutInterfaceFixture.php [new file with mode: 0644]
typo3/sysext/form/Tests/Unit/PostProcess/PostProcessorTest.php
typo3/sysext/frontend/Tests/Unit/Fixtures/AdminPanelHookWithoutInterfaceFixture.php [new file with mode: 0644]
typo3/sysext/frontend/Tests/Unit/View/AdminPanelViewTest.php

diff --git a/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/IconUtilityFixture.php b/typo3/sysext/backend/Tests/Unit/Utility/Fixtures/IconUtilityFixture.php
new file mode 100644 (file)
index 0000000..8473462
--- /dev/null
@@ -0,0 +1,27 @@
+<?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!
+ */
+
+/**
+ * IconUtility fixture
+ */
+class IconUtilityFixture extends \TYPO3\CMS\Backend\Utility\IconUtility {
+
+       /**
+        * @var array
+        */
+       static protected $spriteIconCache = array();
+
+}
\ No newline at end of file
index fc42e0c..d681026 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Tests\Unit\Utility\Fixtures\IconUtilityFixture;
+
 /**
  * Test case
  *
@@ -45,29 +47,6 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        );
 
        /**
-        * @var \TYPO3\CMS\Backend\Utility\IconUtility A testable overlay with disabled cache
-        */
-       protected $subject;
-
-       /**
-        * Set up test case
-        *
-        * @return void
-        */
-       protected function setUp() {
-               // Create a wrapper for IconUtility, so the static property $spriteIconCache is
-               // not polluted. Use this as subject!
-               $className = $this->getUniqueId('IconUtility');
-               eval(
-                       'namespace ' . __NAMESPACE__ . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Backend\\Utility\\IconUtility {' .
-                       '  static protected $spriteIconCache = array();' .
-                       '}'
-               );
-               $this->subject = __NAMESPACE__ . '\\' . $className;
-       }
-
-       /**
         * Create folder object to use as test subject
         *
         * @param string $identifier
@@ -92,7 +71,6 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $mockedStorage = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', FALSE);
                $mockedFile = $this->getMock(\TYPO3\CMS\Core\Resource\File::class, array(), array(array(), $mockedStorage));
                $mockedFile->expects($this->once())->method('getExtension')->will($this->returnValue($extension));
-
                return $mockedFile;
        }
 
@@ -112,8 +90,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $targetFilename = PATH_site . 'typo3temp/' . $this->getUniqueId('test_') . '.gif';
                $this->testFilesToDelete[] = $targetFilename;
                $GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'] = '0777';
-               $subject = $this->subject;
-               $subject::imagemake($fixtureGifRessource, $targetFilename);
+               IconUtilityFixture::imagemake($fixtureGifRessource, $targetFilename);
                clearstatcache();
                $resultFilePermissions = substr(decoct(fileperms($targetFilename)), 2);
                $this->assertEquals($resultFilePermissions, '0777');
@@ -128,8 +105,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconClassesWithEmptyStringReturnsT3Icon() {
-               $subject = $this->subject;
-               $this->assertEquals('t3-icon', $subject::getSpriteIconClasses(''));
+               $this->assertEquals('t3-icon', IconUtilityFixture::getSpriteIconClasses(''));
        }
 
        /**
@@ -138,8 +114,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconClassesWithOnePartReturnsT3Icon() {
-               $subject = $this->subject;
-               $this->assertEquals('t3-icon', $subject::getSpriteIconClasses('actions'));
+               $this->assertEquals('t3-icon', IconUtilityFixture::getSpriteIconClasses('actions'));
        }
 
        /**
@@ -148,8 +123,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconClassesWithTwoPartsReturnsT3IconAndCombinedParts() {
-               $subject = $this->subject;
-               $result = explode(' ', $subject::getSpriteIconClasses('actions-juggle'));
+               $result = explode(' ', IconUtilityFixture::getSpriteIconClasses('actions-juggle'));
                sort($result);
                $this->assertEquals(array('t3-icon', 't3-icon-actions', 't3-icon-actions-juggle', 't3-icon-juggle'), $result);
        }
@@ -160,8 +134,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconClassesWithThreePartsReturnsT3IconAndCombinedParts() {
-               $subject = $this->subject;
-               $result = explode(' ', $subject::getSpriteIconClasses('actions-juggle-speed'));
+               $result = explode(' ', IconUtilityFixture::getSpriteIconClasses('actions-juggle-speed'));
                sort($result);
                $this->assertEquals(array('t3-icon', 't3-icon-actions', 't3-icon-actions-juggle', 't3-icon-juggle-speed'), $result);
        }
@@ -172,8 +145,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconClassesWithFourPartsReturnsT3IconAndCombinedParts() {
-               $subject = $this->subject;
-               $result = explode(' ', $subject::getSpriteIconClasses('actions-juggle-speed-game'));
+               $result = explode(' ', IconUtilityFixture::getSpriteIconClasses('actions-juggle-speed-game'));
                sort($result);
                $this->assertEquals(array('t3-icon', 't3-icon-actions', 't3-icon-actions-juggle', 't3-icon-juggle-speed-game'), $result);
        }
@@ -193,8 +165,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"> </span>', $subject::getSpriteIcon(''));
+               $this->assertEquals('<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"> </span>', IconUtilityFixture::getSpriteIcon(''));
        }
 
        /**
@@ -209,8 +180,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"> </span>', $subject::getSpriteIcon('actions-juggle-speed'));
+               $this->assertEquals('<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"> </span>', IconUtilityFixture::getSpriteIcon('actions-juggle-speed'));
        }
 
        /**
@@ -226,8 +196,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>', $subject::getSpriteIcon('actions-document-new'));
+               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>', IconUtilityFixture::getSpriteIcon('actions-document-new'));
        }
 
        /**
@@ -243,8 +212,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span title="foo" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>', $subject::getSpriteIcon('actions-document-new', array('title' => 'foo')));
+               $this->assertEquals('<span title="foo" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"> </span>', IconUtilityFixture::getSpriteIcon('actions-document-new', array('title' => 'foo')));
        }
 
        /**
@@ -260,8 +228,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new foo"> </span>', $subject::getSpriteIcon('actions-document-new', array('class' => 'foo')));
+               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new foo"> </span>', IconUtilityFixture::getSpriteIcon('actions-document-new', array('class' => 'foo')));
        }
 
        /**
@@ -277,8 +244,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">foo</span>', $subject::getSpriteIcon('actions-document-new', array('html' => 'foo')));
+               $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">foo</span>', IconUtilityFixture::getSpriteIcon('actions-document-new', array('html' => 'foo')));
        }
 
        /**
@@ -295,8 +261,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $result = $subject::getSpriteIcon('actions-document-new', array(), array('status-overlay-hidden' => array()));
+               $result = IconUtilityFixture::getSpriteIcon('actions-document-new', array(), array('status-overlay-hidden' => array()));
                $overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay"> </span>';
                $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">' . $overlay . '</span>', $result);
        }
@@ -315,8 +280,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $result = $subject::getSpriteIcon('actions-document-new', array('html' => 'foo1'), array('status-overlay-hidden' => array('class' => 'foo2')));
+               $result = IconUtilityFixture::getSpriteIcon('actions-document-new', array('html' => 'foo1'), array('status-overlay-hidden' => array('class' => 'foo2')));
                $overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden foo2 t3-icon-overlay">foo1</span>';
                $this->assertEquals('<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">' . $overlay . '</span>', $result);
        }
@@ -330,8 +294,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForRecordWithNullTableReturnsMissingIcon() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('', array());
+               $result = IconUtilityFixture::getSpriteIconForRecord('', array());
                $this->assertEquals('<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"> </span>', $result);
        }
 
@@ -356,8 +319,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('tt_content', array());
+               $result = IconUtilityFixture::getSpriteIconForRecord('tt_content', array());
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text"> </span>', $result);
        }
 
@@ -382,8 +344,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('tt_content', $this->mockRecord);
+               $result = IconUtilityFixture::getSpriteIconForRecord('tt_content', $this->mockRecord);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text"> </span>', $result);
        }
 
@@ -408,8 +369,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ),
                        ),
                );
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('tt_content', $this->mockRecord, array('class' => 'foo', 'title' => 'bar'));
+               $result = IconUtilityFixture::getSpriteIconForRecord('tt_content', $this->mockRecord, array('class' => 'foo', 'title' => 'bar'));
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text foo" title="bar"> </span>', $result);
        }
 
@@ -436,8 +396,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                $mockRecord = $this->mockRecord;
                $mockRecord['CType'] = 'list';
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('tt_content', $mockRecord);
+               $result = IconUtilityFixture::getSpriteIconForRecord('tt_content', $mockRecord);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-plugin"> </span>', $result);
        }
 
@@ -476,8 +435,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                $mockRecord = $this->mockRecord;
                $mockRecord['hidden'] = '1';
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForRecord('tt_content', $mockRecord);
+               $result = IconUtilityFixture::getSpriteIconForRecord('tt_content', $mockRecord);
                $overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay"> </span>';
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text">' . $overlay . '</span>', $result);
        }
@@ -491,8 +449,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForFileWithNoFileTypeReturnsOtherSprite() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForFile('');
+               $result = IconUtilityFixture::getSpriteIconForFile('');
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"> </span>', $result);
        }
 
@@ -502,8 +459,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForFileWithNoUnknowFileTypeReturnsOtherSprite() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForFile('foo');
+               $result = IconUtilityFixture::getSpriteIconForFile('foo');
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"> </span>', $result);
        }
 
@@ -513,8 +469,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForFileWithPdfReturnsPdfSprite() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForFile('pdf');
+               $result = IconUtilityFixture::getSpriteIconForFile('pdf');
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf"> </span>', $result);
        }
 
@@ -524,8 +479,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForFileWithPngReturnsPngSprite() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForFile('png');
+               $result = IconUtilityFixture::getSpriteIconForFile('png');
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"> </span>', $result);
        }
 
@@ -535,8 +489,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getSpriteIconForFileWithPngAndOptionsReturnsPngSpriteAndOptions() {
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForFile('png', array('title' => 'bar'));
+               $result = IconUtilityFixture::getSpriteIconForFile('png', array('title' => 'bar'));
                $this->assertEquals('<span title="bar" class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"> </span>', $result);
        }
 
@@ -551,8 +504,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $hookMock->expects($this->once())->method('overrideIconOverlay');
                $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideIconOverlay'][$classReference] = $classReference;
                $GLOBALS['T3_VAR']['getUserObj'][$classReference] = $hookMock;
-               $subject = $this->subject;
-               $subject::mapRecordOverlayToSpriteIconName('tt_content', array());
+               IconUtilityFixture::mapRecordOverlayToSpriteIconName('tt_content', array());
        }
 
        /**
@@ -564,8 +516,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $classReference = $this->getUniqueId('user_overrideIconOverlayHook');
                $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideIconOverlay'][$classReference] = $classReference;
                $GLOBALS['T3_VAR']['getUserObj'][$classReference] = new \stdClass();
-               $subject = $this->subject;
-               $subject::mapRecordOverlayToSpriteIconName('tt_content', array());
+               IconUtilityFixture::mapRecordOverlayToSpriteIconName('tt_content', array());
        }
 
        //////////////////////////////////////////////
@@ -585,8 +536,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $fileObject = $this->getTestSubjectFileObject('');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($fileObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($fileObject);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"> </span>', $result);
        }
 
@@ -604,8 +554,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $fileObject = $this->getTestSubjectFileObject('foo');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($fileObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($fileObject);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"> </span>', $result);
        }
 
@@ -623,8 +572,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $fileObject = $this->getTestSubjectFileObject('pdf');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($fileObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($fileObject);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf"> </span>', $result);
        }
 
@@ -642,8 +590,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $fileObject = $this->getTestSubjectFileObject('png');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($fileObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($fileObject);
                $this->assertEquals('<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"> </span>', $result);
        }
 
@@ -661,8 +608,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $fileObject = $this->getTestSubjectFileObject('png');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($fileObject, array('title' => 'bar'));
+               $result = IconUtilityFixture::getSpriteIconForResource($fileObject, array('title' => 'bar'));
                $this->assertEquals('<span title="bar" class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"> </span>', $result);
        }
 
@@ -680,8 +626,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $folderObject = $this->getTestSubjectFolderObject('/test');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($folderObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($folderObject);
                $this->assertEquals('<span class="t3-icon t3-icon-apps t3-icon-apps-filetree t3-icon-filetree-folder-default"> </span>', $result);
        }
 
@@ -699,8 +644,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $folderObject = $this->getTestSubjectFolderObject('/test');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($folderObject, array('folder-open' => TRUE));
+               $result = IconUtilityFixture::getSpriteIconForResource($folderObject, array('folder-open' => TRUE));
                $this->assertEquals('<span class="t3-icon t3-icon-apps t3-icon-apps-filetree t3-icon-filetree-folder-opened"> </span>', $result);
        }
 
@@ -718,8 +662,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $folderObject = $this->getTestSubjectFolderObject('/');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($folderObject);
+               $result = IconUtilityFixture::getSpriteIconForResource($folderObject);
                $this->assertEquals('<span class="t3-icon t3-icon-apps t3-icon-apps-filetree t3-icon-filetree-root"> </span>', $result);
        }
 
@@ -737,8 +680,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                        ),
                );
                $folderObject = $this->getTestSubjectFolderObject('/mount');
-               $subject = $this->subject;
-               $result = $subject::getSpriteIconForResource($folderObject, array('mount-root' => TRUE));
+               $result = IconUtilityFixture::getSpriteIconForResource($folderObject, array('mount-root' => TRUE));
                $this->assertEquals('<span class="t3-icon t3-icon-apps t3-icon-apps-filetree t3-icon-filetree-mount"> </span>', $result);
        }
 
@@ -759,8 +701,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $hookMock->expects($this->once())->method('overrideResourceIcon');
                $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideResourceIcon'][$classReference] = $classReference;
                $GLOBALS['T3_VAR']['getUserObj'][$classReference] = $hookMock;
-               $subject = $this->subject;
-               $subject::getSpriteIconForResource($folderObject);
+               IconUtilityFixture::getSpriteIconForResource($folderObject);
        }
 
        /**
@@ -774,8 +715,7 @@ class IconUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $folderObject = $this->getTestSubjectFolderObject('/test');
                $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['overrideResourceIcon'][$classReference] = $classReference;
                $GLOBALS['T3_VAR']['getUserObj'][$classReference] = new \stdClass();
-               $subject = $this->subject;
-               $subject::getSpriteIconForResource($folderObject);
+               IconUtilityFixture::getSpriteIconForResource($folderObject);
        }
 
 }
diff --git a/typo3/sysext/extensionmanager/Tests/Unit/Fixtures/LatestCompatibleExtensionObjectStorageFixture.php b/typo3/sysext/extensionmanager/Tests/Unit/Fixtures/LatestCompatibleExtensionObjectStorageFixture.php
new file mode 100644 (file)
index 0000000..9a2d1eb
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace TYPO3\CMS\Extensionmanager\Tests\Unit\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!
+ */
+
+/**
+ * Latest compatible extension object storage fixture
+ */
+class LatestCompatibleExtensionObjectStorageFixture {
+
+       /**
+        * @var array
+        */
+       public $extensions = array();
+
+       /**
+        * @return \TYPO3\CMS\Extensionmanager\Domain\Model\Extension
+        */
+       public function getFirst() {
+               return $this->extensions[0];
+       }
+
+}
\ No newline at end of file
index 75da72d..f9dea8b 100644 (file)
@@ -437,9 +437,8 @@ class DependencyUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $extension2 = new \TYPO3\CMS\Extensionmanager\Domain\Model\Extension();
                $extension2->setExtensionKey('bar');
                $extension2->setVersion('1.0.42');
-               $className = $this->getUniqueId('objectStorage');
-               eval('class ' . $className . ' {' . 'public $extensions = array();' . 'public function getFirst() {' . '  return $this->extensions[0];' . '}' . '}');
-               $myStorage = new $className();
+
+               $myStorage = new \TYPO3\CMS\Extensionmanager\Tests\Unit\Fixtures\LatestCompatibleExtensionObjectStorageFixture();
                $myStorage->extensions[] = $extension1;
                $myStorage->extensions[] = $extension2;
                $dependencyMock = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class, array('getIdentifier'));
diff --git a/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithFormPrefixFixture.php b/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithFormPrefixFixture.php
new file mode 100644 (file)
index 0000000..bd522cd
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+namespace TYPO3\CMS\Form\Tests\Unit\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!
+ */
+
+/**
+ * Post processor with form prefix fixture
+ */
+class PostProcessorWithFormPrefixFixture implements \TYPO3\CMS\Form\PostProcess\PostProcessorInterface {
+
+       /**
+        * @param \TYPO3\CMS\Form\Domain\Model\Form $form
+        * @param array $typoScript
+        */
+       public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {
+
+       }
+
+       /**
+        * @return string
+        */
+       public function process() {
+               return 'processedWithPrefix';
+       }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutFormPrefixFixture.php b/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutFormPrefixFixture.php
new file mode 100644 (file)
index 0000000..84adb69
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+namespace TYPO3\CMS\Form\Tests\Unit\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!
+ */
+
+/**
+ * Post processor without form prefix fixture
+ */
+class PostProcessorWithoutFormPrefixFixture implements \TYPO3\CMS\Form\PostProcess\PostProcessorInterface {
+
+       /**
+        * @param \TYPO3\CMS\Form\Domain\Model\Form $form
+        * @param array $typoScript
+        */
+       public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {
+
+       }
+
+       /**
+        * @return string
+        */
+       public function process() {
+               return 'processedWithoutPrefix';
+       }
+
+}
\ No newline at end of file
diff --git a/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutInterfaceFixture.php b/typo3/sysext/form/Tests/Unit/Fixtures/PostProcessorWithoutInterfaceFixture.php
new file mode 100644 (file)
index 0000000..b804e9a
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+namespace TYPO3\CMS\Form\Tests\Unit\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!
+ */
+
+/**
+ * Post processor with form prefix fixture
+ */
+class PostProcessorWithoutInterfaceFixture {
+
+       /**
+        * @param \TYPO3\CMS\Form\Domain\Model\Form $form
+        * @param array $typoScript
+        */
+       public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {
+
+       }
+
+       /**
+        * @return string
+        */
+       public function process() {
+               return 'withoutInterface';
+       }
+
+}
\ No newline at end of file
index 534780d..4990007 100644 (file)
@@ -40,20 +40,9 @@ class PostProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function processFindsClassSpecifiedByTypoScriptWithoutFormPrefix() {
-               $classNameWithoutPrefix = $this->getUniqueId('postprocess');
-               eval(
-                       'namespace TYPO3\CMS\Form\PostProcess;' .
-                       'class ' . $classNameWithoutPrefix . 'PostProcessor implements PostProcessorInterface {' .
-                       '  public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {' .
-                       '  }' .
-                       '  public function process() {' .
-                       '    return \'processedWithoutPrefix\';' .
-                       '  }' .
-                       '}'
-               );
                $typoScript = array(
                        10 => $this->getUniqueId('postprocess'),
-                       20 => $classNameWithoutPrefix
+                       20 => \TYPO3\CMS\Form\Tests\Unit\Fixtures\PostProcessorWithoutFormPrefixFixture::class
                );
                $this->subject->typoScript = $typoScript;
                $this->subject->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
@@ -65,20 +54,9 @@ class PostProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function processFindsClassSpecifiedByTypoScriptWithFormPrefix() {
-               $classNameWithPrefix = $this->getUniqueId('postprocess');
-               eval(
-                       'namespace TYPO3\CMS\Form\PostProcess;' .
-                       'class ' . $classNameWithPrefix . 'PostProcessor implements PostProcessorInterface {' .
-                       '  public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {' .
-                       '  }' .
-                       '  public function process() {' .
-                       '    return \'processedWithPrefix\';' .
-                       '  }' .
-                       '}'
-               );
                $typoScript = array(
                        10 => $this->getUniqueId('postprocess'),
-                       20 => $classNameWithPrefix
+                       20 => \TYPO3\CMS\Form\Tests\Unit\Fixtures\PostProcessorWithFormPrefixFixture::class
                );
                $this->subject->typoScript = $typoScript;
                $this->subject->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
@@ -90,20 +68,9 @@ class PostProcessorTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function processReturnsEmptyStringIfSpecifiedPostProcessorDoesNotImplementTheInterface() {
-               $classNameWithoutInterface = $this->getUniqueId('postprocess');
-               eval(
-                       'namespace TYPO3\CMS\Form\PostProcess;' .
-                       'class ' . $classNameWithoutInterface . 'PostProcessor {' .
-                       '  public function __construct(\TYPO3\CMS\Form\Domain\Model\Form $form, array $typoScript) {' .
-                       '  }' .
-                       '  public function process() {' .
-                       '    return \'withoutInterface\';' .
-                       '  }' .
-                       '}'
-               );
                $typoScript = array(
                        10 => $this->getUniqueId('postprocess'),
-                       20 => $classNameWithoutInterface
+                       20 => \TYPO3\CMS\Form\Tests\Unit\Fixtures\PostProcessorWithoutInterfaceFixture::class
                );
                $this->subject->typoScript = $typoScript;
                $this->subject->expects($this->once())->method('sortTypoScriptKeyList')->will($this->returnValue(array(10, 20)));
diff --git a/typo3/sysext/frontend/Tests/Unit/Fixtures/AdminPanelHookWithoutInterfaceFixture.php b/typo3/sysext/frontend/Tests/Unit/Fixtures/AdminPanelHookWithoutInterfaceFixture.php
new file mode 100644 (file)
index 0000000..eae9d37
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+namespace TYPO3\CMS\Frontend\Tests\Unit\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!
+ */
+
+/**
+ * Admin panel hook without interface
+ */
+class AdminPanelHookWithoutInterfaceFixture {
+
+}
\ No newline at end of file
index 65314f6..11a3543 100644 (file)
@@ -56,9 +56,7 @@ class AdminPanelViewTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @expectedException \UnexpectedValueException
         */
        public function extendAdminPanelHookThrowsExceptionIfHookClassDoesNotImplementInterface() {
-               $hookClass = $this->getUniqueId('tx_coretest');
-               eval('class ' . $hookClass . ' {}');
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'][] = $hookClass;
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_adminpanel.php']['extendAdminPanel'][] = \TYPO3\CMS\Frontend\Tests\Unit\Fixtures\AdminPanelHookWithoutInterfaceFixture::class;
                /** @var $adminPanelMock \PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Frontend\View\AdminPanelView */
                $adminPanelMock = $this->getMock(\TYPO3\CMS\Frontend\View\AdminPanelView::class, array('dummy'), array(), '', FALSE);
                $adminPanelMock->display();