diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-12-11 06:17:47 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-12-11 08:47:36 +0100 |
commit | f3360d51c6d069fc873a0b5563c01d37d58727c7 (patch) | |
tree | 61ae5808a8bac6b3bf03be520465bf2da43f72a9 /tests/lib/security | |
parent | acce1638e5c06e0a3c98a0450fd82df9574524dc (diff) | |
download | nextcloud-server-f3360d51c6d069fc873a0b5563c01d37d58727c7.tar.gz nextcloud-server-f3360d51c6d069fc873a0b5563c01d37d58727c7.zip |
Use PHP polyfills
Diffstat (limited to 'tests/lib/security')
-rw-r--r-- | tests/lib/security/securerandom.php | 7 | ||||
-rw-r--r-- | tests/lib/security/stringutils.php | 38 |
2 files changed, 3 insertions, 42 deletions
diff --git a/tests/lib/security/securerandom.php b/tests/lib/security/securerandom.php index d9bbd0e71e5..af437640805 100644 --- a/tests/lib/security/securerandom.php +++ b/tests/lib/security/securerandom.php @@ -57,11 +57,10 @@ class SecureRandomTest extends \Test\TestCase { } /** - * @expectedException \Exception - * @expectedExceptionMessage Generator is not initialized + * @dataProvider stringGenerationProvider */ - function testUninitializedGenerate() { - $this->rng->generate(30); + function testUninitializedGenerate($length, $expectedLength) { + $this->assertEquals($expectedLength, strlen($this->rng->generate($length))); } /** diff --git a/tests/lib/security/stringutils.php b/tests/lib/security/stringutils.php deleted file mode 100644 index 060315debb4..00000000000 --- a/tests/lib/security/stringutils.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com> - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -use \OC\Security\StringUtils; - -class StringUtilsTest extends \Test\TestCase { - - public function dataProvider() - { - return array( - array('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'), - array('', ''), - array('我看这本书。 我看這本書', '我看这本书。 我看這本書'), - array('GpKY9fSnWNJbES99zVGvA', 'GpKY9fSnWNJbES99zVGvA') - ); - } - - /** - * @dataProvider dataProvider - */ - function testWrongEquals($string) { - $this->assertFalse(StringUtils::equals($string, 'A Completely Wrong String')); - $this->assertFalse(StringUtils::equals($string, null)); - } - - /** - * @dataProvider dataProvider - */ - function testTrueEquals($string, $expected) { - $this->assertTrue(StringUtils::equals($string, $expected)); - } - -} |