Use self::getUniqueID instead of uniqid

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2021-06-02 15:19:53 +02:00
parent 1d5cbd3e04
commit dfd9d5f504
10 changed files with 32 additions and 32 deletions

View File

@ -79,7 +79,7 @@ class FileTest extends TestCase {
\OC_Hook::clear(); \OC_Hook::clear();
$this->user = 'test_user' . uniqid('', true); $this->user = self::getUniqueID('test_user');
$this->createUser($this->user, 'pass'); $this->createUser($this->user, 'pass');
$this->loginAsUser($this->user); $this->loginAsUser($this->user);

View File

@ -892,8 +892,8 @@ class FederatedShareProviderTest extends \Test\TestCase {
$userManager = \OC::$server->getUserManager(); $userManager = \OC::$server->getUserManager();
$rootFolder = \OC::$server->getRootFolder(); $rootFolder = \OC::$server->getRootFolder();
$u1 = $userManager->createUser(uniqid('testFed', true), md5(time())); $u1 = $userManager->createUser(self::getUniqueID('testFed'), md5(time()));
$u2 = $userManager->createUser(uniqid('testFed2', true), md5(time())); $u2 = $userManager->createUser(self::getUniqueID('testFed2'), md5(time()));
$folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo'); $folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo');
$file1 = $folder1->newFile('bar1'); $file1 = $folder1->newFile('bar1');
@ -946,7 +946,7 @@ class FederatedShareProviderTest extends \Test\TestCase {
$userManager = \OC::$server->getUserManager(); $userManager = \OC::$server->getUserManager();
$rootFolder = \OC::$server->getRootFolder(); $rootFolder = \OC::$server->getRootFolder();
$u1 = $userManager->createUser(uniqid('testFed', true), md5(time())); $u1 = $userManager->createUser(self::getUniqueID('testFed'), md5(time()));
$folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo'); $folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo');
$file1 = $folder1->newFile('bar1'); $file1 = $folder1->newFile('bar1');

View File

@ -83,10 +83,10 @@ abstract class TestCase extends \Test\TestCase {
\OC::registerShareHooks(\OC::$server->getSystemConfig()); \OC::registerShareHooks(\OC::$server->getSystemConfig());
// User Prefix // User Prefix
$this->TEST_FILES_SHARING_API_USER1 = $this->TEST_FILES_SHARING_API_USER1 . uniqid("", true); $this->TEST_FILES_SHARING_API_USER1 = self::getUniqueID($this->TEST_FILES_SHARING_API_USER1);
$this->TEST_FILES_SHARING_API_USER2 = $this->TEST_FILES_SHARING_API_USER2 . uniqid("", true); $this->TEST_FILES_SHARING_API_USER2 = self::getUniqueID($this->TEST_FILES_SHARING_API_USER2);
$this->TEST_FILES_SHARING_API_USER3 = $this->TEST_FILES_SHARING_API_USER3 . uniqid("", true); $this->TEST_FILES_SHARING_API_USER3 = self::getUniqueID($this->TEST_FILES_SHARING_API_USER3);
$this->TEST_FILES_SHARING_API_USER4 = $this->TEST_FILES_SHARING_API_USER4 . uniqid("", true); $this->TEST_FILES_SHARING_API_USER4 = self::getUniqueID($this->TEST_FILES_SHARING_API_USER4);
// create users // create users
$backend = new \Test\Util\User\Dummy(); $backend = new \Test\Util\User\Dummy();

View File

@ -987,8 +987,8 @@ class ShareByMailProviderTest extends TestCase {
$provider = $this->getInstance(['sendMailNotification', 'createShareActivity']); $provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);
$u1 = $userManager->createUser(uniqid('testFed', true), md5(time())); $u1 = $userManager->createUser(self::getUniqueID('testFed'), md5(time()));
$u2 = $userManager->createUser(uniqid('testFed2', true), md5(time())); $u2 = $userManager->createUser(self::getUniqueID('testFed2'), md5(time()));
$folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo'); $folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo');
$file1 = $folder1->newFile('bar1'); $file1 = $folder1->newFile('bar1');
@ -1033,8 +1033,8 @@ class ShareByMailProviderTest extends TestCase {
$provider = $this->getInstance(['sendMailNotification', 'createShareActivity']); $provider = $this->getInstance(['sendMailNotification', 'createShareActivity']);
$u1 = $userManager->createUser(uniqid('testFed', true), md5(time())); $u1 = $userManager->createUser(self::getUniqueID('testFed'), md5(time()));
$u2 = $userManager->createUser(uniqid('testFed2', true), md5(time())); $u2 = $userManager->createUser(self::getUniqueID('testFed2'), md5(time()));
$folder = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo'); $folder = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo');

View File

@ -306,9 +306,9 @@ class AppTest extends \Test\TestCase {
public function setUp(): void { public function setUp(): void {
parent::setUp(); parent::setUp();
$this->TEST_USER1 = $this->TEST_USER1 . uniqid('', true); $this->TEST_USER1 = self::getUniqueID($this->TEST_USER1);
$this->TEST_USER2 = $this->TEST_USER2 . uniqid('', true); $this->TEST_USER2 = self::getUniqueID($this->TEST_USER2);
$this->TEST_USER3 = $this->TEST_USER3 . uniqid('', true); $this->TEST_USER3 = self::getUniqueID($this->TEST_USER3);
} }
/** /**

View File

@ -71,7 +71,7 @@ class FileCacheTest extends TestCache {
\OC_User::useBackend(new \Test\Util\User\Dummy()); \OC_User::useBackend(new \Test\Util\User\Dummy());
//login //login
$this->userId = 'test' . uniqid('', true); $this->userId = self::getUniqueID('test');
\OC::$server->getUserManager()->createUser($this->userId, 'test'); \OC::$server->getUserManager()->createUser($this->userId, 'test');
$this->user = \OC_User::getUser(); $this->user = \OC_User::getUser();

View File

@ -96,7 +96,7 @@ class ViewTest extends \Test\TestCase {
//login //login
$userManager = \OC::$server->getUserManager(); $userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager(); $groupManager = \OC::$server->getGroupManager();
$this->user = 'test' . uniqid('', true); $this->user = self::getUniqueID('test');
$this->userObject = $userManager->createUser($this->user, 'test'); $this->userObject = $userManager->createUser($this->user, 'test');
$this->groupObject = $groupManager->createGroup('group1'); $this->groupObject = $groupManager->createGroup('group1');

View File

@ -2492,9 +2492,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$password = md5(time()); $password = md5(time());
$u1 = $userManager->createUser(uniqid('testShare1', true), $password); $u1 = $userManager->createUser(self::getUniqueID('testShare1'), $password);
$u2 = $userManager->createUser(uniqid('testShare2', true), $password); $u2 = $userManager->createUser(self::getUniqueID('testShare2'), $password);
$u3 = $userManager->createUser(uniqid('testShare3', true), $password); $u3 = $userManager->createUser(self::getUniqueID('testShare3'), $password);
$g1 = $groupManager->createGroup('group1'); $g1 = $groupManager->createGroup('group1');
@ -2588,11 +2588,11 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->config $this->config
); );
$u1 = $userManager->createUser(uniqid('testShare1', true), 'test'); $u1 = $userManager->createUser(self::getUniqueID('testShare1'), 'test');
$u2 = $userManager->createUser(uniqid('testShare2', true), 'test'); $u2 = $userManager->createUser(self::getUniqueID('testShare2'), 'test');
$u3 = $userManager->createUser(uniqid('testShare3', true),'test'); $u3 = $userManager->createUser(self::getUniqueID('testShare3'),'test');
$u4 = $userManager->createUser(uniqid('testShare4', true), 'test'); $u4 = $userManager->createUser(self::getUniqueID('testShare4'), 'test');
$u5 = $userManager->createUser(uniqid('testShare5', true), 'test'); $u5 = $userManager->createUser(self::getUniqueID('testShare5'), 'test');
$g1 = $groupManager->createGroup('group1'); $g1 = $groupManager->createGroup('group1');
$g1->addUser($u3); $g1->addUser($u3);
@ -2684,11 +2684,11 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->config $this->config
); );
$u1 = $userManager->createUser(uniqid('testShare1', true), 'test'); $u1 = $userManager->createUser(self::getUniqueID('testShare1'), 'test');
$u2 = $userManager->createUser(uniqid('testShare2', true), 'test'); $u2 = $userManager->createUser(self::getUniqueID('testShare2'), 'test');
$u3 = $userManager->createUser(uniqid('testShare3', true), 'test'); $u3 = $userManager->createUser(self::getUniqueID('testShare3'), 'test');
$u4 = $userManager->createUser(uniqid('testShare4', true), 'test'); $u4 = $userManager->createUser(self::getUniqueID('testShare4'), 'test');
$u5 = $userManager->createUser(uniqid('testShare5', true),'test'); $u5 = $userManager->createUser(self::getUniqueID('testShare5'),'test');
$g1 = $groupManager->createGroup('group1'); $g1 = $groupManager->createGroup('group1');
$g1->addUser($u3); $g1->addUser($u3);

View File

@ -59,7 +59,7 @@ class SubAdminTest extends \Test\TestCase {
// Create 3 users and 3 groups // Create 3 users and 3 groups
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
$this->users[] = $this->userManager->createUser('user'.$i.uniqid('', true), 'user'); $this->users[] = $this->userManager->createUser(self::getUniqueID('user'.$i), 'user');
$this->groups[] = $this->groupManager->createGroup('group'.$i); $this->groups[] = $this->groupManager->createGroup('group'.$i);
} }

View File

@ -504,7 +504,7 @@ class UserTest extends TestCase {
->method('deleteUser') ->method('deleteUser')
->willReturn($result); ->willReturn($result);
$emitter = new PublicEmitter(); $emitter = new PublicEmitter();
$userId = uniqid('foo', true); $userId = self::getUniqueID('foo');
$user = new User($userId, $backend, $this->dispatcher, $emitter); $user = new User($userId, $backend, $this->dispatcher, $emitter);
/** /**