diff options
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/appframework/http/RequestTest.php | 9 | ||||
-rw-r--r-- | tests/lib/dbschema.php | 2 | ||||
-rw-r--r-- | tests/lib/security/securerandom.php | 6 | ||||
-rw-r--r-- | tests/lib/testcase.php | 2 |
4 files changed, 6 insertions, 13 deletions
diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 32603d0da59..ab79eb498fa 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/appframework/http/RequestTest.php @@ -352,18 +352,11 @@ class RequestTest extends \Test\TestCase { } public function testGetIdWithoutModUnique() { - $lowRandomSource = $this->getMockBuilder('\OCP\Security\ISecureRandom') - ->disableOriginalConstructor()->getMock(); - $lowRandomSource->expects($this->once()) + $this->secureRandom->expects($this->once()) ->method('generate') ->with('20') ->will($this->returnValue('GeneratedByOwnCloudItself')); - $this->secureRandom - ->expects($this->once()) - ->method('getLowStrengthGenerator') - ->will($this->returnValue($lowRandomSource)); - $request = new Request( [], $this->secureRandom, diff --git a/tests/lib/dbschema.php b/tests/lib/dbschema.php index d96f8195770..11eacbf397f 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/dbschema.php @@ -26,7 +26,7 @@ class Test_DBSchema extends \Test\TestCase { $dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml'; $dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml'; - $r = '_' . \OC::$server->getSecureRandom()->getMediumStrengthGenerator()-> + $r = '_' . \OC::$server->getSecureRandom()-> generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_'; $content = file_get_contents( $dbfile ); $content = str_replace( '*dbprefix*', '*dbprefix*'.$r, $content ); diff --git a/tests/lib/security/securerandom.php b/tests/lib/security/securerandom.php index af437640805..526066d92ee 100644 --- a/tests/lib/security/securerandom.php +++ b/tests/lib/security/securerandom.php @@ -42,7 +42,7 @@ class SecureRandomTest extends \Test\TestCase { * @dataProvider stringGenerationProvider */ function testGetLowStrengthGeneratorLength($length, $expectedLength) { - $generator = $this->rng->getLowStrengthGenerator(); + $generator = $this->rng; $this->assertEquals($expectedLength, strlen($generator->generate($length))); } @@ -51,7 +51,7 @@ class SecureRandomTest extends \Test\TestCase { * @dataProvider stringGenerationProvider */ function testMediumLowStrengthGeneratorLength($length, $expectedLength) { - $generator = $this->rng->getMediumStrengthGenerator(); + $generator = $this->rng; $this->assertEquals($expectedLength, strlen($generator->generate($length))); } @@ -67,7 +67,7 @@ class SecureRandomTest extends \Test\TestCase { * @dataProvider charCombinations */ public function testScheme($charName, $chars) { - $generator = $this->rng->getMediumStrengthGenerator(); + $generator = $this->rng; $scheme = constant('OCP\Security\ISecureRandom::' . $charName); $randomString = $generator->generate(100, $scheme); $matchesRegex = preg_match('/^'.$chars.'+$/', $randomString); diff --git a/tests/lib/testcase.php b/tests/lib/testcase.php index 93b354863a9..38d5cf49320 100644 --- a/tests/lib/testcase.php +++ b/tests/lib/testcase.php @@ -150,7 +150,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase { * @return string */ protected static function getUniqueID($prefix = '', $length = 13) { - return $prefix . \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate( + return $prefix . \OC::$server->getSecureRandom()->generate( $length, // Do not use dots and slashes as we use the value for file names ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER |