[TASK] Use Backend User fixture for DataHandler tests 81/27681/2
authorOliver Hader <oliver@typo3.org>
Tue, 18 Feb 2014 09:32:51 +0000 (10:32 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 18 Feb 2014 13:13:45 +0000 (14:13 +0100)
Resolves: #56070
Releases: 6.2
Change-Id: Iaae9944796311d7e453b5374827acf7030e6bdbf
Reviewed-on: https://review.typo3.org/27681
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
typo3/sysext/core/Tests/FunctionalTestCase.php

index 6ce9222..5fd0e3c 100644 (file)
@@ -32,6 +32,8 @@ use TYPO3\CMS\Core\Tests\Functional\DataHandling\Framework\DataSet;
  */
 abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\FunctionalTestCase {
 
+       const VALUE_BackendUserId = 1;
+
        /**
         * @var string
         */
@@ -65,15 +67,11 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
        public function setUp() {
                parent::setUp();
 
-               $this->backendUser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
-               $this->backendUser->user['admin'] = 1;
-               $this->backendUser->user['uid'] = 1;
+               $this->backendUser = $this->setUpBackendUserFromFixture(self::VALUE_BackendUserId);
                // By default make tests on live workspace
                $this->backendUser->workspace = 0;
-               $GLOBALS['BE_USER'] = $this->backendUser;
 
                $this->actionService = $this->getActionService();
-
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
        }
 
index 419e6da..aa92049 100644 (file)
@@ -188,6 +188,7 @@ abstract class FunctionalTestCase extends BaseTestCase {
         * Initialize backend user
         *
         * @param int $userUid uid of the user we want to initialize. This user must exist in the fixture file
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
         * @throws Exception
         */
        protected function setUpBackendUserFromFixture($userUid) {
@@ -213,6 +214,8 @@ abstract class FunctionalTestCase extends BaseTestCase {
                        );
                }
                $GLOBALS['BE_USER']->backendCheckLogin();
+
+               return $backendUser;
        }
 
        /**