[TASK] Removes eval() in core data handler unit tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Unit / DataHandling / DataHandlerTest.php
index c45d4b0..cd8122e 100644 (file)
@@ -16,6 +16,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\DataHandler;
 
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\AllowAccessHookFixture;
+use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\InvalidHookFixture;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 
@@ -267,9 +269,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @expectedException \UnexpectedValueException
         */
        public function doesCheckModifyAccessListThrowExceptionOnWrongHookInterface() {
-               $hookClass = $this->getUniqueId('tx_coretest');
-               eval('class ' . $hookClass . ' {}');
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = $hookClass;
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = InvalidHookFixture::class;
                $this->subject->checkModifyAccessList('tt_content');
        }
 
@@ -293,13 +293,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function doesCheckModifyAccessListHookModifyAccessAllowed() {
-               $hookClass = $this->getUniqueId('tx_coretest');
-               eval('
-                       class ' . $hookClass . ' implements \\TYPO3\\CMS\\Core\\DataHandling\\DataHandlerCheckModifyAccessListHookInterface {
-                               public function checkModifyAccessList(&$accessAllowed, $table, \\TYPO3\\CMS\\Core\\DataHandling\\DataHandler $parent) { $accessAllowed = TRUE; }
-                       }
-               ');
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = $hookClass;
+               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['checkModifyAccessList'][] = AllowAccessHookFixture::class;
                $this->assertTrue($this->subject->checkModifyAccessList('tt_content'));
        }