summaryrefslogtreecommitdiffstats
path: root/tests/lib/testcase.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-12-02 13:51:36 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-12-03 12:10:55 +0100
commitea4c25609dd23345fa1f639479421ff318e6f6c9 (patch)
tree835bd7798a9b0cd4bb8dc5cf2bd4054775a89a67 /tests/lib/testcase.php
parente9029f94cb6eb9b37623ea1a2faf8aac11675900 (diff)
downloadnextcloud-server-ea4c25609dd23345fa1f639479421ff318e6f6c9.tar.gz
nextcloud-server-ea4c25609dd23345fa1f639479421ff318e6f6c9.zip
Replace uniqid calls with $this->getUniqueID so tests pass again on windows
Diffstat (limited to 'tests/lib/testcase.php')
-rw-r--r--tests/lib/testcase.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php
index 934bc5fa8f3..27c28329535 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/testcase.php
@@ -22,6 +22,8 @@
namespace Test;
+use OCP\Security\ISecureRandom;
+
abstract class TestCase extends \PHPUnit_Framework_TestCase {
/**
* Returns a unique identifier as uniqid() is not reliable sometimes
@@ -30,11 +32,11 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
* @param int $length
* @return string
*/
- protected function getUniqueID($prefix = '', $length = 13) {
+ protected static function getUniqueID($prefix = '', $length = 13) {
return $prefix . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(
$length,
// Do not use dots and slashes as we use the value for file names
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
);
}