diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-05-28 21:03:17 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-06-01 21:31:05 +0200 |
commit | af25aef04ca3ee39cd1597b356638e883ccf72fa (patch) | |
tree | 6fd92cb452af622566b07d16221b7c6a13ef48d6 /tests/passwords | |
parent | [ticket/12352] Rename phpbb2_md5 driver to fit filenames of other drivers (diff) | |
download | phpbb-af25aef04ca3ee39cd1597b356638e883ccf72fa.tar.gz phpbb-af25aef04ca3ee39cd1597b356638e883ccf72fa.tar.bz2 phpbb-af25aef04ca3ee39cd1597b356638e883ccf72fa.zip |
[ticket/12352] Add driver for myBB md5 passwords
PHPBB3-12352
Diffstat (limited to 'tests/passwords')
-rw-r--r-- | tests/passwords/drivers_test.php | 25 | ||||
-rw-r--r-- | tests/passwords/manager_test.php | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php index 3ef39df709..1f900340c7 100644 --- a/tests/passwords/drivers_test.php +++ b/tests/passwords/drivers_test.php @@ -30,6 +30,7 @@ class phpbb_passwords_helper_test extends \phpbb_test_case 'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper), 'passwords.driver.convert_password' => new \phpbb\passwords\driver\convert_password($config, $this->driver_helper), 'passwords.driver.sha1' => new \phpbb\passwords\driver\sha1($config, $this->driver_helper), + 'passwords.driver.md5_mybb' => new \phpbb\passwords\driver\md5_mybb($config, $this->driver_helper), ); $this->passwords_drivers['passwords.driver.md5_phpbb2'] = new \phpbb\passwords\driver\md5_phpbb2($request, $this->passwords_drivers['passwords.driver.salted_md5'], $phpbb_root_path, $php_ext); } @@ -172,6 +173,30 @@ class phpbb_passwords_helper_test extends \phpbb_test_case $this->assertSame(false, $this->passwords_drivers['passwords.driver.sha1']->get_settings_only('ae2fc75e20ee25d4520766788fbc96ae')); } + public function data_md5_mybb_check() + { + return array( + array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'), + array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd', array('user_passwd_salt' => 'ae2fc75e')), + array(true, 'foobar', '6022de2cc0ecf59ff14b57c6205ee170', array('user_passwd_salt' => 'ae2fc75e')), + ); + } + + /** + * @dataProvider data_md5_mybb_check + */ + public function test_md5_mybb_check($expected, $password, $hash, $user_row = array()) + { + $this->assertSame($expected, $this->passwords_drivers['passwords.driver.md5_mybb']->check($password, $hash, $user_row)); + } + + public function test_md5_mybb_driver() + { + $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->hash('foobar')); + + $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->get_settings_only('6022de2cc0ecf59ff14b57c6205ee170')); + } + protected function utf8_to_cp1252($string) { static $transform = array( diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 2a53d79027..e2ec1972bb 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -36,6 +36,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case 'passwords.driver.convert_password' => new \phpbb\passwords\driver\convert_password($config, $this->driver_helper), 'passwords.driver.sha1_smf' => new \phpbb\passwords\driver\sha1_smf($config, $this->driver_helper), 'passwords.driver.sha1' => new \phpbb\passwords\driver\sha1($config, $this->driver_helper), + 'passwords.driver.md5_mybb' => new \phpbb\passwords\driver\md5_mybb($config, $this->driver_helper), ); $this->passwords_drivers['passwords.driver.md5_phpbb2'] = new \phpbb\passwords\driver\md5_phpbb2($request, $this->passwords_drivers['passwords.driver.salted_md5'], $phpbb_root_path, $php_ext); |