From 5c649c936e2d767e59cb197413a02cb6cb863293 Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Tue, 18 Feb 2014 10:32:51 +0100
Subject: [PATCH] [TASK] Use Backend User fixture for DataHandler tests

Resolves: #56070
Releases: 6.2
Change-Id: Iaae9944796311d7e453b5374827acf7030e6bdbf
Reviewed-on: https://review.typo3.org/27681
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
---
 .../DataHandling/AbstractDataHandlerActionTestCase.php    | 8 +++-----
 typo3/sysext/core/Tests/FunctionalTestCase.php            | 3 +++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
index 6ce922237fcd..5fd0e3ce34db 100644
--- a/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
+++ b/typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
@@ -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();
 	}
 
diff --git a/typo3/sysext/core/Tests/FunctionalTestCase.php b/typo3/sysext/core/Tests/FunctionalTestCase.php
index 419e6da0b29b..aa9204970eed 100644
--- a/typo3/sysext/core/Tests/FunctionalTestCase.php
+++ b/typo3/sysext/core/Tests/FunctionalTestCase.php
@@ -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;
 	}
 
 	/**
-- 
GitLab