[TASK] Removes eval() in core tree data provider factory unit tests 25/40425/5
authorPierrick Caillon <pierrick.caillon@plan-net.fr>
Thu, 18 Jun 2015 09:36:57 +0000 (11:36 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 18 Jun 2015 21:20:18 +0000 (23:20 +0200)
Adds fixture for a DataProvider and removes the ugly usage of eval() from
TreeDataProviderFactoryTest in unit tests.

Resolves: #67591
Related: #67468
Releases: master
Change-Id: I3f02ad549197c8dd4fffb8edbd5d5774a9adbb7e
Reviewed-on: http://review.typo3.org/40425
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/Fixtures/TreeDataProviderFixture.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php

diff --git a/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/Fixtures/TreeDataProviderFixture.php b/typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/Fixtures/TreeDataProviderFixture.php
new file mode 100644 (file)
index 0000000..31051f4
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\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!
+ */
+
+/**
+ * Fixture configured data provider
+ */
+class TreeDataProviderFixture {
+
+       /**
+        * @param array $configuration
+        */
+       public function __construct($configuration) {
+       }
+
+}
index 0d1c13c..60fff05 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Tests\Unit\Tree\TableConfiguration\Fixtures\TreeDataProviderFixture;
 
 /**
  * Testcase for TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory
@@ -82,11 +83,7 @@ class TreeDataProviderFactoryTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function configuredDataProviderClassIsInstantiated() {
-               $dataProviderMockClassName = $this->getUniqueId('tx_coretest_tree_data_provider');
-               eval('class ' . $dataProviderMockClassName . ' {
-                       function __construct($configuration) {
-                       }
-               }');
+               $dataProviderMockClassName = TreeDataProviderFixture::class;
 
                $tcaConfiguration = array('treeConfig' => array('dataProvider' => $dataProviderMockClassName), 'internal_type' => 'foo');
                $dataProvider = $this->subject->getDataProvider($tcaConfiguration, 'foo', 'bar', array('uid' => 1));