[TASK] Replace usage of BaseTestCase::getUniqueId() with core function 74/62774/5
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 27 Dec 2019 15:33:17 +0000 (16:33 +0100)
committerBenni Mack <benni@typo3.org>
Mon, 30 Dec 2019 09:47:13 +0000 (10:47 +0100)
Tests can use the core function StringUtility::getUniqueId(), after both
functions provide the same service.

Resolves: #90021
Releases: master
Change-Id: I57fc362e3e93b1aa963ea497f210144cab5cea1e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62774
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
63 files changed:
typo3/sysext/backend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/BackendLayoutCollectionTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/BackendLayoutTest.php
typo3/sysext/backend/Tests/Unit/View/BackendLayout/DataProviderCollectionTest.php
typo3/sysext/core/Tests/Functional/Cache/Backend/MemcachedBackendTest.php
typo3/sysext/core/Tests/Functional/Cache/Backend/RedisBackendTest.php
typo3/sysext/core/Tests/Functional/Category/Collection/CategoryCollectionTest.php
typo3/sysext/core/Tests/Functional/Collection/RecordCollectionRepositoryTest.php
typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php
typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php
typo3/sysext/core/Tests/Functional/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/ApcuBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/PdoBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/Backend/WincacheBackendTest.php
typo3/sysext/core/Tests/Unit/Cache/CacheManagerTest.php
typo3/sysext/core/Tests/Unit/Category/CategoryRegistryTest.php
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php
typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php
typo3/sysext/core/Tests/Unit/Http/StreamFactoryTest.php
typo3/sysext/core/Tests/Unit/Http/StreamTest.php
typo3/sysext/core/Tests/Unit/Log/LogManagerTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/DatabaseWriterTest.php
typo3/sysext/core/Tests/Unit/Log/Writer/FileWriterTest.php
typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php
typo3/sysext/core/Tests/Unit/Page/PageRendererTest.php
typo3/sysext/core/Tests/Unit/Resource/BaseTestCase.php
typo3/sysext/core/Tests/Unit/Resource/Collection/FileCollectionRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/DriverRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/FileReferenceTest.php
typo3/sysext/core/Tests/Unit/Resource/FileTest.php
typo3/sysext/core/Tests/Unit/Resource/FolderTest.php
typo3/sysext/core/Tests/Unit/Resource/ProcessedFileTest.php
typo3/sysext/core/Tests/Unit/Resource/Rendering/RendererRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceFactoryTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Resource/TextExtraction/TextExtractorRegistryTest.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/core/Tests/UnitDeprecated/Localization/LocalizationFactoryTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/View/JsonViewTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/PersistenceManagerTest.php
typo3/sysext/extbase/Tests/Unit/Persistence/Generic/Storage/Typo3DbQueryParserTest.php
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Controller/AbstractControllerTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/FileHandlingUtilityTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/InstallUtilityTest.php
typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php
typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/MenuContentObjectFactoryTest.php
typo3/sysext/frontend/Tests/Unit/Controller/TypoScriptFrontendControllerTest.php
typo3/sysext/frontend/Tests/Unit/Plugin/AbstractPluginTest.php
typo3/sysext/frontend/Tests/Unit/Typolink/AbstractTypolinkBuilderTest.php
typo3/sysext/indexed_search/Tests/Unit/IndexerTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/AbstractNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/DirectoryNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/FileNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/LinkNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructure/RootNodeTest.php
typo3/sysext/install/Tests/Unit/FolderStructureTestCase.php

index 58ef2f1..6855916 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Context\UserAspect;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 /**
@@ -267,7 +268,7 @@ class ConditionMatcherTest extends FunctionalTestCase
      */
     public function genericGetVariablesSucceedsWithNamespaceENV(): void
     {
-        $testKey = $this->getUniqueId('test');
+        $testKey = StringUtility::getUniqueId('test');
         putenv($testKey . '=testValue');
         self::assertTrue($this->subject->match('[getenv("' . $testKey . '") == "testValue"]'));
     }
index 8bdc82a..dde6c33 100644 (file)
@@ -41,6 +41,7 @@ use TYPO3\CMS\Core\Site\Entity\Site;
 use TYPO3\CMS\Core\Site\SiteFinder;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -1194,7 +1195,7 @@ class TcaSelectItemsTest extends UnitTestCase
      */
     public function addDataAddsFileItemsWithConfiguredFileFolder()
     {
-        $directory = $this->getUniqueId('test-') . '/';
+        $directory = StringUtility::getUniqueId('test-') . '/';
         $input = [
             'tableName' => 'aTable',
             'databaseRow' => [],
index 01c7928..69ed5cc 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -28,7 +29,7 @@ class BackendLayoutCollectionTest extends UnitTestCase
     {
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1381597631);
-        $identifier = $this->getUniqueId('identifier__');
+        $identifier = StringUtility::getUniqueId('identifier__');
         new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
     }
 
@@ -37,7 +38,7 @@ class BackendLayoutCollectionTest extends UnitTestCase
      */
     public function objectIsCreated()
     {
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
 
         self::assertEquals($identifier, $backendLayoutCollection->getIdentifier());
@@ -50,9 +51,9 @@ class BackendLayoutCollectionTest extends UnitTestCase
     {
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1381597628);
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
-        $backendLayoutIdentifier = $this->getUniqueId('identifier__');
+        $backendLayoutIdentifier = StringUtility::getUniqueId('identifier__');
         $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
             ->setMethods(['getIdentifier'])
             ->disableOriginalConstructor()
@@ -69,9 +70,9 @@ class BackendLayoutCollectionTest extends UnitTestCase
     {
         $this->expectException(\LogicException::class);
         $this->expectExceptionCode(1381559376);
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
-        $backendLayoutIdentifier = $this->getUniqueId('identifier');
+        $backendLayoutIdentifier = StringUtility::getUniqueId('identifier');
         $firstBackendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
             ->setMethods(['getIdentifier'])
             ->disableOriginalConstructor()
@@ -92,9 +93,9 @@ class BackendLayoutCollectionTest extends UnitTestCase
      */
     public function backendLayoutCanBeFetched()
     {
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $backendLayoutCollection = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection($identifier);
-        $backendLayoutIdentifier = $this->getUniqueId('identifier');
+        $backendLayoutIdentifier = StringUtility::getUniqueId('identifier');
         $backendLayoutMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\BackendLayout::class)
             ->setMethods(['getIdentifier'])
             ->disableOriginalConstructor()
index c0f5b6d..cbdd3d1 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -28,9 +29,9 @@ class BackendLayoutTest extends UnitTestCase
     {
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1381597630);
-        $identifier = $this->getUniqueId('identifier__');
-        $title = $this->getUniqueId('title');
-        $configuration = $this->getUniqueId('configuration');
+        $identifier = StringUtility::getUniqueId('identifier__');
+        $title = StringUtility::getUniqueId('title');
+        $configuration = StringUtility::getUniqueId('configuration');
         new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout($identifier, $title, $configuration);
     }
 
@@ -39,9 +40,9 @@ class BackendLayoutTest extends UnitTestCase
      */
     public function objectIsCreated()
     {
-        $identifier = $this->getUniqueId('identifier');
-        $title = $this->getUniqueId('title');
-        $configuration = $this->getUniqueId('configuration');
+        $identifier = StringUtility::getUniqueId('identifier');
+        $title = StringUtility::getUniqueId('title');
+        $configuration = StringUtility::getUniqueId('configuration');
         $backendLayout = new \TYPO3\CMS\Backend\View\BackendLayout\BackendLayout($identifier, $title, $configuration);
 
         self::assertEquals($identifier, $backendLayout->getIdentifier());
index 03f358d..4cbb093 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Backend\Tests\Unit\View\BackendLayout;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -42,7 +43,7 @@ class DataProviderCollectionTest extends UnitTestCase
     {
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionCode(1381597629);
-        $identifier = $this->getUniqueId('identifier__');
+        $identifier = StringUtility::getUniqueId('identifier__');
         $dataProviderMock = $this->getMockBuilder('stdClass')->getMock();
 
         $this->dataProviderCollection->add($identifier, get_class($dataProviderMock));
@@ -55,7 +56,7 @@ class DataProviderCollectionTest extends UnitTestCase
     {
         $this->expectException(\LogicException::class);
         $this->expectExceptionCode(1381269811);
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $dataProviderMock = $this->getMockBuilder('stdClass')->getMock();
 
         $this->dataProviderCollection->add($identifier, get_class($dataProviderMock));
@@ -66,7 +67,7 @@ class DataProviderCollectionTest extends UnitTestCase
      */
     public function defaultBackendLayoutIsFound()
     {
-        $backendLayoutIdentifier = $this->getUniqueId('identifier');
+        $backendLayoutIdentifier = StringUtility::getUniqueId('identifier');
 
         $dataProviderMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class)
             ->setMethods(['getBackendLayout'])
@@ -91,8 +92,8 @@ class DataProviderCollectionTest extends UnitTestCase
      */
     public function providedBackendLayoutIsFound()
     {
-        $dataProviderIdentifier = $this->getUniqueId('custom');
-        $backendLayoutIdentifier = $this->getUniqueId('identifier');
+        $dataProviderIdentifier = StringUtility::getUniqueId('custom');
+        $backendLayoutIdentifier = StringUtility::getUniqueId('identifier');
 
         $dataProviderMock = $this->getMockBuilder(\TYPO3\CMS\Backend\View\BackendLayout\DefaultDataProvider::class)
             ->setMethods(['getBackendLayout'])
index 171835c..d47aa6b 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\Cache\Backend;
 use TYPO3\CMS\Core\Cache\Backend\MemcachedBackend;
 use TYPO3\CMS\Core\Cache\Exception;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 /**
@@ -68,7 +69,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $this->expectException(Exception::class);
         $this->expectExceptionCode(1207149215);
 
-        $subject->set($this->getUniqueId('MyIdentifier'), 'some data');
+        $subject->set(StringUtility::getUniqueId('MyIdentifier'), 'some data');
     }
 
     /**
@@ -93,7 +94,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject = $this->initializeSubject();
         $subject->setCache($frontendProphecy->reveal());
 
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, 'Some data');
         self::assertTrue($subject->has($identifier));
     }
@@ -110,7 +111,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject->setCache($frontendProphecy->reveal());
 
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, $data);
         self::assertEquals($data, $subject->get($identifier));
     }
@@ -173,7 +174,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject->setCache($frontendProphecy->reveal());
 
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, $data);
         $subject->remove($identifier);
         self::assertFalse($subject->has($identifier));
@@ -191,7 +192,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject->setCache($frontendProphecy->reveal());
 
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, $data);
         $otherData = 'some other data';
         $subject->set($identifier, $otherData);
@@ -210,7 +211,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject->setCache($frontendProphecy->reveal());
 
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tag2']);
         $retrieved = $subject->findIdentifiersByTag('UnitTestTag%tag1');
         self::assertEquals($identifier, $retrieved[0]);
@@ -230,7 +231,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject->setCache($frontendProphecy->reveal());
 
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $subject->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tag2']);
         $subject->set($identifier, $data, ['UnitTestTag%tag3']);
         self::assertEquals([], $subject->findIdentifiersByTag('UnitTestTag%tagX'));
@@ -247,7 +248,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject = $this->initializeSubject();
         $subject->setCache($frontendProphecy->reveal());
 
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         self::assertFalse($subject->has($identifier));
     }
 
@@ -262,7 +263,7 @@ class MemcachedBackendTest extends FunctionalTestCase
         $subject = $this->initializeSubject();
         $subject->setCache($frontendProphecy->reveal());
 
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         self::assertFalse($subject->remove($identifier));
     }
 
index 9b62a20..8c0aad0 100644 (file)
@@ -18,6 +18,7 @@ use Psr\Log\LoggerInterface;
 use TYPO3\CMS\Core\Cache\Backend\RedisBackend;
 use TYPO3\CMS\Core\Cache\Exception\InvalidDataException;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 /**
@@ -183,7 +184,7 @@ class RedisBackendTest extends FunctionalTestCase
         $this->expectExceptionCode(1279469941);
 
         $subject = $this->setUpSubject();
-        $subject->set($this->getUniqueId('identifier'), []);
+        $subject->set(StringUtility::getUniqueId('identifier'), []);
     }
 
     /**
@@ -195,7 +196,7 @@ class RedisBackendTest extends FunctionalTestCase
         $this->expectExceptionCode(1279487573);
 
         $subject = $this->setUpSubject();
-        $subject->set($this->getUniqueId('identifier'), 'data', [], -42);
+        $subject->set(StringUtility::getUniqueId('identifier'), 'data', [], -42);
     }
 
     /**
@@ -207,7 +208,7 @@ class RedisBackendTest extends FunctionalTestCase
         $this->expectExceptionCode(1279488008);
 
         $subject = $this->setUpSubject();
-        $subject->set($this->getUniqueId('identifier'), 'data', [], []);
+        $subject->set(StringUtility::getUniqueId('identifier'), 'data', [], []);
     }
 
     /**
@@ -218,7 +219,7 @@ class RedisBackendTest extends FunctionalTestCase
         $redis = $this->setUpRedis();
         $redis->select(1);
         $subject = $this->setUpSubject(['database' => 1]);
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         $result = $redis->exists('identData:' . $identifier);
         if (is_int($result)) {
@@ -235,7 +236,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         self::assertSame(\Redis::REDIS_STRING, $redis->type('identData:' . $identifier));
     }
@@ -247,7 +248,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $defaultLifetime = 42;
         $subject->setDefaultLifetime($defaultLifetime);
         $subject->set($identifier, 'data');
@@ -262,7 +263,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $lifetime = 43;
         $subject->set($identifier, 'data', [], $lifetime);
         $lifetimeRegisteredInBackend = $redis->ttl('identData:' . $identifier);
@@ -276,7 +277,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data', [], 0);
         $lifetimeRegisteredInBackend = $redis->ttl('identData:' . $identifier);
         self::assertSame(31536000, $lifetimeRegisteredInBackend);
@@ -289,7 +290,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $data = 'data 1';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, $data);
         $otherData = 'data 2';
         $subject->set($identifier, $otherData);
@@ -305,7 +306,7 @@ class RedisBackendTest extends FunctionalTestCase
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
         $data = 'data';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, $data);
         $lifetime = 42;
         $subject->set($identifier, $data, [], $lifetime);
@@ -321,7 +322,7 @@ class RedisBackendTest extends FunctionalTestCase
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
         $data = 'data';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $lifetime = 42;
         $subject->set($identifier, $data, [], $lifetime);
         $newDefaultLifetime = 43;
@@ -339,7 +340,7 @@ class RedisBackendTest extends FunctionalTestCase
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
         $data = 'data';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $lifetime = 42;
         $subject->set($identifier, $data, [], $lifetime);
         $subject->set($identifier, $data, [], 0);
@@ -354,7 +355,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data', ['tag']);
         self::assertSame(\Redis::REDIS_SET, $redis->type('identTags:' . $identifier));
     }
@@ -366,7 +367,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tags = ['thatTag', 'thisTag'];
         $subject->set($identifier, 'data', $tags);
         $savedTags = $redis->sMembers('identTags:' . $identifier);
@@ -381,7 +382,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tags = ['fooTag', 'barTag'];
         $subject->set($identifier, 'data', $tags);
         $subject->set($identifier, 'data', []);
@@ -395,7 +396,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $firstTagSet = ['tag1', 'tag2', 'tag3', 'tag4'];
         $subject->set($identifier, 'data', $firstTagSet);
         $secondTagSet = ['tag1', 'tag3'];
@@ -412,7 +413,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'tag';
         $subject->set($identifier, 'data', [$tag]);
         self::assertSame(\Redis::REDIS_SET, $redis->type('tagIdents:' . $tag));
@@ -425,7 +426,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'thisTag';
         $subject->set($identifier, 'data', [$tag]);
         $savedTagToIdentifiersMemberArray = $redis->sMembers('tagIdents:' . $tag);
@@ -439,10 +440,10 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $firstIdentifier = $this->getUniqueId('identifier1-');
+        $firstIdentifier = StringUtility::getUniqueId('identifier1-');
         $tag = 'thisTag';
         $subject->set($firstIdentifier, 'data', [$tag]);
-        $secondIdentifier = $this->getUniqueId('identifier2-');
+        $secondIdentifier = StringUtility::getUniqueId('identifier2-');
         $subject->set($secondIdentifier, 'data', [$tag]);
         $savedTagToIdentifiersMemberArray = $redis->sMembers('tagIdents:' . $tag);
         sort($savedTagToIdentifiersMemberArray);
@@ -458,7 +459,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'thisTag';
         $subject->set($identifier, 'data', [$tag]);
         $subject->set($identifier, 'data', []);
@@ -473,7 +474,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         $tag = 'thisTag';
         $subject->set($identifier, 'data', [$tag]);
@@ -490,7 +491,7 @@ class RedisBackendTest extends FunctionalTestCase
             'compression' => true
         ]);
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $data = 'some data ' . microtime();
         $subject->set($identifier, $data);
         $uncompresedStoredData = '';
@@ -511,7 +512,7 @@ class RedisBackendTest extends FunctionalTestCase
             'compressionLevel' => 0
         ]);
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $data = 'some data ' . microtime();
         $subject->set($identifier, $data);
         self::assertGreaterThan(0, substr_count($redis->get('identData:' . $identifier), $data), 'Plaintext data not found');
@@ -535,7 +536,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function hasReturnsFalseForNotExistingEntry()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         self::assertFalse($subject->has($identifier));
     }
 
@@ -545,7 +546,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function hasReturnsTrueForPreviouslySetEntry()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         self::assertTrue($subject->has($identifier));
     }
@@ -571,7 +572,7 @@ class RedisBackendTest extends FunctionalTestCase
             'compression' => true
         ]);
         $data = 'data';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, $data);
         $fetchedData = $subject->get($identifier);
         self::assertSame($data, $fetchedData);
@@ -584,7 +585,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $data = 'data';
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, $data);
         $fetchedData = $subject->get($identifier);
         self::assertSame($data, $fetchedData);
@@ -608,7 +609,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function removeReturnsFalseIfNoEntryWasDeleted()
     {
         $subject = $this->setUpSubject();
-        self::assertFalse($subject->remove($this->getUniqueId('identifier')));
+        self::assertFalse($subject->remove(StringUtility::getUniqueId('identifier')));
     }
 
     /**
@@ -617,7 +618,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function removeReturnsTrueIfAnEntryWasDeleted()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         self::assertTrue($subject->remove($identifier));
     }
@@ -628,7 +629,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function removeDeletesEntryFromCache()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         $subject->remove($identifier);
         self::assertFalse($subject->has($identifier));
@@ -641,7 +642,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'thisTag';
         $subject->set($identifier, 'data', [$tag]);
         $subject->remove($identifier);
@@ -660,7 +661,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'thisTag';
         $subject->set($identifier, 'data', [$tag]);
         $subject->remove($identifier);
@@ -675,8 +676,8 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $firstIdentifier = $this->getUniqueId('identifier');
-        $secondIdentifier = $this->getUniqueId('identifier');
+        $firstIdentifier = StringUtility::getUniqueId('identifier');
+        $secondIdentifier = StringUtility::getUniqueId('identifier');
         $tag = 'thisTag';
         $subject->set($firstIdentifier, 'data', [$tag]);
         $subject->set($secondIdentifier, 'data', [$tag]);
@@ -712,9 +713,9 @@ class RedisBackendTest extends FunctionalTestCase
     public function findIdentifiersByTagReturnsAllIdentifiersTagedWithSpecifiedTag()
     {
         $subject = $this->setUpSubject();
-        $firstIdentifier = $this->getUniqueId('identifier1-');
-        $secondIdentifier = $this->getUniqueId('identifier2-');
-        $thirdIdentifier = $this->getUniqueId('identifier3-');
+        $firstIdentifier = StringUtility::getUniqueId('identifier1-');
+        $secondIdentifier = StringUtility::getUniqueId('identifier2-');
+        $thirdIdentifier = StringUtility::getUniqueId('identifier3-');
         $tagsForFirstIdentifier = ['thisTag'];
         $tagsForSecondIdentifier = ['thatTag'];
         $tagsForThirdIdentifier = ['thisTag', 'thatTag'];
@@ -734,7 +735,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier, 'data');
         $subject->flush();
         self::assertSame([], $redis->getKeys('*'));
@@ -758,7 +759,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function flushByTagRemovesEntriesTaggedWithSpecifiedTag()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag1']);
         $subject->set($identifier . 'B', 'data', ['tag2']);
         $subject->set($identifier . 'C', 'data', ['tag1', 'tag2']);
@@ -778,7 +779,7 @@ class RedisBackendTest extends FunctionalTestCase
     public function flushByTagsRemovesEntriesTaggedWithSpecifiedTags()
     {
         $subject = $this->setUpSubject();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag1']);
         $subject->set($identifier . 'B', 'data', ['tag2']);
         $subject->set($identifier . 'C', 'data', ['tag1', 'tag2']);
@@ -801,7 +802,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag1']);
         $subject->set($identifier . 'C', 'data', ['tag1', 'tag2']);
         $subject->flushByTag('tag1');
@@ -815,7 +816,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'tag1';
         $subject->set($identifier, 'data', [$tag]);
         $subject->flushByTag($tag);
@@ -834,10 +835,10 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifierToBeRemoved = $this->getUniqueId('identifier');
+        $identifierToBeRemoved = StringUtility::getUniqueId('identifier');
         $tagToRemove = 'tag1';
         $subject->set($identifierToBeRemoved, 'data', [$tagToRemove]);
-        $identifierNotToBeRemoved = $this->getUniqueId('identifier');
+        $identifierNotToBeRemoved = StringUtility::getUniqueId('identifier');
         $tagNotToRemove = 'tag2';
         $subject->set($identifierNotToBeRemoved, 'data', [$tagNotToRemove]);
         $subject->flushByTag($tagToRemove);
@@ -851,7 +852,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $tag = 'tag1';
         $subject->set($identifier, 'data', [$tag]);
         $subject->flushByTag($tag);
@@ -870,7 +871,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag1', 'tag2']);
         $subject->set($identifier . 'B', 'data', ['tag1', 'tag2']);
         $subject->set($identifier . 'C', 'data', ['tag2']);
@@ -885,7 +886,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag']);
         $subject->set($identifier . 'B', 'data', ['tag']);
         $redis->del('identData:' . $identifier . 'A');
@@ -905,7 +906,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag']);
         $subject->set($identifier . 'B', 'data', ['tag']);
         $redis->del('identData:' . $identifier . 'A');
@@ -935,7 +936,7 @@ class RedisBackendTest extends FunctionalTestCase
     {
         $subject = $this->setUpSubject();
         $redis = $this->setUpRedis();
-        $identifier = $this->getUniqueId('identifier');
+        $identifier = StringUtility::getUniqueId('identifier');
         $subject->set($identifier . 'A', 'data', ['tag1', 'tag2']);
         $subject->set($identifier . 'B', 'data', ['tag2']);
         $redis->del('identData:' . $identifier . 'A');
index df51d2d..b7375f2 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\Category\Collection;
  */
 
 use TYPO3\CMS\Core\Category\Collection\CategoryCollection;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 /**
@@ -42,8 +43,8 @@ class CategoryCollectionTest extends FunctionalTestCase
         parent::setUp();
         $this->collectionRecord = [
             'uid' => 0,
-            'title' => $this->getUniqueId('title'),
-            'description' => $this->getUniqueId('description'),
+            'title' => StringUtility::getUniqueId('title'),
+            'description' => StringUtility::getUniqueId('description'),
             'table_name' => 'tx_test_test',
         ];
         $this->importCSVDataSet(__DIR__ . '/Fixtures/DataSet/categoryRelations.csv');
@@ -141,7 +142,7 @@ class CategoryCollectionTest extends FunctionalTestCase
         $fakeRecord = [
             'uid' => 6,
             'pid' => 0,
-            'title' => $this->getUniqueId('title'),
+            'title' => StringUtility::getUniqueId('title'),
             'categories' => 0
         ];
         // Check the number of records
@@ -159,7 +160,7 @@ class CategoryCollectionTest extends FunctionalTestCase
         $fakeRecord = [
             'uid' => 6,
             'pid' => 0,
-            'title' => $this->getUniqueId('title'),
+            'title' => StringUtility::getUniqueId('title'),
             'categories' => 0
         ];
         // Check the number of records
@@ -185,7 +186,7 @@ class CategoryCollectionTest extends FunctionalTestCase
     {
         // Remove one relation
         $fakeName = [
-            'tablenames' => $this->getUniqueId('name')
+            'tablenames' => StringUtility::getUniqueId('name')
         ];
         $this->getConnectionPool()
             ->getConnectionForTable('sys_category_record_mm')
index 40af7d0..f15b9e3 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Collection\RecordCollectionRepository;
 use TYPO3\CMS\Core\Collection\StaticRecordCollection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 
 /**
  * Test case for \TYPO3\CMS\Core\Collection\RecordCollectionRepository
@@ -45,7 +46,7 @@ class RecordCollectionRepositoryTest extends \TYPO3\TestingFramework\Core\Functi
         $this->subject = $this->getMockBuilder(RecordCollectionRepository::class)
             ->setMethods(['getEnvironmentMode'])
             ->getMock();
-        $this->testTableName = $this->getUniqueId('tx_testtable');
+        $this->testTableName = StringUtility::getUniqueId('tx_testtable');
     }
 
     protected function tearDown(): void
index 06ee543..ab1cd37 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Domain\Repository\PageRepository;
 use TYPO3\CMS\Core\Domain\Repository\PageRepositoryGetPageHookInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 
 /**
  * Test case
@@ -427,7 +428,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
      */
     public function enableFieldsHidesVersionedRecordsAndPlaceholders()
     {
-        $table = $this->getUniqueId('aTable');
+        $table = StringUtility::getUniqueId('aTable');
         $GLOBALS['TCA'][$table] = [
             'ctrl' => [
                 'versioningWS' => true
@@ -456,7 +457,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
      */
     public function enableFieldsDoesNotHidePlaceholdersInPreview()
     {
-        $table = $this->getUniqueId('aTable');
+        $table = StringUtility::getUniqueId('aTable');
         $GLOBALS['TCA'][$table] = [
             'ctrl' => [
                 'versioningWS' => true
@@ -487,7 +488,7 @@ class PageRepositoryTest extends \TYPO3\TestingFramework\Core\Functional\Functio
      */
     public function enableFieldsDoesFilterToCurrentAndLiveWorkspaceForRecordsInPreview()
     {
-        $table = $this->getUniqueId('aTable');
+        $table = StringUtility::getUniqueId('aTable');
         $GLOBALS['TCA'][$table] = [
             'ctrl' => [
                 'versioningWS' => true
index 513d8b6..e90f92a 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Functional\Page;
  */
 
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\StringUtility;
 
 /**
  * Test case
@@ -34,7 +35,7 @@ class PageRendererTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
         $prologueString = $expectedPrologueString = '<?xml version="1.0" encoding="utf-8" ?>';
         $subject->setXmlPrologAndDocType($prologueString);
 
-        $title = $this->getUniqueId('aTitle-');
+        $title = StringUtility::getUniqueId('aTitle-');
         $subject->setTitle($title);
         $expectedTitleString = '<title>' . $title . '</title>';
 
@@ -62,7 +63,7 @@ class PageRendererTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
         $subject->setMetaTag('NaMe', 'randomTag', 'foobar');
         $subject->removeMetaTag('name', 'RanDoMtAg');
 
-        $inlineComment = $this->getUniqueId('comment');
+        $inlineComment = StringUtility::getUniqueId('comment');
         $subject->addInlineComment($inlineComment);
         $expectedInlineCommentString = '<!-- ' . LF . $inlineComment . '-->';
 
@@ -87,10 +88,10 @@ class PageRendererTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
         $subject->addJsFile('fileadmin/test-plain.js', '', false, false, 'wrapBeforeXwrapAfter', false, 'X');
         $expectedJsFileWithoutTypeRegExp = '#wrapBefore<script src="fileadmin/test-plain\\.(js|\\d+\\.js|js\\?\\d+)"></script>wrapAfter#';
 
-        $jsInlineCode = $expectedJsInlineCodeString = 'var x = "' . $this->getUniqueId('jsInline-') . '"';
-        $subject->addJsInlineCode($this->getUniqueId(), $jsInlineCode);
+        $jsInlineCode = $expectedJsInlineCodeString = 'var x = "' . StringUtility::getUniqueId('jsInline-') . '"';
+        $subject->addJsInlineCode(StringUtility::getUniqueId(), $jsInlineCode);
 
-        $cssFile = $this->getUniqueId('cssFile-');
+        $cssFile = StringUtility::getUniqueId('cssFile-');
         $expectedCssFileString = 'wrapBefore<link rel="stylesheet" type="text/css" href="' . $cssFile . '" media="print" />wrapAfter';
         $subject->addCssFile($cssFile, 'stylesheet', 'print', '', true, false, 'wrapBeforeXwrapAfter', false, 'X');
 
@@ -98,7 +99,7 @@ class PageRendererTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
         $subject->addCssInlineBlock('general2', 'body {margin:20px;}');
         $subject->addCssInlineBlock('general3', 'h1 {margin:20px;}', null, true);
 
-        $expectedBodyContent = $this->getUniqueId('ABCDE-');
+        $expectedBodyContent = StringUtility::getUniqueId('ABCDE-');
         $subject->setBodyContent($expectedBodyContent);
 
         $renderedString = $subject->render();
@@ -165,8 +166,8 @@ class PageRendererTest extends \TYPO3\TestingFramework\Core\Functional\Functiona
             'X'
         );
 
-        $jsFooterInlineCode = $expectedJsFooterInlineCodeString = 'var x = "' . $this->getUniqueId('jsFooterInline-') . '"';
-        $subject->addJsFooterInlineCode($this->getUniqueId(), $jsFooterInlineCode);
+        $jsFooterInlineCode = $expectedJsFooterInlineCodeString = 'var x = "' . StringUtility::getUniqueId('jsFooterInline-') . '"';
+        $subject->addJsFooterInlineCode(StringUtility::getUniqueId(), $jsFooterInlineCode);
 
         // Bunch of label tests
         $subject->addInlineLanguageLabel('myKey', 'myValue');
index 97f2d1c..813fd24 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Resource\Search\FileSearchDemand;
 use TYPO3\CMS\Core\Resource\StorageRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 /**
@@ -169,7 +170,7 @@ class ResourceStorageTest extends FunctionalTestCase
      */
     public function getRoleReturnsDefaultForRegularFolders()
     {
-        $folderIdentifier = $this->getUniqueId();
+        $folderIdentifier = StringUtility::getUniqueId();
         $this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/sys_file_storage.xml');
         $this->setUpBackendUserFromFixture(1);
 
@@ -197,7 +198,7 @@ class ResourceStorageTest extends FunctionalTestCase
 
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1325842622);
-        $subject->replaceFile($file, Environment::getPublicPath() . '/' . $this->getUniqueId());
+        $subject->replaceFile($file, Environment::getPublicPath() . '/' . StringUtility::getUniqueId());
     }
 
     /**
index e439e4c..d38342b 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
 use TYPO3\CMS\Core\Cache\Backend\ApcuBackend;
 use TYPO3\CMS\Core\Cache\Exception;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -51,7 +52,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = new ApcuBackend('Testing');
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $this->expectException(Exception::class);
         $this->expectExceptionCode(1232986118);
         $backend->set($identifier, $data);
@@ -64,7 +65,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         self::assertTrue($backend->has($identifier));
     }
@@ -76,7 +77,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $fetchedData = $backend->get($identifier);
         self::assertEquals($data, $fetchedData);
@@ -89,7 +90,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $backend->remove($identifier);
         self::assertFalse($backend->has($identifier));
@@ -102,7 +103,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $otherData = 'some other data';
         $backend->set($identifier, $otherData);
@@ -117,7 +118,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tag2']);
         $retrieved = $backend->findIdentifiersByTag('UnitTestTag%tag1');
         self::assertEquals($identifier, $retrieved[0]);
@@ -132,7 +133,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tagX']);
         $backend->set($identifier, $data, ['UnitTestTag%tag3']);
         $retrieved = $backend->findIdentifiersByTag('UnitTestTag%tagX');
@@ -145,7 +146,7 @@ class ApcuBackendTest extends UnitTestCase
     public function hasReturnsFalseIfTheEntryDoesNotExist()
     {
         $backend = $this->setUpBackend();
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         self::assertFalse($backend->has($identifier));
     }
 
@@ -155,7 +156,7 @@ class ApcuBackendTest extends UnitTestCase
     public function removeReturnsFalseIfTheEntryDoesntExist()
     {
         $backend = $this->setUpBackend();
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         self::assertFalse($backend->remove($identifier));
     }
 
@@ -239,7 +240,7 @@ class ApcuBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = str_repeat('abcde', 1024 * 1024);
-        $identifier = $this->getUniqueId('tooLargeData');
+        $identifier = StringUtility::getUniqueId('tooLargeData');
         $backend->set($identifier, $data);
         self::assertTrue($backend->has($identifier));
         self::assertEquals($backend->get($identifier), $data);
@@ -250,7 +251,7 @@ class ApcuBackendTest extends UnitTestCase
      */
     public function setTagsOnlyOnceToIdentifier()
     {
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $tags = ['UnitTestTag%test', 'UnitTestTag%boring'];
 
         $backend = $this->setUpBackend(true);
index 37a77b8..7b123ad 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Cache\Backend\PdoBackend;
 use TYPO3\CMS\Core\Cache\Exception;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -136,7 +137,7 @@ class PdoBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data1 = 'data1';
-        $entryIdentifier = $this->getUniqueId('test');
+        $entryIdentifier = StringUtility::getUniqueId('test');
         $backend->set($entryIdentifier, $data1, [], 1);
         $data2 = 'data2';
         $GLOBALS['EXEC_TIME'] += 2;
index 9b7c927..30ba06d 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Cache\Backend;
  */
 
 use TYPO3\CMS\Core\Cache\Backend\WincacheBackend;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -34,7 +35,7 @@ class WincacheBackendTest extends UnitTestCase
 
         $backend = new WincacheBackend('Testing');
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
     }
 
@@ -45,7 +46,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $inCache = $backend->has($identifier);
         self::assertTrue($inCache, 'WinCache backend failed to set and check entry');
@@ -58,7 +59,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $fetchedData = $backend->get($identifier);
         self::assertEquals($data, $fetchedData, 'Winache backend failed to set and retrieve data');
@@ -71,7 +72,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $backend->remove($identifier);
         $inCache = $backend->has($identifier);
@@ -85,7 +86,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data);
         $otherData = 'some other data';
         $backend->set($identifier, $otherData);
@@ -100,7 +101,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tag2']);
         $retrieved = $backend->findIdentifiersByTag('UnitTestTag%tag1');
         self::assertEquals($identifier, $retrieved[0], 'Could not retrieve expected entry by tag.');
@@ -115,7 +116,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = 'Some data';
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $backend->set($identifier, $data, ['UnitTestTag%tag1', 'UnitTestTag%tagX']);
         $backend->set($identifier, $data, ['UnitTestTag%tag3']);
         $retrieved = $backend->findIdentifiersByTag('UnitTestTag%tagX');
@@ -128,7 +129,7 @@ class WincacheBackendTest extends UnitTestCase
     public function hasReturnsFalseIfTheEntryDoesntExist()
     {
         $backend = $this->setUpBackend();
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         $inCache = $backend->has($identifier);
         self::assertFalse($inCache, '"has" did not return FALSE when checking on non existing identifier');
     }
@@ -139,7 +140,7 @@ class WincacheBackendTest extends UnitTestCase
     public function removeReturnsFalseIfTheEntryDoesntExist()
     {
         $backend = $this->setUpBackend();
-        $identifier = $this->getUniqueId('NonExistingIdentifier');
+        $identifier = StringUtility::getUniqueId('NonExistingIdentifier');
         $inCache = $backend->remove($identifier);
         self::assertFalse($inCache, '"remove" did not return FALSE when checking on non existing identifier');
     }
@@ -224,7 +225,7 @@ class WincacheBackendTest extends UnitTestCase
     {
         $backend = $this->setUpBackend();
         $data = str_repeat('abcde', 1024 * 1024);
-        $identifier = $this->getUniqueId('tooLargeData');
+        $identifier = StringUtility::getUniqueId('tooLargeData');
         $backend->set($identifier, $data);
         self::assertTrue($backend->has($identifier));
         self::assertEquals($backend->get($identifier), $data);
@@ -235,7 +236,7 @@ class WincacheBackendTest extends UnitTestCase
      */
     public function setTagsOnlyOnceToIdentifier()
     {
-        $identifier = $this->getUniqueId('MyIdentifier');
+        $identifier = StringUtility::getUniqueId('MyIdentifier');
         $tags = ['UnitTestTag%test', 'UnitTestTag%boring'];
 
         $backend = $this->setUpBackend(true);
index d6949b0..3a4b144 100644 (file)
@@ -29,6 +29,7 @@ use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\FrontendDefaultFixture;
 use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\FrontendFixture;
 use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\FrontendIdentifierFixture;
 use TYPO3\CMS\Core\Tests\Unit\Cache\Fixtures\FrontendInitializeObjectFixture;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -317,7 +318,7 @@ class CacheManagerTest extends UnitTestCase
     {
         /** @var \PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|CacheManager $manager */
         $manager = $this->getAccessibleMock(CacheManager::class, ['dummy'], [], '', false);
-        $cacheIdentifier = $this->getUniqueId('Test');
+        $cacheIdentifier = StringUtility::getUniqueId('Test');
         $configuration = [
             $cacheIdentifier => [
                 'backend' => BackendFixture::class,
@@ -343,7 +344,7 @@ class CacheManagerTest extends UnitTestCase
     {
         /** @var \PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface|CacheManager $manager */
         $manager = $this->getAccessibleMock(CacheManager::class, ['dummy'], [], '', false);
-        $cacheIdentifier = $this->getUniqueId('Test');
+        $cacheIdentifier = StringUtility::getUniqueId('Test');
         $configuration = [
             $cacheIdentifier => [
                 'frontend' => FrontendFixture::class,
index 3ea9ff5..f633004 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Category;
  */
 
 use TYPO3\CMS\Core\Category\CategoryRegistry;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -43,8 +44,8 @@ class CategoryRegistryTest extends UnitTestCase
         $GLOBALS['TCA']['pages']['columns'] = [];
         $this->subject = new CategoryRegistry();
         $this->tables = [
-            'first' => $this->getUniqueId('first'),
-            'second' => $this->getUniqueId('second')
+            'first' => StringUtility::getUniqueId('first'),
+            'second' => StringUtility::getUniqueId('second')
         ];
         foreach ($this->tables as $tableName) {
             $GLOBALS['TCA'][$tableName] = [
index ae72baf..4b8a247 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Configuration;
 
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
 use TYPO3\CMS\Core\Core\Environment;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -59,7 +60,7 @@ class ConfigurationManagerTest extends UnitTestCase
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1310203814);
 
-        $defaultConfigurationFile = Environment::getVarPath() . '/tests/' . $this->getUniqueId('defaultConfiguration');
+        $defaultConfigurationFile = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('defaultConfiguration');
         file_put_contents(
             $defaultConfigurationFile,
             '<?php throw new \RuntimeException(\'foo\', 1310203814); ?>'
@@ -80,7 +81,7 @@ class ConfigurationManagerTest extends UnitTestCase
     {
         $this->expectException(\RuntimeException::class);
 
-        $configurationFile = Environment::getVarPath() . '/tests/' . $this->getUniqueId('localConfiguration');
+        $configurationFile = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('localConfiguration');
         file_put_contents(
             $configurationFile,
             '<?php throw new \RuntimeException(\'foo\', 1310203815); ?>'
@@ -382,7 +383,7 @@ class ConfigurationManagerTest extends UnitTestCase
         /** @var $subject ConfigurationManager|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['dummy']);
 
-        $file = $this->getUniqueId('test_');
+        $file = StringUtility::getUniqueId('test_');
         $absoluteFile = Environment::getVarPath() . '/tests/' . $file;
         touch($absoluteFile);
         $this->testFilesToDelete[] = $absoluteFile;
@@ -406,11 +407,11 @@ class ConfigurationManagerTest extends UnitTestCase
         /** @var $subject ConfigurationManager|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['dummy']);
 
-        $directory = $this->getUniqueId('test_');
+        $directory = StringUtility::getUniqueId('test_');
         $absoluteDirectory = Environment::getVarPath() . '/tests/' . $directory;
         mkdir($absoluteDirectory);
 
-        $file = $this->getUniqueId('test_');
+        $file = StringUtility::getUniqueId('test_');
         $absoluteFile1 = Environment::getVarPath() . '/tests/' . $file;
         touch($absoluteFile1);
         $this->testFilesToDelete[] = $absoluteFile1;
@@ -429,7 +430,7 @@ class ConfigurationManagerTest extends UnitTestCase
      */
     public function writeLocalConfigurationWritesSortedContentToConfigurationFile(): void
     {
-        $configurationFile = Environment::getVarPath() . '/tests/' . $this->getUniqueId('localConfiguration');
+        $configurationFile = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('localConfiguration');
         if (!is_file($configurationFile)) {
             if (!$fh = fopen($configurationFile, 'wb')) {
                 self::markTestSkipped('Can not create file ' . $configurationFile . '. Please check your write permissions.');
@@ -475,7 +476,7 @@ class ConfigurationManagerTest extends UnitTestCase
         /** @var $subject ConfigurationManager|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['getLocalConfigurationFileLocation']);
 
-        $file = 'tests/' . $this->getUniqueId('test_');
+        $file = 'tests/' . StringUtility::getUniqueId('test_');
         $absoluteFile = Environment::getVarPath() . '/' . $file;
         touch($absoluteFile);
         $subject->method('getLocalConfigurationFileLocation')->willReturn($absoluteFile);
@@ -492,14 +493,14 @@ class ConfigurationManagerTest extends UnitTestCase
     {
         /** @var $subject ConfigurationManager|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface */
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['writeLocalConfiguration', 'getLocalConfigurationFileLocation', 'getFactoryConfigurationFileLocation']);
-        $localConfigurationFile = '/tests/' . $this->getUniqueId('dummy_');
+        $localConfigurationFile = '/tests/' . StringUtility::getUniqueId('dummy_');
         $subject->_set('localConfigurationFile', $localConfigurationFile);
         $subject->method('getLocalConfigurationFileLocation')->willReturn(Environment::getVarPath() . '/' . $localConfigurationFile);
 
-        $factoryConfigurationFile = 'tests/' . $this->getUniqueId('test_') . '.php';
+        $factoryConfigurationFile = 'tests/' . StringUtility::getUniqueId('test_') . '.php';
         $factoryConfigurationAbsoluteFile = Environment::getVarPath() . '/' . $factoryConfigurationFile;
         $subject->method('getFactoryConfigurationFileLocation')->willReturn($factoryConfigurationAbsoluteFile);
-        $uniqueContentString = $this->getUniqueId('string_');
+        $uniqueContentString = StringUtility::getUniqueId('string_');
         $validFactoryConfigurationFileContent =
             '<?php' . LF .
             'return [' . LF .
@@ -526,11 +527,11 @@ class ConfigurationManagerTest extends UnitTestCase
     public function createLocalConfigurationFromFactoryConfigurationMergesConfigurationWithAdditionalFactoryFile(): void
     {
         $subject = $this->getAccessibleMock(ConfigurationManager::class, ['writeLocalConfiguration', 'getLocalConfigurationFileLocation', 'getFactoryConfigurationFileLocation', 'getAdditionalFactoryConfigurationFileLocation']);
-        $localConfigurationFile = '/tests/' . $this->getUniqueId('dummy_');
+        $localConfigurationFile = '/tests/' . StringUtility::getUniqueId('dummy_');
         $subject->_set('localConfigurationFile', $localConfigurationFile);
         $subject->method('getLocalConfigurationFileLocation')->willReturn(Environment::getVarPath() . '/' . $localConfigurationFile);
 
-        $factoryConfigurationFile = 'tests/' . $this->getUniqueId('test_') . '.php';
+        $factoryConfigurationFile = 'tests/' . StringUtility::getUniqueId('test_') . '.php';
         $factoryConfigurationAbsoluteFile = Environment::getVarPath() . '/' . $factoryConfigurationFile;
         $subject->method('getFactoryConfigurationFileLocation')->willReturn($factoryConfigurationAbsoluteFile);
         $validFactoryConfigurationFileContent =
@@ -543,10 +544,10 @@ class ConfigurationManagerTest extends UnitTestCase
         $this->testFilesToDelete[] = $factoryConfigurationAbsoluteFile;
         $subject->_set('factoryConfigurationFile', $factoryConfigurationFile);
 
-        $additionalFactoryConfigurationFile = 'tests/' . $this->getUniqueId('test_') . '.php';
+        $additionalFactoryConfigurationFile = 'tests/' . StringUtility::getUniqueId('test_') . '.php';
         $additionalFactoryConfigurationAbsoluteFile = Environment::getVarPath() . '/' . $additionalFactoryConfigurationFile;
         $subject->method('getAdditionalFactoryConfigurationFileLocation')->willReturn($additionalFactoryConfigurationAbsoluteFile);
-        $uniqueContentString = $this->getUniqueId('string_');
+        $uniqueContentString = StringUtility::getUniqueId('string_');
         $validAdditionalFactoryConfigurationFileContent =
             '<?php' . LF .
             'return [' . LF .
index c4b9973..1ea6bc0 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Core;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -42,7 +43,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase
      */
     public function fileDenyPatternMatchesPhpExtensionDataProvider()
     {
-        $fileName = $this->getUniqueId('filename');
+        $fileName = StringUtility::getUniqueId('filename');
         $data = [];
         $phpExtensions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', 'php,php3,php4,php5,php6,phpsh,phtml,pht', true);
         foreach ($phpExtensions as $extension) {
@@ -69,7 +70,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase
      */
     public function getPathThisScriptCliReadsLocalPartFromArgv()
     {
-        $fakedLocalPart = $this->getUniqueId('Test');
+        $fakedLocalPart = StringUtility::getUniqueId('Test');
         $GLOBALS['_SERVER']['argv'][0] = $fakedLocalPart;
         self::assertStringEndsWith($fakedLocalPart, $this->subject->_call('getPathThisScriptCli'));
     }
@@ -79,7 +80,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase
      */
     public function getPathThisScriptCliReadsLocalPartFromEnv()
     {
-        $fakedLocalPart = $this->getUniqueId('Test');
+        $fakedLocalPart = StringUtility::getUniqueId('Test');
         unset($GLOBALS['_SERVER']['argv']);
         $GLOBALS['_ENV']['_'] = $fakedLocalPart;
         self::assertStringEndsWith($fakedLocalPart, $this->subject->_call('getPathThisScriptCli'));
@@ -90,7 +91,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase
      */
     public function getPathThisScriptCliReadsLocalPartFromServer()
     {
-        $fakedLocalPart = $this->getUniqueId('Test');
+        $fakedLocalPart = StringUtility::getUniqueId('Test');
         unset($GLOBALS['_SERVER']['argv']);
         unset($GLOBALS['_ENV']['_']);
         $GLOBALS['_SERVER']['_'] = $fakedLocalPart;
@@ -103,7 +104,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase
     public function getPathThisScriptCliAddsCurrentWorkingDirectoryFromServerEnvironmentToLocalPathOnUnix()
     {
         $GLOBALS['_SERVER']['argv'][0] = 'foo';
-        $fakedAbsolutePart = '/' . $this->getUniqueId('Absolute') . '/';
+        $fakedAbsolutePart = '/' . StringUtility::getUniqueId('Absolute') . '/';
         $_SERVER['PWD'] = $fakedAbsolutePart;
         self::assertStringStartsWith($fakedAbsolutePart, $this->subject->_call('getPathThisScriptCli'));
     }
index cac1305..112f88c 100644 (file)
@@ -26,6 +26,7 @@ use TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
 use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\AllowAccessHookFixture;
 use TYPO3\CMS\Core\Tests\Unit\DataHandling\Fixtures\InvalidHookFixture;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -133,7 +134,7 @@ class DataHandlerTest extends UnitTestCase
      */
     public function nonAdminWithTableModifyAccessIsNotAllowedToModifyAdminTable()
     {
-        $tableName = $this->getUniqueId('aTable');
+        $tableName = StringUtility::getUniqueId('aTable');
         $GLOBALS['TCA'] = [
             $tableName => [
                 'ctrl' => [
@@ -383,7 +384,7 @@ class DataHandlerTest extends UnitTestCase
      */
     public function doesCheckModifyAccessListHookGetsCalled()
     {
-        $hookClass = $this->getUniqueId('tx_coretest');
+        $hookClass = StringUtility::getUniqueId('tx_coretest');
         $hookMock = $this->getMockBuilder(\TYPO3\CMS\Core\DataHandling\DataHandlerCheckModifyAccessListHookInterface::class)
             ->setMethods(['checkModifyAccessList'])
             ->setMockClassName($hookClass)
@@ -501,7 +502,7 @@ class DataHandlerTest extends UnitTestCase
      */
     public function doesCheckFlexFormValueHookGetsCalled()
     {
-        $hookClass = $this->getUniqueId('tx_coretest');
+        $hookClass = StringUtility::getUniqueId('tx_coretest');
         $hookMock = $this->getMockBuilder($hookClass)
             ->setMethods(['checkFlexFormValue_beforeMerge'])
             ->getMock();
@@ -551,7 +552,7 @@ class DataHandlerTest extends UnitTestCase
         $this->subject->BE_USER = $backendUser;
         $this->subject->enableLogging = true;
         $this->subject->errorLog = [];
-        $logDetailsUnique = $this->getUniqueId('details');
+        $logDetailsUnique = StringUtility::getUniqueId('details');
         $this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::USER_ERROR, $logDetailsUnique);
         self::assertStringEndsWith($logDetailsUnique, $this->subject->errorLog[0]);
     }
@@ -565,7 +566,7 @@ class DataHandlerTest extends UnitTestCase
         $this->subject->BE_USER = $backendUser;
         $this->subject->enableLogging = true;
         $this->subject->errorLog = [];
-        $logDetails = $this->getUniqueId('details');
+        $logDetails = StringUtility::getUniqueId('details');
         $this->subject->log('', 23, SystemLogGenericAction::UNDEFINED, 42, SystemLogErrorClassification::USER_ERROR, '%1$s' . $logDetails . '%2$s', -1, ['foo', 'bar']);
         $expected = 'foo' . $logDetails . 'bar';
         self::assertStringEndsWith($expected, $this->subject->errorLog[0]);
@@ -853,10 +854,10 @@ class DataHandlerTest extends UnitTestCase
      */
     public function deleteRecord_procBasedOnFieldTypeRespectsEnableCascadingDelete()
     {
-        $table = $this->getUniqueId('foo_');
+        $table = StringUtility::getUniqueId('foo_');
         $conf = [
             'type' => 'inline',
-            'foreign_table' => $this->getUniqueId('foreign_foo_'),
+            'foreign_table' => StringUtility::getUniqueId('foreign_foo_'),
             'behaviour' => [
                 'enableCascadingDelete' => 0,
             ]
@@ -865,7 +866,7 @@ class DataHandlerTest extends UnitTestCase
         /** @var \TYPO3\CMS\Core\Database\RelationHandler $mockRelationHandler */
         $mockRelationHandler = $this->createMock(\TYPO3\CMS\Core\Database\RelationHandler::class);
         $mockRelationHandler->itemArray = [
-            '1' => ['table' => $this->getUniqueId('bar_'), 'id' => 67]
+            '1' => ['table' => StringUtility::getUniqueId('bar_'), 'id' => 67]
         ];
 
         /** @var DataHandler|\PHPUnit\Framework\MockObject\MockObject|AccessibleObjectInterface $mockDataHandler */
index 2be3d8e..a6af3a9 100644 (file)
@@ -65,7 +65,7 @@ class FormProtectionFactoryTest extends UnitTestCase
     public function getForTypeBackEndWithExistingBackEndReturnsBackEndFormProtection()
     {
         $userMock = $this->createMock(BackendUserAuthentication::class);
-        $userMock->user = ['uid' => $this->getUniqueId()];
+        $userMock->user = ['uid' => 4711];
         self::assertInstanceOf(
             BackendFormProtection::class,
             FormProtectionFactory::get(
@@ -82,7 +82,7 @@ class FormProtectionFactoryTest extends UnitTestCase
     public function getForTypeBackEndCalledTwoTimesReturnsTheSameInstance()
     {
         $userMock = $this->createMock(BackendUserAuthentication::class);
-        $userMock->user = ['uid' => $this->getUniqueId()];
+        $userMock->user = ['uid' => 4711];
         $arguments = [
             BackendFormProtection::class,
             $userMock,
index f52b368..2cb3057 100644 (file)
@@ -18,6 +18,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Http;
 use Psr\Http\Message\StreamFactoryInterface;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Http\StreamFactory;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -91,7 +92,7 @@ class StreamFactoryTest extends UnitTestCase
      */
     public function testCreateStreamFromFile()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         file_put_contents($fileName, 'Foo');
 
         $factory = new StreamFactory();
@@ -104,7 +105,7 @@ class StreamFactoryTest extends UnitTestCase
      */
     public function testCreateStreamFromFileWithMode()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
 
         $factory = new StreamFactory();
         $stream = $factory->createStreamFromFile($fileName, 'w');
@@ -119,7 +120,7 @@ class StreamFactoryTest extends UnitTestCase
      */
     public function testCreateStreamFromFileWithInvalidMode()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
 
         $this->expectException(\InvalidArgumentException::class);
@@ -133,7 +134,7 @@ class StreamFactoryTest extends UnitTestCase
      */
     public function testCreateStreamFromFileWithMissingFile()
     {
-        $unavailableFileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $unavailableFileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1566823435);
         $factory = new StreamFactory();
@@ -145,7 +146,7 @@ class StreamFactoryTest extends UnitTestCase
      */
     public function testCreateStreamFromResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         file_put_contents($fileName, 'Foo');
 
index d5bf605..79c21a1 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Http;
 
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Http\Stream;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -59,7 +60,7 @@ class StreamTest extends UnitTestCase
      */
     public function isReadableReturnsFalseIfStreamIsNotReadable()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $stream = new Stream($fileName, 'w');
@@ -109,7 +110,7 @@ class StreamTest extends UnitTestCase
      */
     public function toStringSerializationReturnsEmptyStringWhenStreamIsNotReadable()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
@@ -123,7 +124,7 @@ class StreamTest extends UnitTestCase
      */
     public function closeClosesResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'wb+');
@@ -137,7 +138,7 @@ class StreamTest extends UnitTestCase
      */
     public function closeUnsetsResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'wb+');
@@ -152,7 +153,7 @@ class StreamTest extends UnitTestCase
      */
     public function closeDoesNothingAfterDetach()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'wb+');
@@ -178,7 +179,7 @@ class StreamTest extends UnitTestCase
      */
     public function tellReportsCurrentPositionInResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -194,7 +195,7 @@ class StreamTest extends UnitTestCase
      */
     public function tellRaisesExceptionIfResourceIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -212,7 +213,7 @@ class StreamTest extends UnitTestCase
      */
     public function eofReportsFalseWhenNotAtEndOfStream()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -227,7 +228,7 @@ class StreamTest extends UnitTestCase
      */
     public function eofReportsTrueWhenAtEndOfStream()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -244,7 +245,7 @@ class StreamTest extends UnitTestCase
      */
     public function eofReportsTrueWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -260,7 +261,7 @@ class StreamTest extends UnitTestCase
      */
     public function isSeekableReturnsTrueForReadableStreams()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -273,7 +274,7 @@ class StreamTest extends UnitTestCase
      */
     public function isSeekableReturnsFalseForDetachedStreams()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -287,7 +288,7 @@ class StreamTest extends UnitTestCase
      */
     public function seekAdvancesToGivenOffsetOfStream()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -301,7 +302,7 @@ class StreamTest extends UnitTestCase
      */
     public function rewindResetsToStartOfStream()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -316,7 +317,7 @@ class StreamTest extends UnitTestCase
      */
     public function seekRaisesExceptionWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -332,7 +333,7 @@ class StreamTest extends UnitTestCase
      */
     public function isWritableReturnsFalseWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -346,7 +347,7 @@ class StreamTest extends UnitTestCase
      */
     public function writeRaisesExceptionWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -362,7 +363,7 @@ class StreamTest extends UnitTestCase
      */
     public function isReadableReturnsFalseWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'wb+');
@@ -376,7 +377,7 @@ class StreamTest extends UnitTestCase
      */
     public function readRaisesExceptionWhenStreamIsDetached()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'r');
@@ -392,7 +393,7 @@ class StreamTest extends UnitTestCase
      */
     public function readReturnsEmptyStringWhenAtEndOfFile()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'r');
@@ -408,7 +409,7 @@ class StreamTest extends UnitTestCase
      */
     public function getContentsReturnsEmptyStringIfStreamIsNotReadable()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         $this->testFilesToDelete[] = $fileName;
         file_put_contents($fileName, 'FOO BAR');
         $resource = fopen($fileName, 'w');
@@ -461,7 +462,7 @@ class StreamTest extends UnitTestCase
      */
     public function attachWithResourceAttachesResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
@@ -478,7 +479,7 @@ class StreamTest extends UnitTestCase
      */
     public function attachWithStringRepresentingResourceCreatesAndAttachesResource()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $this->stream->attach($fileName);
@@ -496,7 +497,7 @@ class StreamTest extends UnitTestCase
      */
     public function getContentsShouldGetFullStreamContents()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
@@ -515,7 +516,7 @@ class StreamTest extends UnitTestCase
      */
     public function getContentsShouldReturnStreamContentsFromCurrentPointer()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
@@ -534,7 +535,7 @@ class StreamTest extends UnitTestCase
      */
     public function getMetadataReturnsAllMetadataWhenNoKeyPresent()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
@@ -551,7 +552,7 @@ class StreamTest extends UnitTestCase
      */
     public function getMetadataReturnsDataForSpecifiedKey()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
@@ -570,7 +571,7 @@ class StreamTest extends UnitTestCase
      */
     public function getMetadataReturnsNullIfNoDataExistsForKey()
     {
-        $fileName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_');
+        $fileName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_');
         touch($fileName);
         $this->testFilesToDelete[] = $fileName;
         $resource = fopen($fileName, 'r+');
index cb2ee0a..1c724bf 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Log\LogLevel;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Log\Processor\NullProcessor;
 use TYPO3\CMS\Core\Log\Writer\NullWriter;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -56,7 +57,7 @@ class LogManagerTest extends UnitTestCase
      */
     public function managerReturnsSameLoggerOnRepeatedRequest()
     {
-        $loggerName = $this->getUniqueId('test.core.log');
+        $loggerName = StringUtility::getUniqueId('test.core.log');
         $logger = new LogManager();
         $logger->registerLogger($loggerName);
         $logger1 = $logger->getLogger($loggerName);
index 5be86dd..39632d4 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Log\Writer;
 
 use PHPUnit\Framework\MockObject\MockObject;
 use TYPO3\CMS\Core\Log\Writer\DatabaseWriter;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -28,7 +29,7 @@ class DatabaseWriterTest extends UnitTestCase
      */
     public function getTableReturnsPreviouslySetTable()
     {
-        $logTable = $this->getUniqueId('logtable_');
+        $logTable = StringUtility::getUniqueId('logtable_');
         /** @var DatabaseWriter|MockObject $subject */
         $subject = $this->getMockBuilder(DatabaseWriter::class)
             ->setMethods(['dummy'])
index d465493..24fd8ed 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Log\LogRecord;
 use TYPO3\CMS\Core\Log\Writer\FileWriter;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -54,7 +55,7 @@ class FileWriterTest extends UnitTestCase
     protected function createLogger($name = ''): Logger
     {
         if (empty($name)) {
-            $name = $this->getUniqueId('test.core.log.');
+            $name = StringUtility::getUniqueId('test.core.log.');
         }
         GeneralUtility::makeInstance(LogManager::class)->registerLogger($name);
         /** @var Logger $logger */
@@ -130,8 +131,8 @@ class FileWriterTest extends UnitTestCase
      */
     public function logsToFileDataProvider(): array
     {
-        $simpleRecord = GeneralUtility::makeInstance(LogRecord::class, $this->getUniqueId('test.core.log.fileWriter.simpleRecord.'), \TYPO3\CMS\Core\Log\LogLevel::INFO, 'test record');
-        $recordWithData = GeneralUtility::makeInstance(LogRecord::class, $this->getUniqueId('test.core.log.fileWriter.recordWithData.'), \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test record with data', ['foo' => ['bar' => 'baz']]);
+        $simpleRecord = GeneralUtility::makeInstance(LogRecord::class, StringUtility::getUniqueId('test.core.log.fileWriter.simpleRecord.'), \TYPO3\CMS\Core\Log\LogLevel::INFO, 'test record');
+        $recordWithData = GeneralUtility::makeInstance(LogRecord::class, StringUtility::getUniqueId('test.core.log.fileWriter.recordWithData.'), \TYPO3\CMS\Core\Log\LogLevel::ALERT, 'test record with data', ['foo' => ['bar' => 'baz']]);
         return [
             'simple record' => [$simpleRecord, trim((string)$simpleRecord)],
             'record with data' => [$recordWithData, trim((string)$recordWithData)]
@@ -161,7 +162,7 @@ class FileWriterTest extends UnitTestCase
 
         $recordWithData = GeneralUtility::makeInstance(
             LogRecord::class,
-            $this->getUniqueId('test.core.log.fileWriter.recordWithData.'),
+            StringUtility::getUniqueId('test.core.log.fileWriter.recordWithData.'),
             \TYPO3\CMS\Core\Log\LogLevel::INFO,
             'test record with unicode and slash in data to encode',
             ['foo' => ['bar' => 'I paid 0.00€ for open source projects/code']]
@@ -212,7 +213,7 @@ class FileWriterTest extends UnitTestCase
 
         $secondWriter->expects(self::never())->method('createLogFile');
 
-        $logFilePrefix = $this->getUniqueId('unique');
+        $logFilePrefix = StringUtility::getUniqueId('unique');
         $firstWriter->setLogFile($this->getDefaultFileName($logFilePrefix));
         $secondWriter->setLogFile($this->getDefaultFileName($logFilePrefix));
     }
@@ -234,7 +235,7 @@ class FileWriterTest extends UnitTestCase
         $firstWriter->expects(self::never())->method('closeLogFile');
         $secondWriter->expects(self::once())->method('closeLogFile');
 
-        $logFilePrefix = $this->getUniqueId('unique');
+        $logFilePrefix = StringUtility::getUniqueId('unique');
         $firstWriter->setLogFile($this->getDefaultFileName($logFilePrefix));
         $secondWriter->setLogFile($this->getDefaultFileName($logFilePrefix));
         $firstWriter->__destruct();
index 89999bd..e5364e1 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Package\Exception\UnknownPackageException;
 use TYPO3\CMS\Core\Package\Package;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Service\DependencyOrderingService;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -124,10 +125,10 @@ class PackageManagerTest extends UnitTestCase
     public function scanAvailablePackagesTraversesThePackagesDirectoryAndRegistersPackagesItFinds(): void
     {
         $expectedPackageKeys = [
-            $this->getUniqueId('TYPO3.CMS'),
-            $this->getUniqueId('TYPO3.CMS.Test'),
-            $this->getUniqueId('TYPO3.YetAnotherTestPackage'),
-            $this->getUniqueId('Lolli.Pop.NothingElse')
+            StringUtility::getUniqueId('TYPO3.CMS'),
+            StringUtility::getUniqueId('TYPO3.CMS.Test'),
+            StringUtility::getUniqueId('TYPO3.YetAnotherTestPackage'),
+            StringUtility::getUniqueId('Lolli.Pop.NothingElse')
         ];
 
         foreach ($expectedPackageKeys as $packageKey) {
@@ -155,10 +156,10 @@ class PackageManagerTest extends UnitTestCase
     public function scanAvailablePackagesKeepsExistingPackageConfiguration(): void
     {
         $expectedPackageKeys = [
-            $this->getUniqueId('TYPO3.CMS'),
-            $this->getUniqueId('TYPO3.CMS.Test'),
-            $this->getUniqueId('TYPO3.YetAnotherTestPackage'),
-            $this->getUniqueId('Lolli.Pop.NothingElse')
+            StringUtility::getUniqueId('TYPO3.CMS'),
+            StringUtility::getUniqueId('TYPO3.CMS.Test'),
+            StringUtility::getUniqueId('TYPO3.YetAnotherTestPackage'),
+            StringUtility::getUniqueId('Lolli.Pop.NothingElse')
         ];
 
         $packagePaths = [];
@@ -199,9 +200,9 @@ class PackageManagerTest extends UnitTestCase
     public function packageStatesConfigurationContainsRelativePaths(): void
     {
         $packageKeys = [
-            $this->getUniqueId('Lolli.Pop.NothingElse'),
-            $this->getUniqueId('TYPO3.Package'),
-            $this->getUniqueId('TYPO3.YetAnotherTestPackage')
+            StringUtility::getUniqueId('Lolli.Pop.NothingElse'),
+            StringUtility::getUniqueId('TYPO3.Package'),
+            StringUtility::getUniqueId('TYPO3.YetAnotherTestPackage')
         ];
 
         $packagePaths = [];
index b6d7786..9a3a11a 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Page;
  */
 
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -66,9 +67,9 @@ class PageRendererTest extends UnitTestCase
     {
         /** @var PageRenderer|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(PageRenderer::class, ['dummy'], [], '', false);
-        $fileReference = $this->getUniqueId('file_');
-        $selectionPrefix = $this->getUniqueId('prefix_');
-        $stripFromSelectionName = $this->getUniqueId('strip_');
+        $fileReference = StringUtility::getUniqueId('file_');
+        $selectionPrefix = StringUtility::getUniqueId('prefix_');
+        $stripFromSelectionName = StringUtility::getUniqueId('strip_');
 
         $expectedInlineLanguageLabelFile = [
             'fileRef' => $fileReference,
@@ -89,17 +90,17 @@ class PageRendererTest extends UnitTestCase
     {
         /** @var PageRenderer|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(PageRenderer::class, ['dummy'], [], '', false);
-        $fileReference1 = $this->getUniqueId('file1_');
-        $selectionPrefix1 = $this->getUniqueId('prefix1_');
-        $stripFromSelectionName1 = $this->getUniqueId('strip1_');
+        $fileReference1 = StringUtility::getUniqueId('file1_');
+        $selectionPrefix1 = StringUtility::getUniqueId('prefix1_');
+        $stripFromSelectionName1 = StringUtility::getUniqueId('strip1_');
         $expectedInlineLanguageLabelFile1 = [
             'fileRef' => $fileReference1,
             'selectionPrefix' => $selectionPrefix1,
             'stripFromSelectionName' => $stripFromSelectionName1
         ];
-        $fileReference2 = $this->getUniqueId('file2_');
-        $selectionPrefix2 = $this->getUniqueId('prefix2_');
-        $stripFromSelectionName2 = $this->getUniqueId('strip2_');
+        $fileReference2 = StringUtility::getUniqueId('file2_');
+        $selectionPrefix2 = StringUtility::getUniqueId('prefix2_');
+        $stripFromSelectionName2 = StringUtility::getUniqueId('strip2_');
         $expectedInlineLanguageLabelFile2 = [
             'fileRef' => $fileReference2,
             'selectionPrefix' => $selectionPrefix2,
@@ -121,9 +122,9 @@ class PageRendererTest extends UnitTestCase
     {
         /** @var PageRenderer|\PHPUnit\Framework\MockObject\MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface $subject */
         $subject = $this->getAccessibleMock(PageRenderer::class, ['dummy'], [], '', false);
-        $fileReference = $this->getUniqueId('file2_');
-        $selectionPrefix = $this->getUniqueId('prefix2_');
-        $stripFromSelectionName = $this->getUniqueId('strip2_');
+        $fileReference = StringUtility::getUniqueId('file2_');
+        $selectionPrefix = StringUtility::getUniqueId('prefix2_');
+        $stripFromSelectionName = StringUtility::getUniqueId('strip2_');
 
         $subject->addInlineLanguageLabelFile($fileReference, $selectionPrefix, $stripFromSelectionName);
         $subject->addInlineLanguageLabelFile($fileReference, $selectionPrefix, $stripFromSelectionName);
index d8aacba..62b27b1 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  */
 
 use org\bovigo\vfs\vfsStream;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -34,8 +35,8 @@ abstract class BaseTestCase extends UnitTestCase
     protected function setUp(): void
     {
         parent::setUp();
-        $this->mountDir = $this->getUniqueId('mount-');
-        $this->basedir = $this->getUniqueId('base-');
+        $this->mountDir = StringUtility::getUniqueId('mount-');
+        $this->basedir = StringUtility::getUniqueId('base-');
         vfsStream::setup($this->basedir);
         // Add an entry for the mount directory to the VFS contents
         $this->vfsContents = [$this->mountDir => []];
index e80f4cd..3a511fe 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Collection;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
+
 /**
  * Test cases for FileCollectionRegistry
  */
@@ -54,7 +56,7 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1391295613);
 
-        $this->testSubject->registerFileCollectionClass($this->getUniqueId(), substr($this->getUniqueId(), 0, 30));
+        $this->testSubject->registerFileCollectionClass(StringUtility::getUniqueId('class_'), substr(StringUtility::getUniqueId('type_'), 0, 30));
     }
 
     /**
@@ -103,7 +105,7 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1391295644);
 
-        $this->testSubject->getFileCollectionClass($this->getUniqueId());
+        $this->testSubject->getFileCollectionClass(StringUtility::getUniqueId());
     }
 
     /**
@@ -122,7 +124,7 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
     public function fileCollectionRegistryIsInitializedWithPreconfiguredFileCollections()
     {
         $className = get_class($this->getMockForAbstractClass(\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::class));
-        $type = substr($this->getUniqueId(), 0, 30);
+        $type = substr(StringUtility::getUniqueId('type_'), 0, 30);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredCollections'] = [
             $type => $className
         ];
@@ -152,7 +154,7 @@ class FileCollectionRegistryTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\Bas
     {
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredFileCollections'] = [];
         $this->initializeTestSubject();
-        self::assertFalse($this->testSubject->fileCollectionTypeExists($this->getUniqueId()));
+        self::assertFalse($this->testSubject->fileCollectionTypeExists(StringUtility::getUniqueId('name_')));
     }
 
     /**
index be4c29b..87ff1a1 100644 (file)
@@ -19,6 +19,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Driver;
 use TYPO3\CMS\Core\Resource\Driver\AbstractDriver;
 use TYPO3\CMS\Core\Resource\Driver\DriverInterface;
 use TYPO3\CMS\Core\Resource\Driver\DriverRegistry;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -60,7 +61,7 @@ class DriverRegistryTest extends UnitTestCase
     {
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1314979197);
-        $this->subject->registerDriverClass($this->getUniqueId());
+        $this->subject->registerDriverClass(StringUtility::getUniqueId('class_'));
     }
 
     /**
@@ -83,7 +84,7 @@ class DriverRegistryTest extends UnitTestCase
     {
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1314085990);
-        $this->subject->getDriverClass($this->getUniqueId());
+        $this->subject->getDriverClass(StringUtility::getUniqueId('class_'));
     }
 
     /**
@@ -102,7 +103,7 @@ class DriverRegistryTest extends UnitTestCase
     public function driverRegistryIsInitializedWithPreconfiguredDrivers(): void
     {
         $className = get_class($this->getMockForAbstractClass(AbstractDriver::class));
-        $shortName = $this->getUniqueId();
+        $shortName = StringUtility::getUniqueId('class_');
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = [
             $shortName => [
                 'class' => $className
@@ -118,7 +119,7 @@ class DriverRegistryTest extends UnitTestCase
     public function driverExistsReturnsTrueForAllExistingDrivers(): void
     {
         $className = get_class($this->getMockForAbstractClass(AbstractDriver::class));
-        $shortName = $this->getUniqueId();
+        $shortName = StringUtility::getUniqueId('class_');
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = [
             $shortName => [
                 'class' => $className
@@ -126,7 +127,7 @@ class DriverRegistryTest extends UnitTestCase
         ];
         $this->initializeSubject();
         self::assertTrue($this->subject->driverExists($shortName));
-        self::assertFalse($this->subject->driverExists($this->getUniqueId()));
+        self::assertFalse($this->subject->driverExists(StringUtility::getUniqueId('class')));
     }
 
     /**
@@ -136,6 +137,6 @@ class DriverRegistryTest extends UnitTestCase
     {
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = [];
         $this->initializeSubject();
-        self::assertFalse($this->subject->driverExists($this->getUniqueId()));
+        self::assertFalse($this->subject->driverExists(StringUtility::getUniqueId('class_')));
     }
 }
index 43166a4..2b1f99d 100644 (file)
@@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCase;
 use TYPO3\CMS\Core\Tests\Unit\Resource\Driver\Fixtures\LocalDriverFilenameFilter;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 
 /**
  * Test case
@@ -86,7 +87,7 @@ class LocalDriverTest extends BaseTestCase
      */
     protected function createRealTestdir(): string
     {
-        $basedir = Environment::getVarPath() . '/tests/' . $this->getUniqueId('fal-test-');
+        $basedir = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('fal-test-');
         mkdir($basedir);
         $this->testDirs[] = $basedir;
         return $basedir;
@@ -534,7 +535,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function getPublicUrlReturnsCorrectUriForConfiguredBaseUri(): void
     {
-        $baseUri = 'http://example.org/foobar/' . $this->getUniqueId();
+        $baseUri = 'http://example.org/foobar/' . StringUtility::getUniqueId('uri_');
         $this->addToMount([
             'file.ext' => 'asdf',
             'subfolder' => [
@@ -570,7 +571,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function getPublicUrlReturnsValidUrlContainingSpecialCharacters(string $fileIdentifier): void
     {
-        $baseUri = 'http://example.org/foobar/' . $this->getUniqueId();
+        $baseUri = 'http://example.org/foobar/' . StringUtility::getUniqueId('uri_');
         $subject = $this->createDriver([
             'baseUri' => $baseUri
         ]);
@@ -936,7 +937,7 @@ class LocalDriverTest extends BaseTestCase
         $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1304964032);
         $subject = $this->createDriver();
-        $subject->hash('/hashFile', $this->getUniqueId());
+        $subject->hash('/hashFile', StringUtility::getUniqueId('uri_'));
     }
 
     /**
@@ -1158,7 +1159,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function filesCanBeCopiedWithinStorage(): void
     {
-        $fileContents = $this->getUniqueId();
+        $fileContents = StringUtility::getUniqueId('content_');
         $this->addToMount([
             'someFile' => $fileContents,
             'targetFolder' => []
@@ -1176,7 +1177,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function filesCanBeMovedWithinStorage(): void
     {
-        $fileContents = $this->getUniqueId();
+        $fileContents = StringUtility::getUniqueId('content_');
         $this->addToMount([
             'targetFolder' => [],
             'someFile' => $fileContents
@@ -1193,7 +1194,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function fileMetadataIsChangedAfterMovingFile(): void
     {
-        $fileContents = $this->getUniqueId();
+        $fileContents = StringUtility::getUniqueId('content_');
         $this->addToMount([
             'targetFolder' => [],
             'someFile' => $fileContents
@@ -1406,7 +1407,7 @@ class LocalDriverTest extends BaseTestCase
      */
     public function foldersCanBeMovedWithinStorage(): void
     {
-        $fileContents = $this->getUniqueId();
+        $fileContents = StringUtility::getUniqueId('content_');
         $this->addToMount([
             'sourceFolder' => [
                 'file' => $fileContents,
@@ -1451,7 +1452,7 @@ class LocalDriverTest extends BaseTestCase
     {
         $this->addToMount([
             'sourceFolder' => [
-                'file' => $this->getUniqueId(),
+                'file' => StringUtility::getUniqueId('content_'),
             ],
             'targetFolder' => [],
         ]);
@@ -1467,7 +1468,7 @@ class LocalDriverTest extends BaseTestCase
     {
         $this->addToMount([
             'sourceFolder' => [
-                'file' => $this->getUniqueId(),
+                'file' => StringUtility::getUniqueId('name_'),
             ],
             'targetFolder' => [],
         ]);
@@ -1497,7 +1498,7 @@ class LocalDriverTest extends BaseTestCase
         [$basePath, $subject] = $this->prepareRealTestEnvironment();
         GeneralUtility::mkdir_deep($basePath . '/sourceFolder/subFolder');
         GeneralUtility::mkdir_deep($basePath . '/targetFolder');
-        file_put_contents($basePath . '/sourceFolder/subFolder/file', $this->getUniqueId());
+        file_put_contents($basePath . '/sourceFolder/subFolder/file', StringUtility::getUniqueId('content_'));
         GeneralUtility::fixPermissions($basePath . '/sourceFolder/subFolder/file');
 
         $subject->copyFolderWithinStorage('/sourceFolder/', '/targetFolder/', 'newFolderName');
index b63696e..4eff361 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -126,7 +127,7 @@ class FileReferenceTest extends UnitTestCase
         $this->expectExceptionCode(1314226805);
 
         $fixture = $this->prepareFixture($fileReferenceProperties, $originalFileProperties);
-        $fixture->getProperty($this->getUniqueId('nothingHere'));
+        $fixture->getProperty(StringUtility::getUniqueId('nothingHere'));
     }
 
     /**
index 5285fc9..9ea0e11 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Resource\Index\MetaDataRepository;
 use TYPO3\CMS\Core\Resource\MetaDataAspect;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -63,7 +64,7 @@ class FileTest extends UnitTestCase
     public function commonPropertiesAreAvailableWithOwnGetters(): void
     {
         $properties = [
-            'name' => $this->getUniqueId(),
+            'name' => StringUtility::getUniqueId('name_'),
             'storage' => $this->storageMock,
             'size' => 1024
         ];
@@ -89,7 +90,7 @@ class FileTest extends UnitTestCase
      */
     public function updatePropertiesUpdatesFileProperties(): void
     {
-        $identifier = '/' . $this->getUniqueId();
+        $identifier = '/' . StringUtility::getUniqueId('identifier_');
         $fixture = new File(['uid' => 1, 'identifier' => '/test'], $this->storageMock);
         $fixture->updateProperties(['identifier' => $identifier]);
         self::assertEquals($identifier, $fixture->getIdentifier());
index 8600bc1..d2ec8a2 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
  */
 
 use org\bovigo\vfs\vfsStream;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -48,8 +49,8 @@ class FolderTest extends UnitTestCase
      */
     public function constructorArgumentsAreAvailableAtRuntime()
     {
-        $path = $this->getUniqueId();
-        $name = $this->getUniqueId();
+        $path = StringUtility::getUniqueId('path_');
+        $name = StringUtility::getUniqueId('name_');
         $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
         $fixture = $this->createFolderFixture($path, $name, $mockedStorage);
         self::assertSame($mockedStorage, $fixture->getStorage());
index 8339098..1b8c972 100644 (file)
@@ -19,6 +19,7 @@ use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\Resource\Folder;
 use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -63,7 +64,7 @@ class ProcessedFileTest extends UnitTestCase
         $this->databaseRow = [
             'uid' => '1234567',
             'identifier' => 'dummy.txt',
-            'name' => $this->getUniqueId('dummy_'),
+            'name' => StringUtility::getUniqueId('dummy_'),
             'storage' => $this->storageMock->getUid(),
             'configuration' => null,
             'originalfilesha1' => null,
index 558f54f..1fc7ba3 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\Rendering;
 use TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer;
 use TYPO3\CMS\Core\Resource\Rendering\RendererRegistry;
 use TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -50,7 +51,7 @@ class RendererRegistryTest extends UnitTestCase
      */
     public function registeredFileRenderClassCanBeRetrieved()
     {
-        $rendererClass = $this->getUniqueId('myRenderer');
+        $rendererClass = StringUtility::getUniqueId('myRenderer');
         $rendererObject = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass)
             ->getMock();
@@ -70,7 +71,7 @@ class RendererRegistryTest extends UnitTestCase
         $this->expectExceptionCode(1411840171);
 
         $rendererRegistry = $this->getTestRendererRegistry();
-        $rendererRegistry->registerRendererClass($this->getUniqueId());
+        $rendererRegistry->registerRendererClass(StringUtility::getUniqueId());
     }
 
     /**
@@ -91,19 +92,19 @@ class RendererRegistryTest extends UnitTestCase
      */
     public function registerRendererClassWithHighestPriorityIsFirstInResult()
     {
-        $rendererClass1 = $this->getUniqueId('myRenderer1');
+        $rendererClass1 = StringUtility::getUniqueId('myRenderer1');
         $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass1)
             ->getMock();
         $rendererObject1->expects(self::any())->method('getPriority')->willReturn(1);
 
-        $rendererClass2 = $this->getUniqueId('myRenderer2');
+        $rendererClass2 = StringUtility::getUniqueId('myRenderer2');
         $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass2)
             ->getMock();
         $rendererObject2->expects(self::any())->method('getPriority')->willReturn(10);
 
-        $rendererClass3 = $this->getUniqueId('myRenderer3');
+        $rendererClass3 = StringUtility::getUniqueId('myRenderer3');
         $rendererObject3 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass3)
             ->getMock();
@@ -131,13 +132,13 @@ class RendererRegistryTest extends UnitTestCase
      */
     public function registeredFileRendererClassWithSamePriorityAreAllReturned()
     {
-        $rendererClass1 = $this->getUniqueId('myRenderer1');
+        $rendererClass1 = StringUtility::getUniqueId('myRenderer1');
         $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass1)
             ->getMock();
         $rendererObject1->expects(self::any())->method('getPriority')->willReturn(1);
 
-        $rendererClass2 = $this->getUniqueId('myRenderer2');
+        $rendererClass2 = StringUtility::getUniqueId('myRenderer2');
         $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMockClassName($rendererClass2)
             ->getMock();
@@ -162,7 +163,7 @@ class RendererRegistryTest extends UnitTestCase
      */
     public function getRendererReturnsCorrectInstance()
     {
-        $rendererClass1 = $this->getUniqueId('myVideoRenderer');
+        $rendererClass1 = StringUtility::getUniqueId('myVideoRenderer');
         $rendererObject1 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMethods(['getPriority', 'canRender', 'render'])
             ->setMockClassName($rendererClass1)
@@ -170,7 +171,7 @@ class RendererRegistryTest extends UnitTestCase
         $rendererObject1->expects(self::any())->method('getPriority')->willReturn(1);
         $rendererObject1->expects(self::once())->method('canRender')->willReturn(true);
 
-        $rendererClass2 = $this->getUniqueId('myAudioRenderer');
+        $rendererClass2 = StringUtility::getUniqueId('myAudioRenderer');
         $rendererObject2 = $this->getMockBuilder(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class)
             ->setMethods(['getPriority', 'canRender', 'render'])
             ->setMockClassName($rendererClass2)
index a6832d3..926ff0f 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource;
 use Psr\EventDispatcher\EventDispatcherInterface;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -68,8 +69,8 @@ class ResourceFactoryTest extends UnitTestCase
     public function createStorageCollectionObjectCreatesCollectionWithCorrectArguments()
     {
         $mockedMount = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class);
-        $path = $this->getUniqueId();
-        $name = $this->getUniqueId();
+        $path = StringUtility::getUniqueId('path_');
+        $name = StringUtility::getUniqueId('name_');
         $storageCollection = $this->subject->createFolderObject($mockedMount, $path, $name, 0);
         self::assertSame($mockedMount, $storageCollection->getStorage());
         self::assertEquals($path, $storageCollection->getIdentifier());
index 8e14037..2560b5a 100644 (file)
@@ -35,6 +35,7 @@ use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 
 /**
  * Test case for ResourceStorage class
@@ -601,7 +602,7 @@ class ResourceStorageTest extends BaseTestCase
         $mockedFile->expects(self::any())->method('getUpdatedProperties')->willReturn(array_keys($newProperties));
         // do not update directly; that's up to the indexer
         $indexFileRepositoryMock->expects(self::never())->method('update');
-        $this->subject->setFileContents($mockedFile, $this->getUniqueId());
+        $this->subject->setFileContents($mockedFile, StringUtility::getUniqueId('content_'));
     }
 
     /**
index ff93164..fdee3b5 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Resource\TextExtraction;
 
 use TYPO3\CMS\Core\Resource\TextExtraction\TextExtractorInterface;
 use TYPO3\CMS\Core\Resource\TextExtraction\TextExtractorRegistry;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -49,7 +50,7 @@ class TextExtractorRegistryTest extends UnitTestCase
      */
     public function registeredTextExtractorClassCanBeRetrieved()
     {
-        $textExtractorClass = $this->getUniqueId('myTextExtractor');
+        $textExtractorClass = StringUtility::getUniqueId('myTextExtractor');
         $textExtractorInstance = $this->getMockBuilder(TextExtractorInterface::class)
             ->setMockClassName($textExtractorClass)
             ->getMock();
@@ -69,7 +70,7 @@ class TextExtractorRegistryTest extends UnitTestCase
         $this->expectExceptionCode(1422906893);
 
         $textExtractorRegistry = $this->getTextExtractorRegistry();
-        $textExtractorRegistry->registerTextExtractor($this->getUniqueId());
+        $textExtractorRegistry->registerTextExtractor(StringUtility::getUniqueId());
     }
 
     /**
index 2096ace..906e03e 100644 (file)
@@ -26,6 +26,7 @@ use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -110,7 +111,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function isLoadedReturnsFalseIfExtensionIsNotLoaded()
     {
-        self::assertFalse(ExtensionManagementUtility::isLoaded($this->getUniqueId('foobar')));
+        self::assertFalse(ExtensionManagementUtility::isLoaded(StringUtility::getUniqueId('foobar')));
     }
 
     ///////////////////////////////
@@ -124,7 +125,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
         $this->expectException(\BadFunctionCallException::class);
         $this->expectExceptionCode(1365429656);
 
-        $packageName = $this->getUniqueId('foo');
+        $packageName = StringUtility::getUniqueId('foo');
         /** @var PackageManager|\PHPUnit\Framework\MockObject\MockObject $packageManager */
         $packageManager = $this->getMockBuilder(PackageManager::class)
             ->setMethods(['isPackageActive'])
@@ -247,7 +248,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToAllTCATypesBeforeExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'before:fieldD');
         // Checking typeA:
@@ -264,7 +265,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToAllTCATypesAfterExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldC');
         // Checking typeA:
@@ -281,7 +282,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToAllTCATypesRespectsPalettes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         $GLOBALS['TCA'][$table]['types']['typeD'] = ['showitem' => 'fieldY, --palette--;;standard, fieldZ'];
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:--palette--;;standard');
@@ -297,7 +298,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToAllTCATypesRespectsPositionFieldInPalette()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', '', 'after:fieldX1');
         // Checking typeA:
@@ -312,7 +313,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToTCATypeBeforeExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'before:fieldD');
         // Checking typeA:
@@ -329,7 +330,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToTCATypeAfterExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'newA, newA, newB, fieldA', 'typeA', 'after:fieldC');
         // Checking typeA:
@@ -343,7 +344,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldWithPartOfAlreadyExistingFieldname()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addToAllTCAtypes($table, 'field', 'typeA', 'after:fieldD1');
 
@@ -358,7 +359,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToTCATypeAndReplaceExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         $typesBefore = $GLOBALS['TCA'][$table]['types'];
         ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldZ', '', 'replace:fieldX');
@@ -376,7 +377,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function addToAllTCAtypesReplacesExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         $typesBefore = $GLOBALS['TCA'][$table]['types'];
         ExtensionManagementUtility::addToAllTCAtypes($table, 'fieldX, --palette--;;foo', '', 'replace:fieldX');
@@ -397,7 +398,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToPaletteBeforeExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'before:fieldY');
         self::assertEquals('fieldX, fieldX1, newA, newB, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
@@ -411,7 +412,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToPaletteAfterExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
         ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:fieldX');
         self::assertEquals('fieldX, newA, newB, fieldX1, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
@@ -425,9 +426,9 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function canAddFieldsToPaletteAfterNotExistingOnes()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'] = $this->generateTCAForTable($table);
-        ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:' . $this->getUniqueId('notExisting'));
+        ExtensionManagementUtility::addFieldsToPalette($table, 'paletteA', 'newA, newA, newB, fieldX', 'after:' . StringUtility::getUniqueId('notExisting'));
         self::assertEquals('fieldX, fieldX1, fieldY, newA, newB', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
     }
 
@@ -1201,7 +1202,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
             ->getMock();
         $mockCacheManager->expects(self::never())->method('getCache');
         ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
-        $packageManager = $this->createMockPackageManagerWithMockPackage($this->getUniqueId());
+        $packageManager = $this->createMockPackageManagerWithMockPackage(StringUtility::getUniqueId());
         ExtensionManagementUtility::setPackageManager($packageManager);
         ExtensionManagementUtility::loadExtLocalconf(false);
     }
@@ -1238,7 +1239,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1340559079);
 
-        $extensionName = $this->getUniqueId('foo');
+        $extensionName = StringUtility::getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         $extLocalconfLocation = $packageManager->getPackage($extensionName)->getPackagePath() . 'ext_localconf.php';
         file_put_contents($extLocalconfLocation, "<?php\n\nthrow new RuntimeException('', 1340559079);\n\n?>");
@@ -1329,10 +1330,10 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function createExtLocalconfCacheEntryWritesCacheEntryWithContentOfLoadedExtensionExtLocalconf()
     {
-        $extensionName = $this->getUniqueId('foo');
+        $extensionName = StringUtility::getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         $extLocalconfLocation = $packageManager->getPackage($extensionName)->getPackagePath() . 'ext_localconf.php';
-        $uniqueStringInLocalconf = $this->getUniqueId('foo');
+        $uniqueStringInLocalconf = StringUtility::getUniqueId('foo');
         file_put_contents($extLocalconfLocation, "<?php\n\n" . $uniqueStringInLocalconf . "\n\n?>");
         ExtensionManagementUtility::setPackageManager($packageManager);
         $mockCache = $this->getMockBuilder(PhpFrontend::class)
@@ -1349,7 +1350,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function createExtLocalconfCacheEntryWritesCacheEntryWithExtensionContentOnlyIfExtLocalconfExists()
     {
-        $extensionName = $this->getUniqueId('foo');
+        $extensionName = StringUtility::getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         ExtensionManagementUtility::setPackageManager($packageManager);
         $mockCache = $this->getMockBuilder(PhpFrontend::class)
@@ -1373,7 +1374,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
             ->disableOriginalConstructor()
             ->getMock();
         $mockCache->expects(self::once())->method('set')->with(self::anything(), self::anything(), self::equalTo([]));
-        $packageManager = $this->createMockPackageManagerWithMockPackage($this->getUniqueId());
+        $packageManager = $this->createMockPackageManagerWithMockPackage(StringUtility::getUniqueId());
         ExtensionManagementUtility::setPackageManager($packageManager);
         ExtensionManagementUtilityAccessibleProxy::createExtLocalconfCacheEntry($mockCache);
     }
@@ -1430,15 +1431,15 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function loadBaseTcaCreatesCacheFileWithContentOfAnExtensionsConfigurationTcaPhpFile()
     {
-        $extensionName = $this->getUniqueId('test_baseTca_');
+        $extensionName = StringUtility::getUniqueId('test_baseTca_');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         $packagePath = $packageManager->getPackage($extensionName)->getPackagePath();
         GeneralUtility::mkdir($packagePath);
         GeneralUtility::mkdir($packagePath . 'Configuration/');
         GeneralUtility::mkdir($packagePath . 'Configuration/TCA/');
         ExtensionManagementUtility::setPackageManager($packageManager);
-        $uniqueTableName = $this->getUniqueId('table_name_');
-        $uniqueStringInTableConfiguration = $this->getUniqueId('table_configuration_');
+        $uniqueTableName = StringUtility::getUniqueId('table_name_');
+        $uniqueStringInTableConfiguration = StringUtility::getUniqueId('table_configuration_');
         $tableConfiguration = '<?php return array(\'foo\' => \'' . $uniqueStringInTableConfiguration . '\'); ?>';
         file_put_contents($packagePath . 'Configuration/TCA/' . $uniqueTableName . '.php', $tableConfiguration);
         $mockCache = $this->getMockBuilder(PhpFrontend::class)
@@ -1513,7 +1514,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
             ->getMock();
         $mockCacheManager->expects(self::never())->method('getCache');
         ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
-        $packageManager = $this->createMockPackageManagerWithMockPackage($this->getUniqueId());
+        $packageManager = $this->createMockPackageManagerWithMockPackage(StringUtility::getUniqueId());
         ExtensionManagementUtility::setPackageManager($packageManager);
         ExtensionManagementUtility::loadExtLocalconf(false);
     }
@@ -1550,11 +1551,11 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function createExtTablesCacheEntryWritesCacheEntryWithContentOfLoadedExtensionExtTables()
     {
-        $extensionName = $this->getUniqueId('foo');
+        $extensionName = StringUtility::getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         $extensionPath = $packageManager->getPackage($extensionName)->getPackagePath();
         $extTablesLocation = $extensionPath . 'ext_tables.php';
-        $uniqueStringInTables = $this->getUniqueId('foo');
+        $uniqueStringInTables = StringUtility::getUniqueId('foo');
         file_put_contents($extTablesLocation, "<?php\n\n$uniqueStringInTables\n\n?>");
         ExtensionManagementUtility::setPackageManager($packageManager);
         $mockCache = $this->getMockBuilder(PhpFrontend::class)
@@ -1577,7 +1578,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function createExtTablesCacheEntryWritesCacheEntryWithExtensionContentOnlyIfExtTablesExists()
     {
-        $extensionName = $this->getUniqueId('foo');
+        $extensionName = StringUtility::getUniqueId('foo');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionName);
         ExtensionManagementUtility::setPackageManager($packageManager);
         $mockCache = $this->getMockBuilder(PhpFrontend::class)
@@ -1614,7 +1615,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
         $mockCacheManager->expects(self::any())->method('getCache')->willReturn($mockCache);
         ExtensionManagementUtilityAccessibleProxy::setCacheManager($mockCacheManager);
         $mockCache->expects(self::once())->method('set')->with(self::anything(), self::anything(), self::equalTo([]));
-        $packageManager = $this->createMockPackageManagerWithMockPackage($this->getUniqueId());
+        $packageManager = $this->createMockPackageManagerWithMockPackage(StringUtility::getUniqueId());
         ExtensionManagementUtility::setPackageManager($packageManager);
         ExtensionManagementUtilityAccessibleProxy::createExtTablesCacheEntry();
     }
@@ -1671,7 +1672,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function getExtensionVersionForNotLoadedExtensionReturnsEmptyString()
     {
-        $uniqueSuffix = $this->getUniqueId('test');
+        $uniqueSuffix = StringUtility::getUniqueId('test');
         $extensionKey = 'unloadedextension' . $uniqueSuffix;
         self::assertEquals('', ExtensionManagementUtility::getExtensionVersion($extensionKey));
     }
@@ -1681,7 +1682,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function getExtensionVersionForLoadedExtensionReturnsExtensionVersion()
     {
-        $uniqueSuffix = $this->getUniqueId('test');
+        $uniqueSuffix = StringUtility::getUniqueId('test');
         $extensionKey = 'unloadedextension' . $uniqueSuffix;
         $packageMetaData = $this->getMockBuilder(MetaData::class)
             ->setMethods(['getVersion'])
@@ -1709,7 +1710,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1342345486);
 
-        $extensionKey = $this->getUniqueId('test');
+        $extensionKey = StringUtility::getUniqueId('test');
         $packageManager = $this->createMockPackageManagerWithMockPackage($extensionKey);
         ExtensionManagementUtility::setPackageManager($packageManager);
         ExtensionManagementUtility::loadExtension($extensionKey);
@@ -1726,7 +1727,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
         $this->expectException(\RuntimeException::class);
         $this->expectExceptionCode(1342345487);
 
-        $packageName = $this->getUniqueId('foo');
+        $packageName = StringUtility::getUniqueId('foo');
         /** @var PackageManager|\PHPUnit\Framework\MockObject\MockObject $packageManager */
         $packageManager = $this->getMockBuilder(PackageManager::class)
             ->setMethods(['isPackageActive'])
@@ -1745,7 +1746,7 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function unloadExtensionCallsPackageManagerToDeactivatePackage()
     {
-        $packageName = $this->getUniqueId('foo');
+        $packageName = StringUtility::getUniqueId('foo');
         /** @var PackageManager|\PHPUnit\Framework\MockObject\MockObject $packageManager */
         $packageManager = $this->getMockBuilder(PackageManager::class)
             ->setMethods(['isPackageActive', 'deactivatePackage'])
@@ -1769,8 +1770,8 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function doesMakeCategorizableCallsTheCategoryRegistryWithDefaultFieldName()
     {
-        $extensionKey = $this->getUniqueId('extension');
-        $tableName = $this->getUniqueId('table');
+        $extensionKey = StringUtility::getUniqueId('extension');
+        $tableName = StringUtility::getUniqueId('table');
 
         /** @var CategoryRegistry|\PHPUnit\Framework\MockObject\MockObject $registryMock */
         $registryMock = $this->getMockBuilder(CategoryRegistry::class)->getMock();
@@ -1784,9 +1785,9 @@ class ExtensionManagementUtilityTest extends UnitTestCase
      */
     public function doesMakeCategorizableCallsTheCategoryRegistryWithFieldName()
     {
-        $extensionKey = $this->getUniqueId('extension');
-        $tableName = $this->getUniqueId('table');
-        $fieldName = $this->getUniqueId('field');
+        $extensionKey = StringUtility::getUniqueId('extension');
+        $tableName = StringUtility::getUniqueId('table');
+        $fieldName = StringUtility::getUniqueId('field');
 
         /** @var CategoryRegistry|\PHPUnit\Framework\MockObject\MockObject $registryMock */
         $registryMock = $this->getMockBuilder(CategoryRegistry::class)->getMock();
index 57c43a1..ce0de6f 100644 (file)
@@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\ReplacementClassFixture;
 use TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\TwoParametersConstructorFixture;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -112,7 +113,7 @@ class GeneralUtilityTest extends UnitTestCase
     protected function getVirtualTestDir($prefix = 'root_')
     {
         $root = vfsStream::setup();
-        $path = $root->url() . '/typo3temp/var/tests/' . $this->getUniqueId($prefix);
+        $path = $root->url() . '/typo3temp/var/tests/' . StringUtility::getUniqueId($prefix);
         GeneralUtility::mkdir_deep($path);
         return $path;
     }
@@ -2114,7 +2115,7 @@ class GeneralUtilityTest extends UnitTestCase
     public function unlink_tempfileRemovesValidFileInTypo3temp()
     {
         $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
-        $testFilename = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_') . '.gif';
+        $testFilename = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_') . '.gif';
         @copy($fixtureFile, $testFilename);
         GeneralUtility::unlink_tempfile($testFilename);
         $fileExists = file_exists($testFilename);
@@ -2127,7 +2128,7 @@ class GeneralUtilityTest extends UnitTestCase
     public function unlink_tempfileRemovesHiddenFile()
     {
         $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
-        $testFilename = Environment::getVarPath() . '/tests/' . $this->getUniqueId('.test_') . '.gif';
+        $testFilename = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('.test_') . '.gif';
         @copy($fixtureFile, $testFilename);
         GeneralUtility::unlink_tempfile($testFilename);
         $fileExists = file_exists($testFilename);
@@ -2140,7 +2141,7 @@ class GeneralUtilityTest extends UnitTestCase
     public function unlink_tempfileReturnsTrueIfFileWasRemoved()
     {
         $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
-        $testFilename = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_') . '.gif';
+        $testFilename = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_') . '.gif';
         @copy($fixtureFile, $testFilename);
         $returnValue = GeneralUtility::unlink_tempfile($testFilename);
         self::assertTrue($returnValue);
@@ -2151,7 +2152,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function unlink_tempfileReturnsNullIfFileDoesNotExist()
     {
-        $returnValue = GeneralUtility::unlink_tempfile(Environment::getVarPath() . '/tests/' . $this->getUniqueId('i_do_not_exist'));
+        $returnValue = GeneralUtility::unlink_tempfile(Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('i_do_not_exist'));
         self::assertNull($returnValue);
     }
 
@@ -2410,7 +2411,7 @@ class GeneralUtilityTest extends UnitTestCase
     public function minifyJavaScriptReturnsInputStringIfNoHookIsRegistered()
     {
         unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript']);
-        $testString = $this->getUniqueId('string');
+        $testString = StringUtility::getUniqueId('string');
         self::assertSame($testString, GeneralUtility::minifyJavaScript($testString));
     }
 
@@ -2427,7 +2428,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test file
-        $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $filename = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
         $currentGroupId = posix_getegid();
         // Set target group and run method
@@ -2446,7 +2447,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test file
-        $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $filename = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
         chmod($filename, 482);
         // Set target permissions and run method
@@ -2466,7 +2467,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test file
-        $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $filename = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
         chmod($filename, 482);
         // Set target permissions and run method
@@ -2486,7 +2487,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test directory
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::mkdir($directory);
         chmod($directory, 1551);
         // Set target permissions and run method
@@ -2506,7 +2507,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test directory
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::mkdir($directory);
         chmod($directory, 1551);
         // Set target permissions and run method
@@ -2527,7 +2528,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test directory
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::mkdir($directory);
         chmod($directory, 1551);
         // Set target permissions and run method
@@ -2548,7 +2549,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test directory and file structure
-        $baseDirectory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $baseDirectory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::mkdir($baseDirectory);
         chmod($baseDirectory, 1751);
         GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($baseDirectory . '/file', '42');
@@ -2599,7 +2600,7 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         // Create and prepare test file
-        $filename = Environment::getVarPath() . '/tests/../../../typo3temp/var/tests/' . $this->getUniqueId('test_');
+        $filename = Environment::getVarPath() . '/tests/../../../typo3temp/var/tests/' . StringUtility::getUniqueId('test_');
         // Set target permissions and run method
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
         $fixPermissionsResult = GeneralUtility::fixPermissions($filename);
@@ -2614,7 +2615,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $filename = 'typo3temp/var/tests/' . $this->getUniqueId('test_');
+        $filename = 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_');
         GeneralUtility::writeFileToTypo3tempDir(Environment::getPublicPath() . '/' . $filename, '42');
         $this->testFilesToDelete[] = Environment::getPublicPath() . '/' . $filename;
         chmod(Environment::getPublicPath() . '/' . $filename, 482);
@@ -2634,7 +2635,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $filename = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $filename = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($filename, '42');
         chmod($filename, 482);
         unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask']);
@@ -2652,7 +2653,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtilityFilesystemFixture::mkdir($directory);
         chmod($directory, 1551);
         unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']);
@@ -2670,7 +2671,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function mkdirCreatesDirectory()
     {
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
         clearstatcache();
         self::assertTrue($mkdirResult);
@@ -2682,7 +2683,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function mkdirCreatesHiddenDirectory()
     {
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('.test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('.test_');
         $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
         clearstatcache();
         self::assertTrue($mkdirResult);
@@ -2694,7 +2695,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function mkdirCreatesDirectoryWithTrailingSlash()
     {
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_') . '/';
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_') . '/';
         $mkdirResult = GeneralUtilityFilesystemFixture::mkdir($directory);
         clearstatcache();
         self::assertTrue($mkdirResult);
@@ -2709,7 +2710,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         $oldUmask = umask(19);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0772';
         GeneralUtilityFilesystemFixture::mkdir($directory);
@@ -2727,7 +2728,7 @@ class GeneralUtilityTest extends UnitTestCase
         $swapGroup = $this->checkGroups(__FUNCTION__);
         if ($swapGroup !== false) {
             $GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
-            $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('mkdirtest_');
+            $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('mkdirtest_');
             GeneralUtilityFilesystemFixture::mkdir($directory);
             clearstatcache();
             $resultDirectoryGroup = filegroup($directory);
@@ -2862,7 +2863,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function mkdirDeepCreatesDirectory()
     {
-        $directory = $this->getVirtualTestDir() . '/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId('test_');
         GeneralUtility::mkdir_deep($directory);
         self::assertTrue(is_dir($directory));
     }
@@ -2872,7 +2873,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function mkdirDeepCreatesSubdirectoriesRecursive()
     {
-        $directory = $this->getVirtualTestDir() . 'typo3temp/var/tests/' . $this->getUniqueId('test_');
+        $directory = $this->getVirtualTestDir() . 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_');
         $subDirectory = $directory . '/foo';
         GeneralUtility::mkdir_deep($subDirectory);
         self::assertTrue(is_dir($subDirectory));
@@ -2909,7 +2910,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $directory = $this->getUniqueId('mkdirdeeptest_');
+        $directory = StringUtility::getUniqueId('mkdirdeeptest_');
         $oldUmask = umask(19);
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0777';
         GeneralUtility::mkdir_deep(Environment::getVarPath() . '/tests/' . $directory);
@@ -2927,7 +2928,7 @@ class GeneralUtilityTest extends UnitTestCase
         if (Environment::isWindows()) {
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
-        $directory = $this->getUniqueId('mkdirdeeptest_');
+        $directory = StringUtility::getUniqueId('mkdirdeeptest_');
         $subDirectory = $directory . '/bar';
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0777';
         $oldUmask = umask(19);
@@ -2947,8 +2948,8 @@ class GeneralUtilityTest extends UnitTestCase
             self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
         }
         $baseDirectory = Environment::getVarPath() . '/tests/';
-        $existingDirectory = $this->getUniqueId('test_existing_') . '/';
-        $newSubDirectory = $this->getUniqueId('test_new_');
+        $existingDirectory = StringUtility::getUniqueId('test_existing_') . '/';
+        $newSubDirectory = StringUtility::getUniqueId('test_new_');
         @mkdir($baseDirectory . $existingDirectory);
         $this->testFilesToDelete[] = $baseDirectory . $existingDirectory;
         chmod($baseDirectory . $existingDirectory, 482);
@@ -2964,7 +2965,7 @@ class GeneralUtilityTest extends UnitTestCase
         $swapGroup = $this->checkGroups(__FUNCTION__);
         if ($swapGroup !== false) {
             $GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
-            $directory = $this->getUniqueId('mkdirdeeptest_');
+            $directory = StringUtility::getUniqueId('mkdirdeeptest_');
             GeneralUtility::mkdir_deep(Environment::getVarPath() . '/tests/' . $directory);
             $this->testFilesToDelete[] = Environment::getVarPath() . '/tests/' . $directory;
             clearstatcache();
@@ -2981,7 +2982,7 @@ class GeneralUtilityTest extends UnitTestCase
         $swapGroup = $this->checkGroups(__FUNCTION__);
         if ($swapGroup !== false) {
             $GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
-            $directory = $this->getUniqueId('mkdirdeeptest_');
+            $directory = StringUtility::getUniqueId('mkdirdeeptest_');
             $subDirectory = $directory . '/bar';
             GeneralUtility::mkdir_deep(Environment::getVarPath() . '/tests/' . $subDirectory);
             $this->testFilesToDelete[] = Environment::getVarPath() . '/tests/' . $directory;
@@ -2999,7 +3000,7 @@ class GeneralUtilityTest extends UnitTestCase
         $swapGroup = $this->checkGroups(__FUNCTION__);
         if ($swapGroup !== false) {
             $GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
-            $directory = $this->getUniqueId('mkdirdeeptest_');
+            $directory = StringUtility::getUniqueId('mkdirdeeptest_');
             $subDirectory = $directory . '/bar';
             GeneralUtility::mkdir_deep(Environment::getVarPath() . '/tests/' . $subDirectory);
             $this->testFilesToDelete[] = Environment::getVarPath() . '/tests/' . $directory;
@@ -3015,7 +3016,7 @@ class GeneralUtilityTest extends UnitTestCase
     public function mkdirDeepCreatesDirectoryInVfsStream()
     {
         vfsStreamWrapper::register();
-        $baseDirectory = $this->getUniqueId('test_');
+        $baseDirectory = StringUtility::getUniqueId('test_');
         vfsStreamWrapper::setRoot(new vfsStreamDirectory($baseDirectory));
         GeneralUtility::mkdir_deep('vfs://' . $baseDirectory . '/sub');
         self::assertTrue(is_dir('vfs://' . $baseDirectory . '/sub'));
@@ -3052,7 +3053,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesFile()
     {
-        $file = Environment::getVarPath() . '/tests/' . $this->getUniqueId('file_');
+        $file = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('file_');
         touch($file);
         GeneralUtility::rmdir($file);
         self::assertFalse(file_exists($file));
@@ -3063,7 +3064,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirReturnTrueIfFileWasRemoved()
     {
-        $file = Environment::getVarPath() . '/tests/' . $this->getUniqueId('file_');
+        $file = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('file_');
         touch($file);
         self::assertTrue(GeneralUtility::rmdir($file));
     }
@@ -3073,7 +3074,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirReturnFalseIfNoFileWasRemoved()
     {
-        $file = Environment::getVarPath() . '/tests/' . $this->getUniqueId('file_');
+        $file = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('file_');
         self::assertFalse(GeneralUtility::rmdir($file));
     }
 
@@ -3082,7 +3083,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesDirectory()
     {
-        $directory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('directory_');
+        $directory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('directory_');
         mkdir($directory);
         GeneralUtility::rmdir($directory);
         self::assertFalse(file_exists($directory));
@@ -3093,7 +3094,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesDirectoryWithTrailingSlash()
     {
-        $directory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('directory_') . '/';
+        $directory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('directory_') . '/';
         mkdir($directory);
         GeneralUtility::rmdir($directory);
         self::assertFalse(file_exists($directory));
@@ -3104,9 +3105,9 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff()
     {
-        $directory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('directory_') . '/';
+        $directory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('directory_') . '/';
         mkdir($directory);
-        $file = $this->getUniqueId('file_');
+        $file = StringUtility::getUniqueId('file_');
         touch($directory . $file);
         $this->testFilesToDelete[] = $directory;
         $return = GeneralUtility::rmdir($directory);
@@ -3120,7 +3121,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesDirectoriesRecursiveAndReturnsTrue()
     {
-        $directory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('directory_') . '/';
+        $directory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('directory_') . '/';
         mkdir($directory);
         mkdir($directory . 'sub/');
         touch($directory . 'sub/file');
@@ -3134,10 +3135,10 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesLinkToDirectory()
     {
-        $existingDirectory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('notExists_') . '/';
+        $existingDirectory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('notExists_') . '/';
         mkdir($existingDirectory);
         $this->testFilesToDelete[] = $existingDirectory;
-        $symlinkName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
+        $symlinkName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
         symlink($existingDirectory, $symlinkName);
         GeneralUtility::rmdir($symlinkName, true);
         self::assertFalse(is_link($symlinkName));
@@ -3148,8 +3149,8 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesDeadLinkToDirectory()
     {
-        $notExistingDirectory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('notExists_') . '/';
-        $symlinkName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
+        $notExistingDirectory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('notExists_') . '/';
+        $symlinkName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
         mkdir($notExistingDirectory);
         symlink($notExistingDirectory, $symlinkName);
         rmdir($notExistingDirectory);
@@ -3163,8 +3164,8 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function rmdirRemovesDeadLinkToFile()
     {
-        $notExistingFile = Environment::getVarPath() . '/tests/' . $this->getUniqueId('notExists_');
-        $symlinkName = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
+        $notExistingFile = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('notExists_');
+        $symlinkName = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
         touch($notExistingFile);
         symlink($notExistingFile, $symlinkName);
         unlink($notExistingFile);
@@ -3390,7 +3391,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function splitFileRefReturnsFileTypeNotForFolders()
     {
-        $directoryName = $this->getUniqueId('test_') . '.com';
+        $directoryName = StringUtility::getUniqueId('test_') . '.com';
         $directoryPath = Environment::getVarPath() . '/tests/';
         $directory = $directoryPath . $directoryName;
         mkdir($directory, octdec($GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']));
@@ -4126,12 +4127,12 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths()
     {
-        $sourceDirectory = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '/';
+        $sourceDirectory = 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_') . '/';
         $absoluteSourceDirectory = Environment::getPublicPath() . '/' . $sourceDirectory;
         $this->testFilesToDelete[] = $absoluteSourceDirectory;
         GeneralUtility::mkdir($absoluteSourceDirectory);
 
-        $targetDirectory = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '/';
+        $targetDirectory = 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_') . '/';
         $absoluteTargetDirectory = Environment::getPublicPath() . '/' . $targetDirectory;
         $this->testFilesToDelete[] = $absoluteTargetDirectory;
 
@@ -4150,12 +4151,12 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths()
     {
-        $sourceDirectory = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '/';
+        $sourceDirectory = 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_') . '/';
         $absoluteSourceDirectory = Environment::getPublicPath() . '/' . $sourceDirectory;
         $this->testFilesToDelete[] = $absoluteSourceDirectory;
         GeneralUtility::mkdir($absoluteSourceDirectory);
 
-        $targetDirectory = 'typo3temp/var/tests/' . $this->getUniqueId('test_') . '/';
+        $targetDirectory = 'typo3temp/var/tests/' . StringUtility::getUniqueId('test_') . '/';
         $absoluteTargetDirectory = Environment::getPublicPath() . '/' . $targetDirectory;
         $this->testFilesToDelete[] = $absoluteTargetDirectory;
 
@@ -4271,7 +4272,7 @@ class GeneralUtilityTest extends UnitTestCase
      */
     public function getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys()
     {
-        $directory = Environment::getVarPath() . '/tests/' . $this->getUniqueId('directory_');
+        $directory = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('directory_');
         mkdir($directory);
         $filesAndDirectories = GeneralUtility::getAllFilesAndFoldersInPath([], $directory, '', true);
         $check = true;
index 4253e87..07ba2cc 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Localization\LanguageStore;
 use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -50,7 +51,7 @@ class LocalizationFactoryTest extends UnitTestCase
 
         $subject = new LocalizationFactory;
 
-        $unique = 'locallangXMLOverrideTest' . substr($this->getUniqueId(), 0, 10);
+        $unique = 'locallangXMLOverrideTest' . substr(StringUtility::getUniqueId(), 0, 10);
         $xml = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
                        <T3locallang>
                                <data type="array">
index 2cc5d7b..efded8e 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\View;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
 use TYPO3\CMS\Extbase\Mvc\View\JsonView;
 use TYPO3\CMS\Extbase\Mvc\Web\Response;
@@ -256,7 +257,7 @@ class JsonViewTest extends UnitTestCase
      */
     public function exposeClassNameSettingsAndResults(): array
     {
-        $className = $this->getUniqueId('DummyClass');
+        $className = StringUtility::getUniqueId('DummyClass');
         $namespace = 'TYPO3\CMS\Extbase\Tests\Unit\Mvc\View\\' . $className;
         return [
             [
index ad7af13..0b83165 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Persistence\Generic;
 
 use PHPUnit\Framework\MockObject\MockObject;
 use Prophecy\Argument;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
 use TYPO3\CMS\Extbase\Object\Container\Container;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
@@ -322,7 +323,7 @@ class PersistenceManagerTest extends UnitTestCase
      */
     public function updateSchedulesAnObjectForPersistence(): void
     {
-        $className = $this->getUniqueId('BazFixture');
+        $className = StringUtility::getUniqueId('BazFixture');
         eval('
                        namespace ' . __NAMESPACE__ . '\\Domain\\Model;
                        class ' . $className . ' extends \\' . AbstractEntity::class . ' {
@@ -424,7 +425,7 @@ class PersistenceManagerTest extends UnitTestCase
      */
     public function persistAllAddsNamespacedReconstitutedObjectFromSessionToBackendsAggregateRootObjects(): void
     {
-        $className = $this->getUniqueId('BazFixture');
+        $className = StringUtility::getUniqueId('BazFixture');
         eval('
                        namespace ' . __NAMESPACE__ . '\\Domain\\Model;
                        class ' . $className . ' extends \\' . AbstractEntity::class . ' {}
index c5449fe..aa2c1e5 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression;
 use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\Persistence\Generic\Exception\InconsistentQuerySettingsException;
 use TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnsupportedOrderException;
 use TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface;
@@ -344,7 +345,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForDefaultLanguage()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid'
         ];
@@ -363,7 +364,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForNonDefaultLanguage()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid'
         ];
@@ -385,7 +386,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksInBackendContextWithNoGlobalTypoScriptFrontendControllerAvailable()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid'
         ];
@@ -403,7 +404,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForDefaultLanguageWithoutDeleteStatementReturned()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid',
             'delete' => 'deleted'
@@ -423,7 +424,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForForeignLanguageWithoutSubselection()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid'
         ];
@@ -442,7 +443,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForForeignLanguageWithSubselectionWithoutDeleteStatementReturned()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent'
@@ -465,7 +466,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function addGetLanguageStatementWorksForForeignLanguageWithSubselectionTakesDeleteStatementIntoAccountIfNecessary()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         $GLOBALS['TCA'][$table]['ctrl'] = [
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent',
@@ -761,7 +762,7 @@ class Typo3DbQueryParserTest extends UnitTestCase
      */
     public function providerForAddPageIdStatementData()
     {
-        $table = $this->getUniqueId('tx_coretest_table');
+        $table = StringUtility::getUniqueId('tx_coretest_table');
         return [
             'set Pid to zero if rootLevel = 1' => [
                 '1',
index 5036dc9..0712fa2 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -81,7 +82,7 @@ class AbstractControllerTest extends UnitTestCase
     {
         $flashMessageQueue = $this->getMockBuilder(\TYPO3\CMS\Core\Messaging\FlashMessageQueue::class)
             ->setMethods(['enqueue'])
-            ->setConstructorArgs([$this->getUniqueId('identifier_')])
+            ->setConstructorArgs([StringUtility::getUniqueId('identifier_')])
             ->getMock();
 
         $flashMessageQueue->expects(self::once())->method('enqueue')->with(self::equalTo($expectedMessage));
index 084a871..3d6b6c2 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Extensionmanager\Tests\Unit\Utility;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Localization\LanguageService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
 use TYPO3\CMS\Extensionmanager\Utility\EmConfUtility;
 use TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility;
@@ -41,7 +42,7 @@ class FileHandlingUtilityTest extends UnitTestCase
      */
     protected function createFakeExtension($extkeyOnly = false)
     {
-        $extKey = strtolower($this->getUniqueId('testing'));
+        $extKey = strtolower(StringUtility::getUniqueId('testing'));
         $absExtPath = Environment::getVarPath() . '/tests/ext-' . $extKey . '/';
         $relPath = 'typo3temp/var/tests/ext-' . $extKey . '/';
         $this->fakedExtensions[$extKey] = [
@@ -155,7 +156,7 @@ class FileHandlingUtilityTest extends UnitTestCase
      */
     public function addDirectoryAddsDirectory()
     {
-        $extDirPath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test-extensions-');
+        $extDirPath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test-extensions-');
         $this->testFilesToDelete[] = $extDirPath;
         $fileHandlerMock = $this->getAccessibleMock(FileHandlingUtility::class, ['dummy']);
         $fileHandlerMock->_call('addDirectory', $extDirPath);
@@ -167,7 +168,7 @@ class FileHandlingUtilityTest extends UnitTestCase
      */
     public function removeDirectoryRemovesDirectory()
     {
-        $extDirPath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test-extensions-');
+        $extDirPath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test-extensions-');
         @mkdir($extDirPath);
         $fileHandlerMock = $this->getAccessibleMock(FileHandlingUtility::class, ['dummy']);
         $fileHandlerMock->_call('removeDirectory', $extDirPath);
@@ -179,8 +180,8 @@ class FileHandlingUtilityTest extends UnitTestCase
      */
     public function removeDirectoryRemovesSymlink()
     {
-        $absoluteSymlinkPath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_symlink_');
-        $absoluteFilePath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_file_');
+        $absoluteSymlinkPath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_symlink_');
+        $absoluteFilePath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_file_');
         touch($absoluteFilePath);
         $this->testFilesToDelete[] = $absoluteFilePath;
         symlink($absoluteFilePath, $absoluteSymlinkPath);
@@ -194,9 +195,9 @@ class FileHandlingUtilityTest extends UnitTestCase
      */
     public function removeDirectoryDoesNotRemoveContentOfSymlinkedTargetDirectory()
     {
-        $absoluteSymlinkPath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_symlink_');
-        $absoluteDirectoryPath = Environment::getVarPath() . '/tests/' . $this->getUniqueId('test_dir_') . '/';
-        $relativeFilePath = $this->getUniqueId('test_file_');
+        $absoluteSymlinkPath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_symlink_');
+        $absoluteDirectoryPath = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('test_dir_') . '/';
+        $relativeFilePath = StringUtility::getUniqueId('test_file_');
 
         mkdir($absoluteDirectoryPath);
         touch($absoluteDirectoryPath . $relativeFilePath);
index 84a4c3c..78d624d 100644 (file)
@@ -22,6 +22,7 @@ use TYPO3\CMS\Core\Cache\Frontend\NullFrontend;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extensionmanager\Utility\DependencyUtility;
 use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
 use TYPO3\CMS\Extensionmanager\Utility\ListUtility;
@@ -125,7 +126,7 @@ class InstallUtilityTest extends UnitTestCase
      */
     protected function createFakeExtension(): string
     {
-        $extKey = strtolower($this->getUniqueId('testing'));
+        $extKey = strtolower(StringUtility::getUniqueId('testing'));
         $absExtPath = Environment::getVarPath() . '/tests/' . $extKey;
         $relativeVarPath = ltrim(str_replace(Environment::getProjectPath(), '', Environment::getVarPath()), '/');
         $relPath = $relativeVarPath . '/tests/' . $extKey . '/';
index f89d970..c723bc7 100644 (file)
@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Routing\PageArguments;
 use TYPO3\CMS\Core\Site\Entity\Site;
 use TYPO3\CMS\Core\TypoScript\TemplateService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
 use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@@ -317,7 +318,7 @@ class ConditionMatcherTest extends FunctionalTestCase
      */
     public function genericGetVariablesSucceedsWithNamespaceENV(): void
     {
-        $testKey = $this->getUniqueId('test');
+        $testKey = StringUtility::getUniqueId('test');
         putenv($testKey . '=testValue');
         self::assertTrue($this->getConditionMatcher()->match('[getenv("' . $testKey . '") == "testValue"]'));
     }
index b34326d..23fd481 100644 (file)
@@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Session\Backend\Exception\SessionNotFoundException;
 use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
 use TYPO3\CMS\Core\Session\SessionManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -50,7 +51,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
      */
     public function userFieldIsNotSetForAnonymousSessions()
     {
-        $uniqueSessionId = $this->getUniqueId('test');
+        $uniqueSessionId = StringUtility::getUniqueId('test');
         $_COOKIE['fe_typo_user'] = $uniqueSessionId;
 
         // This setup fakes the "getAuthInfoArray() db call
@@ -133,7 +134,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
      */
     public function canSetAndUnsetSessionKey()
     {
-        $uniqueSessionId = $this->getUniqueId('test');
+        $uniqueSessionId = StringUtility::getUniqueId('test');
         $_COOKIE['fe_typo_user'] = $uniqueSessionId;
 
         // This setup fakes the "getAuthInfoArray() db call
@@ -182,7 +183,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
      */
     public function canSetSessionDataForAnonymousUser()
     {
-        $uniqueSessionId = $this->getUniqueId('test');
+        $uniqueSessionId = StringUtility::getUniqueId('test');
         $_COOKIE['fe_typo_user'] = $uniqueSessionId;
         $GLOBALS['TYPO3_CONF_VARS']['FE']['lockIP'] = 0;
         $currentTime = $GLOBALS['EXEC_TIME'];
@@ -250,7 +251,7 @@ class FrontendUserAuthenticationTest extends UnitTestCase
      */
     public function canLoadExistingAuthenticatedSession()
     {
-        $uniqueSessionId = $this->getUniqueId('test');
+        $uniqueSessionId = StringUtility::getUniqueId('test');
         $_COOKIE['fe_typo_user'] = $uniqueSessionId;
         $currentTime = $GLOBALS['EXEC_TIME'];
 
index bc4ad66..e8b6665 100644 (file)
@@ -44,6 +44,7 @@ use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\TypoScript\TemplateService;
 use TYPO3\CMS\Core\Utility\DebugUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
 use TYPO3\CMS\Frontend\ContentObject\AbstractContentObject;
 use TYPO3\CMS\Frontend\ContentObject\CaseContentObject;
@@ -223,7 +224,7 @@ class ContentObjectRendererTest extends UnitTestCase
         $resourceFactory = $this->createMock(ResourceFactory::class);
         $this->subject->expects(self::any())->method('getResourceFactory')->willReturn($resourceFactory);
 
-        $className = $this->getUniqueId('tx_coretest');
+        $className = StringUtility::getUniqueId('tx_coretest');
         $getImgResourceHookMock = $this->getMockBuilder(ContentObjectGetImageResourceHookInterface::class)
             ->setMethods(['getImgResourcePostProcess'])
             ->setMockClassName($className)
@@ -1354,8 +1355,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeGetenv(): void
     {
-        $envName = $this->getUniqueId('frontendtest');
-        $value = $this->getUniqueId('someValue');
+        $envName = StringUtility::getUniqueId('frontendtest');
+        $value = StringUtility::getUniqueId('someValue');
         putenv($envName . '=' . $value);
         self::assertEquals($value, $this->subject->getData('getenv:' . $envName));
     }
@@ -1408,7 +1409,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeFileReturnsUidOfFileObject(): void
     {
-        $uid = $this->getUniqueId();
+        $uid = StringUtility::getUniqueId();
         $file = $this->createMock(File::class);
         $file->expects(self::once())->method('getUid')->willReturn($uid);
         $this->subject->setCurrentFile($file);
@@ -1422,8 +1423,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeParameters(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $this->subject->parameters[$key] = $value;
 
         self::assertEquals($value, $this->subject->getData('parameters:' . $key));
@@ -1436,8 +1437,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeRegister(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $GLOBALS['TSFE']->register[$key] = $value;
 
         self::assertEquals($value, $this->subject->getData('register:' . $key));
@@ -1619,8 +1620,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeCurrent(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $this->subject->data[$key] = $value;
         $this->subject->currentValKey = $key;
         self::assertEquals($value, $this->subject->getData('current'));
@@ -1649,8 +1650,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeLll(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $GLOBALS['TSFE']->expects(self::once())->method('sL')->with('LLL:' . $key)->willReturn($value);
         self::assertEquals($value, $this->subject->getData('lll:' . $key));
     }
@@ -1814,8 +1815,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeDebugData(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $this->subject->data = [$key => $value];
 
         $expectedResult = 'array(1item)' . $key . '=>"' . $value . '"(' . strlen($value) . 'chars)';
@@ -1834,8 +1835,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getDataWithTypeDebugRegister(): void
     {
-        $key = $this->getUniqueId('someKey');
-        $value = $this->getUniqueId('someValue');
+        $key = StringUtility::getUniqueId('someKey');
+        $value = StringUtility::getUniqueId('someValue');
         $GLOBALS['TSFE']->register = [$key => $value];
 
         $expectedResult = 'array(1item)' . $key . '=>"' . $value . '"(' . strlen($value) . 'chars)';
@@ -2270,7 +2271,7 @@ class ContentObjectRendererTest extends UnitTestCase
         $resourceFactory = $this->createMock(ResourceFactory::class);
         $this->subject->expects(self::any())->method('getResourceFactory')->willReturn($resourceFactory);
 
-        $className = $this->getUniqueId('tx_coretest_getImageSourceCollectionHookCalled');
+        $className = StringUtility::getUniqueId('tx_coretest_getImageSourceCollectionHookCalled');
         $getImageSourceCollectionHookMock = $this->getMockBuilder(
             ContentObjectOneSourceCollectionHookInterface::class
         )
@@ -2303,7 +2304,7 @@ class ContentObjectRendererTest extends UnitTestCase
             ],
         ];
 
-        $result = $this->subject->getImageSourceCollection('data', $configuration, $this->getUniqueId('testImage-'));
+        $result = $this->subject->getImageSourceCollection('data', $configuration, StringUtility::getUniqueId('testImage-'));
 
         self::assertSame($result, 'isGetOneSourceCollectionCalledCallback');
     }
@@ -3324,12 +3325,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function calculateCacheKeyDataProvider(): array
     {
-        $value = $this->getUniqueId('value');
-        $wrap = [$this->getUniqueId('wrap')];
+        $value = StringUtility::getUniqueId('value');
+        $wrap = [StringUtility::getUniqueId('wrap')];
         $valueConf = ['key' => $value];
         $wrapConf = ['key.' => $wrap];
         $conf = array_merge($valueConf, $wrapConf);
-        $will = $this->getUniqueId('stdWrap');
+        $will = StringUtility::getUniqueId('stdWrap');
 
         return [
             'no conf' => [
@@ -3401,7 +3402,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function getFromCacheDtataProvider(): array
     {
-        $conf = [$this->getUniqueId('conf')];
+        $conf = [StringUtility::getUniqueId('conf')];
         return [
             'empty cache key' => [
                 false,
@@ -3597,7 +3598,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function HTMLcaseshiftDataProvider(): array
     {
-        $case = $this->getUniqueId('case');
+        $case = StringUtility::getUniqueId('case');
         return [
             'simple text' => [
                 'TEXT',
@@ -3805,10 +3806,10 @@ class ContentObjectRendererTest extends UnitTestCase
         string $stdWrapMethod,
         string $hookObjectCall
     ): void {
-        $conf = [$this->getUniqueId('conf')];
-        $content = $this->getUniqueId('content');
-        $processed1 = $this->getUniqueId('processed1');
-        $processed2 = $this->getUniqueId('processed2');
+        $conf = [StringUtility::getUniqueId('conf')];
+        $content = StringUtility::getUniqueId('content');
+        $processed1 = StringUtility::getUniqueId('processed1');
+        $processed2 = StringUtility::getUniqueId('processed2');
         $hookObject1 = $this->createMock(
             ContentObjectStdWrapHookInterface::class
         );
@@ -3838,8 +3839,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_HTMLparserDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
-        $parsed = $this->getUniqueId('parsed');
+        $content = StringUtility::getUniqueId('content');
+        $parsed = StringUtility::getUniqueId('parsed');
         return [
             'no config' => [
                 $content,
@@ -3966,8 +3967,8 @@ class ContentObjectRendererTest extends UnitTestCase
     {
         $now = 10;
         $content = '9';
-        $conf = ['age' => $this->getUniqueId('age')];
-        $return = $this->getUniqueId('return');
+        $conf = ['age' => StringUtility::getUniqueId('age')];
+        $return = StringUtility::getUniqueId('return');
         $difference = $now - (int)$content;
         $GLOBALS['EXEC_TIME'] = $now;
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
@@ -3996,12 +3997,12 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_append(): void
     {
         $debugKey = '/stdWrap/.append';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'append' => $this->getUniqueId('append'),
-            'append.' => [$this->getUniqueId('append.')],
+            'append' => StringUtility::getUniqueId('append'),
+            'append.' => [StringUtility::getUniqueId('append.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cObjGetSingle'])->getMock();
         $subject
@@ -4204,12 +4205,12 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_cObject(): void
     {
         $debugKey = '/stdWrap/.cObject';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'cObject' => $this->getUniqueId('cObject'),
-            'cObject.' => [$this->getUniqueId('cObject.')],
+            'cObject' => StringUtility::getUniqueId('cObject'),
+            'cObject.' => [StringUtility::getUniqueId('cObject.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cObjGetSingle'])->getMock();
         $subject
@@ -4230,8 +4231,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_orderedStdWrapDataProvider(): array
     {
-        $confA = [$this->getUniqueId('conf A')];
-        $confB = [$this->getUniqueId('conf B')];
+        $confA = [StringUtility::getUniqueId('conf A')];
+        $confB = [StringUtility::getUniqueId('conf B')];
         return [
             'standard case: order 1, 2' => [
                 $confA,
@@ -4285,9 +4286,9 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_orderedStdWrap($firstConf, array $secondConf, array $conf): void
     {
-        $content = $this->getUniqueId('content');
-        $between = $this->getUniqueId('between');
-        $expect = $this->getUniqueId('expect');
+        $content = StringUtility::getUniqueId('content');
+        $between = StringUtility::getUniqueId('between');
+        $expect = StringUtility::getUniqueId('expect');
         $conf['orderedStdWrap.'] = $conf;
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['stdWrap'])->getMock();
@@ -4309,7 +4310,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_cacheReadDataProvider(): array
     {
-        $cacheConf = [$this->getUniqueId('cache.')];
+        $cacheConf = [StringUtility::getUniqueId('cache.')];
         $conf = ['cache.' => $cacheConf];
         return [
             'no conf' => [
@@ -4393,8 +4394,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_cacheStoreDataProvider(): array
     {
-        $confCache = [$this->getUniqueId('cache.')];
-        $key = [$this->getUniqueId('key')];
+        $confCache = [StringUtility::getUniqueId('cache.')];
+        $key = [StringUtility::getUniqueId('key')];
         return [
             'Return immediate with no conf' => [
                 null,
@@ -4444,11 +4445,11 @@ class ContentObjectRendererTest extends UnitTestCase
         $key,
         int $times
     ): void {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [];
         $conf['cache.'] = $confCache;
-        $tags = [$this->getUniqueId('tags')];
-        $lifetime = $this->getUniqueId('lifetime');
+        $tags = [StringUtility::getUniqueId('tags')];
+        $lifetime = StringUtility::getUniqueId('lifetime');
         $params = [
             'key' => $key,
             'content' => $content,
@@ -4529,12 +4530,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_case(): void
     {
-        $content = $this->getUniqueId();
+        $content = StringUtility::getUniqueId();
         $conf = [
-            'case' => $this->getUniqueId('used'),
-            'case.' => [$this->getUniqueId('discarded')],
+            'case' => StringUtility::getUniqueId('used'),
+            'case.' => [StringUtility::getUniqueId('discarded')],
         ];
-        $return = $this->getUniqueId();
+        $return = StringUtility::getUniqueId();
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['HTMLcaseshift'])->getMock();
         $subject
@@ -4574,12 +4575,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_crop(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'crop' => $this->getUniqueId('crop'),
-            'crop.' => $this->getUniqueId('not used'),
+            'crop' => StringUtility::getUniqueId('crop'),
+            'crop.' => StringUtility::getUniqueId('not used'),
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['crop'])->getMock();
         $subject
@@ -4607,12 +4608,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_cropHTML(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'cropHTML' => $this->getUniqueId('cropHTML'),
-            'cropHTML.' => $this->getUniqueId('not used'),
+            'cropHTML' => StringUtility::getUniqueId('cropHTML'),
+            'cropHTML.' => StringUtility::getUniqueId('not used'),
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cropHTML'])->getMock();
         $subject
@@ -4724,8 +4725,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_dataDataProvider(): array
     {
-        $data = [$this->getUniqueId('data')];
-        $alt = [$this->getUniqueId('alternativeData')];
+        $data = [StringUtility::getUniqueId('data')];
+        $alt = [StringUtility::getUniqueId('alternativeData')];
         return [
             'default' => [$data, $data, ''],
             'alt is array' => [$alt, $data, $alt],
@@ -4757,8 +4758,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_data(array $expect, array $data, $alt): void
     {
-        $conf = ['data' => $this->getUniqueId('conf.data')];
-        $return = $this->getUniqueId('return');
+        $conf = ['data' => StringUtility::getUniqueId('conf.data')];
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getAccessibleMock(
             ContentObjectRenderer::class,
             ['getData']
@@ -4788,12 +4789,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_dataWrap(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'dataWrap' => $this->getUniqueId('dataWrap'),
-            'dataWrap.' => [$this->getUniqueId('not used')],
+            'dataWrap' => StringUtility::getUniqueId('dataWrap'),
+            'dataWrap.' => [StringUtility::getUniqueId('not used')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['dataWrap'])->getMock();
         $subject
@@ -4908,10 +4909,10 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_debugData(): void
     {
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
-        $content = $this->getUniqueId('content');
-        $key = $this->getUniqueId('key');
-        $value = $this->getUniqueId('value');
-        $altValue = $this->getUniqueId('value alt');
+        $content = StringUtility::getUniqueId('content');
+        $key = StringUtility::getUniqueId('key');
+        $value = StringUtility::getUniqueId('value');
+        $altValue = StringUtility::getUniqueId('value alt');
         $this->subject->data = [$key => $value];
         // Without alternative data only data is returned.
         ob_start();
@@ -4969,7 +4970,7 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_debugFunc(bool $expectArray, $confDebugFunc): void
     {
         $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = ['debugFunc' => $confDebugFunc];
         ob_start();
         $result = $this->subject->stdWrap_debugFunc($content, $conf);
@@ -5065,10 +5066,10 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_editIconsDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
-        $editIcons = $this->getUniqueId('editIcons');
-        $editIconsArray = [$this->getUniqueId('editIcons.')];
-        $will = $this->getUniqueId('will');
+        $content = StringUtility::getUniqueId('content');
+        $editIcons = StringUtility::getUniqueId('editIcons');
+        $editIconsArray = [StringUtility::getUniqueId('editIcons.')];
+        $will = StringUtility::getUniqueId('will');
         return [
             'standard case calls edit icons' => [
                 $will,
@@ -5196,12 +5197,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_encapsLines(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'encapsLines' => [$this->getUniqueId('not used')],
-            'encapsLines.' => [$this->getUniqueId('encapsLines.')],
+            'encapsLines' => [StringUtility::getUniqueId('not used')],
+            'encapsLines.' => [StringUtility::getUniqueId('encapsLines.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['encaps_lineSplit'])->getMock();
         $subject
@@ -5341,8 +5342,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_editPanelDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
-        $will = $this->getUniqueId('will');
+        $content = StringUtility::getUniqueId('content');
+        $will = StringUtility::getUniqueId('will');
         return [
             'standard case calls edit icons' => [
                 $will,
@@ -5396,7 +5397,7 @@ class ContentObjectRendererTest extends UnitTestCase
         } else {
             GeneralUtility::makeInstance(Context::class)->setAspect('backend.user', new UserAspect());
         }
-        $conf = ['editPanel.' => [$this->getUniqueId('editPanel.')]];
+        $conf = ['editPanel.' => [StringUtility::getUniqueId('editPanel.')]];
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['editPanel'])->getMock();
         $subject
@@ -5512,8 +5513,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_field(): void
     {
-        $expect = $this->getUniqueId('expect');
-        $conf = ['field' => $this->getUniqueId('field')];
+        $expect = StringUtility::getUniqueId('expect');
+        $conf = ['field' => StringUtility::getUniqueId('field')];
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['getFieldVal'])->getMock();
         $subject
@@ -5534,7 +5535,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_fieldRequiredDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         return [
             // resulting in boolean false
             'false is false' => [
@@ -5757,8 +5758,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_ifDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
-        $conf = ['if.' => [$this->getUniqueId('if.')]];
+        $content = StringUtility::getUniqueId('content');
+        $conf = ['if.' => [StringUtility::getUniqueId('if.')]];
         return [
             // evals to true
             'empty config' => [
@@ -5873,7 +5874,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_ifBlankDataProvider(): array
     {
-        $alt = $this->getUniqueId('alternative content');
+        $alt = StringUtility::getUniqueId('alternative content');
         $conf = ['ifBlank' => $alt];
         return [
             // blank cases
@@ -5919,7 +5920,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_ifEmptyDataProvider(): array
     {
-        $alt = $this->getUniqueId('alternative content');
+        $alt = StringUtility::getUniqueId('alternative content');
         $conf = ['ifEmpty' => $alt];
         return [
             // empty cases
@@ -5973,7 +5974,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_ifNullDataProvider(): array
     {
-        $alt = $this->getUniqueId('alternative content');
+        $alt = StringUtility::getUniqueId('alternative content');
         $conf = ['ifNull' => $alt];
         return [
             'only null is null' => [$alt, null, $conf],
@@ -6133,9 +6134,9 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_insertData(): void
     {
-        $content = $this->getUniqueId('content');
-        $conf = [$this->getUniqueId('conf not used')];
-        $return = $this->getUniqueId('return');
+        $content = StringUtility::getUniqueId('content');
+        $conf = [StringUtility::getUniqueId('conf not used')];
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['insertData'])->getMock();
         $subject->expects(self::once())->method('insertData')
@@ -6381,14 +6382,14 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_listNum(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'listNum' => $this->getUniqueId('listNum'),
+            'listNum' => StringUtility::getUniqueId('listNum'),
             'listNum.' => [
-                'splitChar' => $this->getUniqueId('splitChar')
+                'splitChar' => StringUtility::getUniqueId('splitChar')
             ],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['listNum'])->getMock();
         $subject
@@ -6506,8 +6507,8 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_numRows(): void
     {
         $conf = [
-            'numRows' => $this->getUniqueId('numRows'),
-            'numRows.' => [$this->getUniqueId('numRows')],
+            'numRows' => StringUtility::getUniqueId('numRows'),
+            'numRows.' => [StringUtility::getUniqueId('numRows')],
         ];
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['numRows'])->getMock();
@@ -6533,12 +6534,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_numberFormat(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'numberFormat' => $this->getUniqueId('not used'),
-            'numberFormat.' => [$this->getUniqueId('numberFormat.')],
+            'numberFormat' => StringUtility::getUniqueId('not used'),
+            'numberFormat.' => [StringUtility::getUniqueId('numberFormat.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['numberFormat'])->getMock();
         $subject
@@ -6711,12 +6712,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_parseFunc(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'parseFunc' => $this->getUniqueId('parseFunc'),
-            'parseFunc.' => [$this->getUniqueId('parseFunc.')],
+            'parseFunc' => StringUtility::getUniqueId('parseFunc'),
+            'parseFunc.' => [StringUtility::getUniqueId('parseFunc.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['parseFunc'])->getMock();
         $subject
@@ -6746,12 +6747,12 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_postCObject(): void
     {
         $debugKey = '/stdWrap/.postCObject';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'postCObject' => $this->getUniqueId('postCObject'),
-            'postCObject.' => [$this->getUniqueId('postCObject.')],
+            'postCObject' => StringUtility::getUniqueId('postCObject'),
+            'postCObject.' => [StringUtility::getUniqueId('postCObject.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cObjGetSingle'])->getMock();
         $subject
@@ -6778,12 +6779,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_postUserFunc(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'postUserFunc' => $this->getUniqueId('postUserFunc'),
-            'postUserFunc.' => [$this->getUniqueId('postUserFunc.')],
+            'postUserFunc' => StringUtility::getUniqueId('postUserFunc'),
+            'postUserFunc.' => [StringUtility::getUniqueId('postUserFunc.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['callUserFunction'])->getMock();
         $subject
@@ -6817,12 +6818,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_postUserFuncInt(): void
     {
-        $uniqueHash = $this->getUniqueId('uniqueHash');
+        $uniqueHash = StringUtility::getUniqueId('uniqueHash');
         $substKey = 'INT_SCRIPT.' . $uniqueHash;
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'postUserFuncInt' => $this->getUniqueId('function'),
-            'postUserFuncInt.' => [$this->getUniqueId('function array')],
+            'postUserFuncInt' => StringUtility::getUniqueId('function'),
+            'postUserFuncInt.' => [StringUtility::getUniqueId('function array')],
         ];
         $expect = '<!--' . $substKey . '-->';
         $frontend = $this->getMockBuilder(TypoScriptFrontendController::class)
@@ -6869,12 +6870,12 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_preCObject(): void
     {
         $debugKey = '/stdWrap/.preCObject';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'preCObject' => $this->getUniqueId('preCObject'),
-            'preCObject.' => [$this->getUniqueId('preCObject.')],
+            'preCObject' => StringUtility::getUniqueId('preCObject'),
+            'preCObject.' => [StringUtility::getUniqueId('preCObject.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cObjGetSingle'])->getMock();
         $subject
@@ -6903,14 +6904,14 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_preIfEmptyListNum(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'preIfEmptyListNum' => $this->getUniqueId('preIfEmptyListNum'),
+            'preIfEmptyListNum' => StringUtility::getUniqueId('preIfEmptyListNum'),
             'preIfEmptyListNum.' => [
-                'splitChar' => $this->getUniqueId('splitChar')
+                'splitChar' => StringUtility::getUniqueId('splitChar')
             ],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['listNum'])->getMock();
         $subject
@@ -6935,10 +6936,10 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_prefixCommentDataProvider(): array
     {
-        $content = $this->getUniqueId('content');
-        $will = $this->getUniqueId('will');
+        $content = StringUtility::getUniqueId('content');
+        $will = StringUtility::getUniqueId('will');
         $conf = [];
-        $conf['prefixComment'] = $this->getUniqueId('prefixComment');
+        $conf['prefixComment'] = StringUtility::getUniqueId('prefixComment');
         $emptyConf1 = [];
         $emptyConf2 = [];
         $emptyConf2['prefixComment'] = '';
@@ -7013,12 +7014,12 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_prepend(): void
     {
         $debugKey = '/stdWrap/.prepend';
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'prepend' => $this->getUniqueId('prepend'),
-            'prepend.' => [$this->getUniqueId('prepend.')],
+            'prepend' => StringUtility::getUniqueId('prepend'),
+            'prepend.' => [StringUtility::getUniqueId('prepend.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['cObjGetSingle'])->getMock();
         $subject
@@ -7089,10 +7090,10 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_preUserFunc(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'preUserFunc' => $this->getUniqueId('preUserFunc'),
-            'preUserFunc.' => [$this->getUniqueId('preUserFunc.')],
+            'preUserFunc' => StringUtility::getUniqueId('preUserFunc'),
+            'preUserFunc.' => [StringUtility::getUniqueId('preUserFunc.')],
         ];
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['callUserFunction'])->getMock();
@@ -7154,12 +7155,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_replacement(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'replacement' => $this->getUniqueId('not used'),
-            'replacement.' => [$this->getUniqueId('replacement.')],
+            'replacement' => StringUtility::getUniqueId('not used'),
+            'replacement.' => [StringUtility::getUniqueId('replacement.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['replacement'])->getMock();
         $subject
@@ -7235,12 +7236,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_round(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'round' => $this->getUniqueId('not used'),
-            'round.' => [$this->getUniqueId('round.')],
+            'round' => StringUtility::getUniqueId('not used'),
+            'round.' => [StringUtility::getUniqueId('round.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['round'])->getMock();
         $subject
@@ -7258,7 +7259,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_setContentToCurrent(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         self::assertNotSame($content, $this->subject->getData('current'));
         self::assertSame(
             $content,
@@ -7339,12 +7340,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_split(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'split' => $this->getUniqueId('not used'),
-            'split.' => [$this->getUniqueId('split.')],
+            'split' => StringUtility::getUniqueId('not used'),
+            'split.' => [StringUtility::getUniqueId('split.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['splitObj'])->getMock();
         $subject
@@ -7371,12 +7372,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_stdWrap(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'stdWrap' => $this->getUniqueId('not used'),
-            'stdWrap.' => [$this->getUniqueId('stdWrap.')],
+            'stdWrap' => StringUtility::getUniqueId('not used'),
+            'stdWrap.' => [StringUtility::getUniqueId('stdWrap.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['stdWrap'])->getMock();
         $subject
@@ -7716,12 +7717,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_substring(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'substring' => $this->getUniqueId('substring'),
-            'substring.' => $this->getUniqueId('not used'),
+            'substring' => StringUtility::getUniqueId('substring'),
+            'substring.' => StringUtility::getUniqueId('not used'),
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['substring'])->getMock();
         $subject
@@ -7812,12 +7813,12 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function stdWrap_typolink(): void
     {
-        $content = $this->getUniqueId('content');
+        $content = StringUtility::getUniqueId('content');
         $conf = [
-            'typolink' => $this->getUniqueId('not used'),
-            'typolink.' => [$this->getUniqueId('typolink.')],
+            'typolink' => StringUtility::getUniqueId('not used'),
+            'typolink.' => [StringUtility::getUniqueId('typolink.')],
         ];
-        $return = $this->getUniqueId('return');
+        $return = StringUtility::getUniqueId('return');
         $subject = $this->getMockBuilder(ContentObjectRenderer::class)
             ->setMethods(['typolink'])->getMock();
         $subject
@@ -8028,8 +8029,8 @@ class ContentObjectRendererTest extends UnitTestCase
     public function stdWrap_wrapAlignDataProvider(): array
     {
         $format = '<div style="text-align:%s;">%s</div>';
-        $content = $this->getUniqueId('content');
-        $wrapAlign = $this->getUniqueId('wrapAlign');
+        $content = StringUtility::getUniqueId('content');
+        $wrapAlign = StringUtility::getUniqueId('wrapAlign');
         $expect = sprintf($format, $wrapAlign, $content);
         return [
             'standard case' => [$expect, $content, $wrapAlign],
@@ -8096,7 +8097,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function linkWrapDataProvider(): array
     {
-        $content = $this->getUniqueId();
+        $content = StringUtility::getUniqueId();
         return [
             'Handles a tag as wrap.' => [
                 '<tag>' . $content . '</tag>',
@@ -8164,8 +8165,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function prefixCommentDataProvider(): array
     {
-        $comment = $this->getUniqueId();
-        $content = $this->getUniqueId();
+        $comment = StringUtility::getUniqueId();
+        $content = StringUtility::getUniqueId();
         $format = '%s';
         $format .= '%%s<!-- %%s [begin] -->%s';
         $format .= '%%s%s%%s%s';
@@ -8261,8 +8262,8 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function setCurrentVal_getCurrentVal(): void
     {
-        $key = $this->getUniqueId();
-        $value = $this->getUniqueId();
+        $key = StringUtility::getUniqueId();
+        $value = StringUtility::getUniqueId();
         $this->subject->currentValKey = $key;
         $this->subject->setCurrentVal($value);
         self::assertEquals($value, $this->subject->getCurrentVal());
@@ -8276,7 +8277,7 @@ class ContentObjectRendererTest extends UnitTestCase
      */
     public function setUserObjectType_getUserObjectType(): void
     {
-        $value = $this->getUniqueId();
+        $value = StringUtility::getUniqueId();
         $this->subject->setUserObjectType($value);
         self::assertEquals($value, $this->subject->getUserObjectType());
     }
index 8466917..ecbaad6 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Frontend\Tests\Unit\ContentObject\Menu;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\ContentObject\Menu\Exception\NoSuchMenuTypeException;
 use TYPO3\CMS\Frontend\ContentObject\Menu\MenuContentObjectFactory;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
@@ -31,7 +32,7 @@ class MenuContentObjectFactoryTest extends UnitTestCase
         $this->expectException(NoSuchMenuTypeException::class);
         $this->expectExceptionCode(1363278130);
         $factory = new MenuContentObjectFactory;
-        $factory->getMenuObjectByType($this->getUniqueId('foo_'));
+        $factory->getMenuObjectByType(StringUtility::getUniqueId('foo_'));
     }
 
     /**
@@ -70,7 +71,7 @@ class MenuContentObjectFactoryTest extends UnitTestCase
     {
         $factory = new MenuContentObjectFactory;
         $selfClassName = static::class;
-        $uniqueMenuType = $this->getUniqueId('foo_');
+        $uniqueMenuType = StringUtility::getUniqueId('foo_');
         $factory->registerMenuType($uniqueMenuType, $selfClassName);
         self::assertInstanceOf($selfClassName, $factory->getMenuObjectByType($uniqueMenuType));
     }
index 10cf36c..654d6d1 100644 (file)
@@ -28,6 +28,7 @@ use TYPO3\CMS\Core\Routing\PageArguments;
 use TYPO3\CMS\Core\Site\Entity\Site;
 use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -125,7 +126,7 @@ class TypoScriptFrontendControllerTest extends UnitTestCase
      */
     public function localizationReturnsUnchangedStringIfNotLocallangLabel()
     {
-        $string = $this->getUniqueId();
+        $string = StringUtility::getUniqueId();
         $this->subject->page = [];
         $this->subject->_call('setOutputLanguage');
         self::assertEquals($string, $this->subject->sL($string));
index a4780de..4d876f2 100644 (file)
@@ -19,6 +19,7 @@ use Prophecy\Argument;
 use TYPO3\CMS\Core\Http\Uri;
 use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\ContentObject\TextContentObject;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
@@ -201,42 +202,42 @@ class AbstractPluginTest extends UnitTestCase
     {
         return [
             'Result browser returning false' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => false,
                 'expected' => ''
             ],
             'Result browser returning null' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => null,
                 'expected' => ''
             ],
             'Result browser returning whitespace string' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => '   ',
                 'expected' => ''
             ],
             'Result browser returning HTML' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => '<div><a href="index.php?id=1&pointer=1">1</a><a href="index.php?id=1&pointer=2">2</a><a href="index.php?id=1&pointer=3">3</a><a href="index.php?id=1&pointer=4">4</a></div>',
                 'expected' => '<div><a href="index.php?id=1&pointer=1">1</a><a href="index.php?id=1&pointer=2">2</a><a href="index.php?id=1&pointer=3">3</a><a href="index.php?id=1&pointer=4">4</a></div>'
             ],
             'Result browser returning a truthy integer as string' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => '1',
                 'expected' => '1'
             ],
             'Result browser returning a falsy integer' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => 0,
                 'expected' => ''
             ],
             'Result browser returning a truthy integer' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => 1,
                 'expected' => ''
             ],
             'Result browser returning a positive integer' => [
-                'className' => $this->getUniqueId('tx_coretest'),
+                'className' => StringUtility::getUniqueId('tx_coretest'),
                 'returnValue' => 42,
                 'expected' => ''
             ]
index dafc801..d4d095c 100644 (file)
@@ -19,6 +19,7 @@ use Psr\Log\LoggerInterface;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder;
@@ -235,9 +236,9 @@ class AbstractTypolinkBuilderTest extends UnitTestCase
      */
     public function resolveTargetAttributeDataProvider(): array
     {
-        $targetName = $this->getUniqueId('name_');
-        $target = $this->getUniqueId('target_');
-        $fallback = $this->getUniqueId('fallback_');
+        $targetName = StringUtility::getUniqueId('name_');
+        $target = StringUtility::getUniqueId('target_');
+        $fallback = StringUtility::getUniqueId('fallback_');
         return [
             'Take target from $conf, if $conf[$targetName] is set.' =>
                 [
index 0c7ee17..0bb7909 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\IndexedSearch\Tests\Unit;
  */
 
 use TYPO3\CMS\Core\Core\Environment;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 use TYPO3\CMS\IndexedSearch\Indexer;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
@@ -35,7 +36,7 @@ class IndexerTest extends UnitTestCase
      */
     public function extractHyperLinksDoesNotReturnNonExistingLocalPath()
     {
-        $html = 'test <a href="' . $this->getUniqueId() . '">test</a> test';
+        $html = 'test <a href="' . StringUtility::getUniqueId() . '">test</a> test';
         $subject = new Indexer();
         $result = $subject->extractHyperLinks($html);
         self::assertEquals(1, count($result));
@@ -84,7 +85,7 @@ class IndexerTest extends UnitTestCase
      */
     public function extractHyperLinksFindsCorrectPathUsingAbsRefPrefix()
     {
-        $absRefPrefix = '/' . $this->getUniqueId();
+        $absRefPrefix = '/' . StringUtility::getUniqueId();
         $html = 'test <a href="' . $absRefPrefix . 'index.php">test</a> test';
         $GLOBALS['TSFE'] = $this->createMock(TypoScriptFrontendController::class);
         $config = [
index e188ed7..4958458 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure;
 
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Install\FolderStructure\AbstractNode;
 use TYPO3\CMS\Install\FolderStructure\Exception;
 use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
@@ -34,7 +35,7 @@ class AbstractNodeTest extends FolderStructureTestCase
     {
         /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(AbstractNode::class, ['dummy'], [], '', false);
-        $name = $this->getUniqueId('name_');
+        $name = StringUtility::getUniqueId('name_');
         $node->_set('name', $name);
         self::assertSame($name, $node->getName());
     }
@@ -85,7 +86,7 @@ class AbstractNodeTest extends FolderStructureTestCase
         $parent = $this->createMock(\TYPO3\CMS\Install\FolderStructure\RootNodeInterface::class);
         $parentPath = '/foo/bar';
         $parent->expects(self::once())->method('getAbsolutePath')->willReturn($parentPath);
-        $name = $this->getUniqueId('test_');
+        $name = StringUtility::getUniqueId('test_');
         $node->_set('parent', $parent);
         $node->_set('name', $name);
         self::assertSame($parentPath . '/' . $name, $node->getAbsolutePath());
@@ -137,8 +138,8 @@ class AbstractNodeTest extends FolderStructureTestCase
     {
         /** @var $node AbstractNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(AbstractNode::class, ['getAbsolutePath'], [], '', false);
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
-        $target = Environment::getVarPath() . '/tests/' . $this->getUniqueId('notExists_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
+        $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('notExists_');
         touch($target);
         symlink($target, $path);
         unlink($target);
@@ -198,7 +199,7 @@ class AbstractNodeTest extends FolderStructureTestCase
         $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn('');
         $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false);
         $path = $this->getVirtualTestDir('root_');
-        $subPath = $path . '/' . $this->getUniqueId('dir_');
+        $subPath = $path . '/' . StringUtility::getUniqueId('dir_');
         mkdir($subPath);
         chmod($path, 02000);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath);
@@ -226,7 +227,7 @@ class AbstractNodeTest extends FolderStructureTestCase
         $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn('');
         $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false);
         $path = $this->getVirtualTestDir('root_');
-        $subPath = $path . '/' . $this->getUniqueId('dir_');
+        $subPath = $path . '/' . StringUtility::getUniqueId('dir_');
         mkdir($subPath);
         chmod($path, 02000);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath);
@@ -251,7 +252,7 @@ class AbstractNodeTest extends FolderStructureTestCase
         $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn('');
         $node->expects(self::once())->method('isPermissionCorrect')->willReturn(false);
         $path = $this->getVirtualTestDir('root_');
-        $subPath = $path . '/' . $this->getUniqueId('dir_');
+        $subPath = $path . '/' . StringUtility::getUniqueId('dir_');
         mkdir($subPath);
         chmod($path, 02770);
         $node->_set('targetPermission', '2770');
index 54acc1e..9a165b2 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure;
 
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Install\FolderStructure\DirectoryNode;
 use TYPO3\CMS\Install\FolderStructure\Exception;
 use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
@@ -113,7 +114,7 @@ class DirectoryNodeTest extends FolderStructureTestCase
     public function constructorSetsName(): void
     {
         $parent = $this->createMock(RootNodeInterface::class);
-        $name = $this->getUniqueId('test_');
+        $name = StringUtility::getUniqueId('test_');
         $node = new DirectoryNode(['name' => $name], $parent);
         self::assertSame($name, $node->getName());
     }
@@ -328,7 +329,7 @@ class DirectoryNodeTest extends FolderStructureTestCase
             ->disableOriginalConstructor()
             ->setMethods(['fixSelf'])
             ->getMock();
-        $uniqueReturn = [$this->getUniqueId('foo_')];
+        $uniqueReturn = [StringUtility::getUniqueId('foo_')];
         $node->expects(self::once())->method('fixSelf')->willReturn($uniqueReturn);
         self::assertSame($uniqueReturn, $node->fix());
     }
@@ -340,15 +341,15 @@ class DirectoryNodeTest extends FolderStructureTestCase
     {
         /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(DirectoryNode::class, ['fixSelf'], [], '', false);
-        $uniqueReturnSelf = $this->getUniqueId('foo_');
+        $uniqueReturnSelf = StringUtility::getUniqueId('foo_');
         $node->expects(self::once())->method('fixSelf')->willReturn([$uniqueReturnSelf]);
 
         $childMock1 = $this->createMock(NodeInterface::class);
-        $uniqueReturnChild1 = $this->getUniqueId('foo_');
+        $uniqueReturnChild1 = StringUtility::getUniqueId('foo_');
         $childMock1->expects(self::once())->method('fix')->willReturn([$uniqueReturnChild1]);
 
         $childMock2 = $this->createMock(NodeInterface::class);
-        $uniqueReturnChild2 = $this->getUniqueId('foo_');
+        $uniqueReturnChild2 = StringUtility::getUniqueId('foo_');
         $childMock2->expects(self::once())->method('fix')->willReturn([$uniqueReturnChild2]);
 
         $node->_set('children', [$childMock1, $childMock2]);
@@ -470,7 +471,7 @@ class DirectoryNodeTest extends FolderStructureTestCase
         $node = $this->getAccessibleMock(DirectoryNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false);
         $path = $this->getVirtualTestDir('root_');
         chmod($path, 02550);
-        $subPath = $path . '/' . $this->getUniqueId('dir_');
+        $subPath = $path . '/' . StringUtility::getUniqueId('dir_');
         $node->expects(self::once())->method('exists')->willReturn(false);
         $node->method('getAbsolutePath')->willReturn($subPath);
         $node->method('getRelativePathBelowSiteRoot')->willReturn($subPath);
@@ -541,7 +542,7 @@ class DirectoryNodeTest extends FolderStructureTestCase
         /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(DirectoryNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(NodeInterface::class);
-        $childName = $this->getUniqueId('test_');
+        $childName = StringUtility::getUniqueId('test_');
         $structure = [
             'name' => 'foo',
             'type' => DirectoryNode::class,
@@ -620,11 +621,11 @@ class DirectoryNodeTest extends FolderStructureTestCase
     {
         /** @var $node DirectoryNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(DirectoryNode::class, ['getAbsolutePath'], [], '', false);
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('root_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('root_');
         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($path);
         $this->testFilesToDelete[] = $path;
-        $link = $this->getUniqueId('link_');
-        $dir = $this->getUniqueId('dir_');
+        $link = StringUtility::getUniqueId('link_');
+        $dir = StringUtility::getUniqueId('dir_');
         mkdir($path . '/' . $dir);
         symlink($path . '/' . $dir, $path . '/' . $link);
         $node->method('getAbsolutePath')->willReturn($path . '/' . $link);
index 5a64592..2955033 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure;
 
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Install\FolderStructure\Exception;
 use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
 use TYPO3\CMS\Install\FolderStructure\FileNode;
@@ -95,7 +96,7 @@ class FileNodeTest extends FolderStructureTestCase
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(\TYPO3\CMS\Install\FolderStructure\RootNodeInterface::class);
-        $name = $this->getUniqueId('test_');
+        $name = StringUtility::getUniqueId('test_');
         $node->__construct(['name' => $name], $parent);
         self::assertSame($name, $node->getName());
     }
@@ -126,7 +127,7 @@ class FileNodeTest extends FolderStructureTestCase
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(\TYPO3\CMS\Install\FolderStructure\RootNodeInterface::class);
-        $targetContent = $this->getUniqueId('content_');
+        $targetContent = StringUtility::getUniqueId('content_');
         $structure = [
             'name' => 'foo',
             'targetContent' => $targetContent,
@@ -144,7 +145,7 @@ class FileNodeTest extends FolderStructureTestCase
         $node = $this->getAccessibleMock(FileNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(\TYPO3\CMS\Install\FolderStructure\RootNodeInterface::class);
         $targetFile = $this->getVirtualTestFilePath('test_');
-        $targetContent = $this->getUniqueId('content_');
+        $targetContent = StringUtility::getUniqueId('content_');
         file_put_contents($targetFile, $targetContent);
         $structure = [
             'name' => 'foo',
@@ -201,7 +202,7 @@ class FileNodeTest extends FolderStructureTestCase
             false
         );
         // do not use var path here, as file nodes explicitly check for public path
-        $path = Environment::getPublicPath() . '/typo3temp/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_');
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         $node->expects(self::any())->method('exists')->willReturn(true);
         $node->expects(self::any())->method('isFile')->willReturn(true);
@@ -379,7 +380,7 @@ class FileNodeTest extends FolderStructureTestCase
             '',
             false
         );
-        $uniqueReturn = [$this->getUniqueId('foo_')];
+        $uniqueReturn = [StringUtility::getUniqueId('foo_')];
         $node->expects(self::once())->method('fixSelf')->willReturn($uniqueReturn);
         self::assertSame($uniqueReturn, $node->fix());
     }
@@ -589,7 +590,7 @@ class FileNodeTest extends FolderStructureTestCase
         $node = $this->getAccessibleMock(FileNode::class, ['exists', 'getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false);
         $path = $this->getVirtualTestDir();
         chmod($path, 02550);
-        $subPath = $path . '/' . $this->getUniqueId('file_');
+        $subPath = $path . '/' . StringUtility::getUniqueId('file_');
         $node->expects(self::once())->method('exists')->willReturn(false);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($subPath);
         $node->expects(self::any())->method('getRelativePathBelowSiteRoot')->willReturn($subPath);
@@ -632,7 +633,7 @@ class FileNodeTest extends FolderStructureTestCase
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false);
         $path = $this->getVirtualTestFilePath('file_');
-        $content = $this->getUniqueId('content_');
+        $content = StringUtility::getUniqueId('content_');
         file_put_contents($path, $content);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         $node->_set('targetContent', $content);
@@ -647,8 +648,8 @@ class FileNodeTest extends FolderStructureTestCase
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false);
         $path = $this->getVirtualTestFilePath('file_');
-        $content = $this->getUniqueId('content1_');
-        $targetContent = $this->getUniqueId('content2_');
+        $content = StringUtility::getUniqueId('content1_');
+        $targetContent = StringUtility::getUniqueId('content2_');
         file_put_contents($path, $content);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         $node->_set('targetContent', $targetContent);
@@ -715,7 +716,7 @@ class FileNodeTest extends FolderStructureTestCase
         $path = $this->getVirtualTestFilePath('file_');
         touch($path);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
-        $targetContent = $this->getUniqueId('content_');
+        $targetContent = StringUtility::getUniqueId('content_');
         $node->_set('targetContent', $targetContent);
         $node->_call('setContent');
         $resultContent = file_get_contents($path);
@@ -732,7 +733,7 @@ class FileNodeTest extends FolderStructureTestCase
         $path = $this->getVirtualTestFilePath('file_');
         touch($path);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
-        $targetContent = $this->getUniqueId('content_');
+        $targetContent = StringUtility::getUniqueId('content_');
         $node->_set('targetContent', $targetContent);
         self::assertSame(FlashMessage::OK, $node->_call('setContent')->getSeverity());
     }
@@ -748,11 +749,11 @@ class FileNodeTest extends FolderStructureTestCase
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath', 'getRelativePathBelowSiteRoot'], [], '', false);
         $dir = $this->getVirtualTestDir('dir_');
-        $file = $dir . '/' . $this->getUniqueId('file_');
+        $file = $dir . '/' . StringUtility::getUniqueId('file_');
         touch($file);
         chmod($file, 0440);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($file);
-        $targetContent = $this->getUniqueId('content_');
+        $targetContent = StringUtility::getUniqueId('content_');
         $node->_set('targetContent', $targetContent);
         self::assertSame(FlashMessage::ERROR, $node->_call('setContent')->getSeverity());
     }
@@ -778,11 +779,11 @@ class FileNodeTest extends FolderStructureTestCase
     {
         /** @var $node FileNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(FileNode::class, ['getAbsolutePath'], [], '', false);
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('root_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('root_');
         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($path);
         $this->testFilesToDelete[] = $path;
-        $link = $this->getUniqueId('link_');
-        $file = $this->getUniqueId('file_');
+        $link = StringUtility::getUniqueId('link_');
+        $file = StringUtility::getUniqueId('file_');
         touch($path . '/' . $file);
         symlink($path . '/' . $file, $path . '/' . $link);
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path . '/' . $link);
index 90a9c2f..513d033 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure;
 
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
 use TYPO3\CMS\Install\FolderStructure\LinkNode;
 use TYPO3\CMS\Install\FolderStructure\NodeInterface;
@@ -80,7 +81,7 @@ class LinkNodeTest extends UnitTestCase
         /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(RootNodeInterface::class);
-        $name = $this->getUniqueId('test_');
+        $name = StringUtility::getUniqueId('test_');
         $node->__construct(['name' => $name], $parent);
         self::assertSame($name, $node->getName());
     }
@@ -93,8 +94,8 @@ class LinkNodeTest extends UnitTestCase
         /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(LinkNode::class, ['dummy'], [], '', false);
         $parent = $this->createMock(RootNodeInterface::class);
-        $name = $this->getUniqueId('test_');
-        $target = '../' . $this->getUniqueId('test_');
+        $name = StringUtility::getUniqueId('test_');
+        $target = '../' . StringUtility::getUniqueId('test_');
         $node->__construct(['name' => $name, 'target' => $target], $parent);
         self::assertSame($target, $node->_call('getTarget'));
     }
@@ -113,7 +114,7 @@ class LinkNodeTest extends UnitTestCase
             false
         );
         // do not use var path here, as link nodes get checked for public path as first part
-        $path = Environment::getPublicPath() . '/typo3temp/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_');
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         self::assertIsArray($node->getStatus());
     }
@@ -132,7 +133,7 @@ class LinkNodeTest extends UnitTestCase
             false
         );
         // do not use var path here, as link nodes get checked for public path as first part
-        $path = Environment::getPublicPath() . '/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/tests/' . StringUtility::getUniqueId('dir_');
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         $node->expects(self::once())->method('isWindowsOs')->willReturn(true);
         $statusArray = $node->getStatus();
@@ -153,7 +154,7 @@ class LinkNodeTest extends UnitTestCase
             false
         );
         // do not use var path here, as link nodes get checked for public path as first part
-        $path = Environment::getPublicPath() . '/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/tests/' . StringUtility::getUniqueId('dir_');
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
         $node->expects(self::any())->method('isWindowsOs')->willReturn(false);
         $node->expects(self::once())->method('exists')->willReturn(false);
@@ -262,8 +263,8 @@ class LinkNodeTest extends UnitTestCase
     {
         /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'getAbsolutePath'], [], '', false);
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
-        $target = Environment::getVarPath() . '/tests/' . $this->getUniqueId('linkTarget_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
+        $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_');
         touch($target);
         symlink($target, $path);
         $this->testFilesToDelete[] = $path;
@@ -280,7 +281,7 @@ class LinkNodeTest extends UnitTestCase
     {
         /** @var $node LinkNode|AccessibleObjectInterface|\PHPUnit\Framework\MockObject\MockObject */
         $node = $this->getAccessibleMock(LinkNode::class, ['exists', 'getAbsolutePath'], [], '', false);
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('file_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('file_');
         touch($path);
         $this->testFilesToDelete[] = $path;
         $node->expects(self::any())->method('exists')->willReturn(true);
@@ -348,8 +349,8 @@ class LinkNodeTest extends UnitTestCase
      */
     public function isTargetCorrectReturnsTrueIfActualTargetIsIdenticalToSpecifiedTarget()
     {
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
-        $target = Environment::getVarPath() . '/tests/' . $this->getUniqueId('linkTarget_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
+        $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_');
         touch($target);
         symlink($target, $path);
         $this->testFilesToDelete[] = $path;
@@ -375,8 +376,8 @@ class LinkNodeTest extends UnitTestCase
      */
     public function isTargetCorrectReturnsFalseIfActualTargetIsNotIdenticalToSpecifiedTarget()
     {
-        $path = Environment::getVarPath() . '/tests/' . $this->getUniqueId('link_');
-        $target = Environment::getVarPath() . '/tests/' . $this->getUniqueId('linkTarget_');
+        $path = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('link_');
+        $target = Environment::getVarPath() . '/tests/' . StringUtility::getUniqueId('linkTarget_');
         touch($target);
         symlink($target, $path);
         $this->testFilesToDelete[] = $path;
index 492f7ea..172d7de 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Install\Tests\Unit\FolderStructure;
 use TYPO3\CMS\Core\Core\Environment;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Install\FolderStructure\DirectoryNode;
 use TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException;
 use TYPO3\CMS\Install\FolderStructure\Exception\RootNodeException;
@@ -124,7 +125,7 @@ class RootNodeTest extends UnitTestCase
             ->expects(self::any())
             ->method('isWindowsOs')
             ->willReturn(false);
-        $childName = $this->getUniqueId('test_');
+        $childName = StringUtility::getUniqueId('test_');
         $structure = [
             'name' => '/foo',
             'children' => [
@@ -173,7 +174,7 @@ class RootNodeTest extends UnitTestCase
             ->expects(self::any())
             ->method('isWindowsOs')
             ->willReturn(false);
-        $name = '/' . $this->getUniqueId('test_');
+        $name = '/' . StringUtility::getUniqueId('test_');
         $node->__construct(['name' => $name], null);
         self::assertSame($name, $node->getName());
     }
@@ -192,7 +193,7 @@ class RootNodeTest extends UnitTestCase
             false
         );
         // do not use var path here, as root nodes get checked for public path as first part
-        $path = Environment::getPublicPath() . '/typo3temp/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_');
         GeneralUtility::mkdir_deep($path);
         $this->testFilesToDelete[] = $path;
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
@@ -218,7 +219,7 @@ class RootNodeTest extends UnitTestCase
             false
         );
         // do not use var path here, as root nodes get checked for public path as first part
-        $path = Environment::getPublicPath() . '/typo3temp/tests/' . $this->getUniqueId('dir_');
+        $path = Environment::getPublicPath() . '/typo3temp/tests/' . StringUtility::getUniqueId('dir_');
         GeneralUtility::mkdir_deep($path);
         $this->testFilesToDelete[] = $path;
         $node->expects(self::any())->method('getAbsolutePath')->willReturn($path);
index b6e973b..4a737ae 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Tests\Unit;
  */
 
 use org\bovigo\vfs\vfsStream;
+use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
@@ -31,7 +32,7 @@ abstract class FolderStructureTestCase extends UnitTestCase
     protected function getVirtualTestDir($prefix = 'root_')
     {
         $root = vfsStream::setup();
-        $path = $root->url() . '/typo3temp/var/tests/' . $this->getUniqueId($prefix);
+        $path = $root->url() . '/typo3temp/var/tests/' . StringUtility::getUniqueId($prefix);
         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($path);
         return $path;
     }
@@ -44,6 +45,6 @@ abstract class FolderStructureTestCase extends UnitTestCase
      */
     protected function getVirtualTestFilePath($prefix = 'file_')
     {
-        return $this->getVirtualTestDir() . '/' . $this->getUniqueId($prefix);
+        return $this->getVirtualTestDir() . '/' . StringUtility::getUniqueId($prefix);
     }
 }