From 433c242e14f2ece98fd206a211490c48a350359d Mon Sep 17 00:00:00 2001
From: Anja Leichsenring <aleichsenring@ab-softlab.de>
Date: Mon, 1 Aug 2016 17:16:22 +0200
Subject: [PATCH] [TASK] Add integrity test for LocalizationUtility

A cross dependency in unit tests has been discovered. To make sure
there are no more of this, an integrity test has been added. In makes
sure the configurationManager property of this class is still null.

Resolves: #77334
Releases: master
Change-Id: I2f8ae127a56c6cfae9754e12e87b2ef5709564d3
Reviewed-on: https://review.typo3.org/49286
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../core/Tests/Integrity/IntegrityTest.php       | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/typo3/sysext/core/Tests/Integrity/IntegrityTest.php b/typo3/sysext/core/Tests/Integrity/IntegrityTest.php
index 911d0098c251..dcf9da38d6ce 100644
--- a/typo3/sysext/core/Tests/Integrity/IntegrityTest.php
+++ b/typo3/sysext/core/Tests/Integrity/IntegrityTest.php
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Tests\Integrity;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 
 /**
  * This test case is used in test suites to check for healthy
@@ -41,4 +42,19 @@ class IntegrityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         $this->assertArrayHasKey(\TYPO3\CMS\Core\Cache\CacheManager::class, $registeredSingletons);
         $this->assertTrue($registeredSingletons[\TYPO3\CMS\Core\Cache\CacheManager::class] instanceof \TYPO3\CMS\Core\Cache\CacheManager);
     }
+
+    /**
+     * This test fails if any test case manipulates the configurationManager
+     * property in LocalizationUtility due to mocking and fails to restore it
+     * properly.
+     *
+     * @test
+     */
+    public function ensureLocalisationUtilityConfigurationManagerIsNull()
+    {
+        $reflectionClass = new \ReflectionClass(LocalizationUtility::class);
+        $property = $reflectionClass->getProperty('configurationManager');
+        $property->setAccessible(true);
+        $this->assertNull($property->getValue());
+    }
 }
-- 
GitLab