diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-10-09 14:28:57 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-10-09 14:28:57 +0200 |
commit | 3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51 (patch) | |
tree | 4e6365faa1dac41293f1d629ea772281715c27aa /tests/passwords | |
parent | f1d29499859a060b8c59a9efbeada74958eee720 (diff) | |
download | forums-3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51.tar forums-3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51.tar.gz forums-3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51.tar.bz2 forums-3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51.tar.xz forums-3b6038cfcd6e00aaf8e9b5f68f2a925c9a85da51.zip |
[feature/passwords] Add tests for unique_id() method in helper
PHPBB3-11610
Diffstat (limited to 'tests/passwords')
-rw-r--r-- | tests/passwords/manager_test.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index a8dbabf74f..4ad5b439d6 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -26,13 +26,13 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase // Prepare dependencies for manager and driver $config = new \phpbb\config\config(array()); - $driver_helper = new \phpbb\passwords\driver\helper($config); + $this->driver_helper = new \phpbb\passwords\driver\helper($config); $this->passwords_drivers = array( - 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $driver_helper), - 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper), - 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $driver_helper), - 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $driver_helper), + 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper), + 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper), + 'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper), + 'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper), ); foreach ($this->passwords_drivers as $key => $driver) @@ -246,4 +246,15 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase } } } + + public function test_unique_id() + { + $time = microtime(true); + $first_id = $this->driver_helper->unique_id(); + // Limit test to 1 second + while ((microtime(true) - $time) < 1) + { + $this->assertNotEquals($first_id, $this->driver_helper->unique_id()); + } + } } |