[TASK] Add integrity test for LocalizationUtility 86/49286/7
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 1 Aug 2016 15:16:22 +0000 (17:16 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 2 Aug 2016 14:55:41 +0000 (16:55 +0200)
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>
typo3/sysext/core/Tests/Integrity/IntegrityTest.php

index 911d009..dcf9da3 100644 (file)
@@ -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());
+    }
 }