mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/passwords] Add tests for unique_id() method in helper
PHPBB3-11610
This commit is contained in:
parent
f1d2949985
commit
3b6038cfcd
1 changed files with 16 additions and 5 deletions
|
@ -26,13 +26,13 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
// Prepare dependencies for manager and driver
|
// Prepare dependencies for manager and driver
|
||||||
$config = new \phpbb\config\config(array());
|
$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(
|
$this->passwords_drivers = array(
|
||||||
'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($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, $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, $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, $driver_helper),
|
'passwords.driver.phpass' => new \phpbb\passwords\driver\phpass($config, $this->driver_helper),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($this->passwords_drivers as $key => $driver)
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue