[TASK] Cleanup __DIR__ and require/require_once 52/19952/5
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Thu, 14 Nov 2013 17:05:55 +0000 (18:05 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Wed, 15 Jan 2014 12:56:32 +0000 (13:56 +0100)
* Use __DIR__ instead of dirname(__FILE__) (since PHP 5.3.0)
* Use require_once for loading classes ("just once")

Resolves: #47203
Releases: 6.2
Change-Id: I4b5d003a0bbabd91dcc7e58081eed41b5314da3f
Reviewed-on: https://review.typo3.org/19952
Reviewed-by: Xavier Perseguers
Reviewed-by: Oliver Klee
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Pascal Dürsteler
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Tests/Functional/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Functional/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/FunctionalTestCaseBootstrapUtility.php
typo3/sysext/workspaces/Tests/Functional/DataHandling/DataHandlerTest.php

index c6c57f9..a431086 100644 (file)
@@ -29,7 +29,7 @@ namespace TYPO3\CMS\Core\Core;
 
 use TYPO3\CMS\Core\Utility;
 
-require __DIR__ . '/SystemEnvironmentBuilder.php';
+require_once __DIR__ . '/SystemEnvironmentBuilder.php';
 
 /**
  * This class encapsulates bootstrap related methods.
index 30b1abe..468a83b 100644 (file)
@@ -44,7 +44,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
                $backendUser->workspace = 0;
                $GLOBALS['BE_USER'] = $backendUser;
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
        }
 
        /**
@@ -82,9 +82,9 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
         * @test
         */
        public function canLocalizeTtContent() {
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/sys_language.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/pages_language_overlay.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/tt_content.xml');
+               $this->importDataSet(__DIR__. '/../Fixtures/sys_language.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages_language_overlay.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/tt_content.xml');
 
                $dataHandler = $this->getDataHandler();
                $originalRecordId  = 1;
index e5f5d5c..b3c4313 100644 (file)
@@ -29,7 +29,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\Resource\Driver;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
-require_once dirname(dirname(__FILE__)) . '/BaseTestCase.php';
+require_once __DIR__ . '/../BaseTestCase.php';
 
 /**
  * Test case
index 1145795..04ca7b8 100644 (file)
@@ -303,10 +303,10 @@ class FunctionalTestCaseBootstrapUtility {
                define('TYPO3_MODE', 'BE');
                define('TYPO3_cliMode', TRUE);
 
-               require $this->instancePath . '/typo3/sysext/core/Classes/Core/CliBootstrap.php';
+               require_once $this->instancePath . '/typo3/sysext/core/Classes/Core/CliBootstrap.php';
                \TYPO3\CMS\Core\Core\CliBootstrap::checkEnvironmentOrDie();
 
-               require $this->instancePath . '/typo3/sysext/core/Classes/Core/Bootstrap.php';
+               require_once $this->instancePath . '/typo3/sysext/core/Classes/Core/Bootstrap.php';
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
                        ->baseSetup('')
                        ->loadConfigurationAndInitialize(FALSE)
index b927c2b..8d9051b 100644 (file)
@@ -44,7 +44,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
 
                $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/pages.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/pages.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/pages.xml');
        }
 
        /**
@@ -52,7 +52,7 @@ class DataHandlerTest extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
         */
        public function canChangeTtContentInTheWorkspace() {
                $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/tt_content.xml');
-               $this->importDataSet(dirname(__FILE__) . '/../Fixtures/sys_workspace.xml');
+               $this->importDataSet(__DIR__ . '/../Fixtures/sys_workspace.xml');
 
                $workspaceId = 90;
                /** @var $backendUser \TYPO3\CMS\Core\Authentication\BackendUserAuthentication */