aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-05-29 14:00:42 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-06-01 21:31:05 +0200
commitc6e1b51d786857478d2c20050c01f92ac2f8ac76 (patch)
tree0f65badb302948b7dcb6d25aa2248c7de416e7fb /tests/passwords/drivers_test.php
parent[ticket/12352] Use correct hashing method in md5_mybb driver (diff)
downloadphpbb-c6e1b51d786857478d2c20050c01f92ac2f8ac76.tar.gz
phpbb-c6e1b51d786857478d2c20050c01f92ac2f8ac76.tar.bz2
phpbb-c6e1b51d786857478d2c20050c01f92ac2f8ac76.zip
[ticket/12352] Add passwords driver for vB passwords
PHPBB3-12352
Diffstat (limited to 'tests/passwords/drivers_test.php')
-rw-r--r--tests/passwords/drivers_test.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php
index 146f979a27..d67aead75a 100644
--- a/tests/passwords/drivers_test.php
+++ b/tests/passwords/drivers_test.php
@@ -30,7 +30,8 @@ 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),
+ 'passwords.driver.md5_mybb' => new \phpbb\passwords\driver\md5_mybb($config, $this->driver_helper),
+ 'passwords.driver.md5_vb' => new \phpbb\passwords\driver\md5_vb($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);
}
@@ -197,6 +198,32 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
$this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_mybb']->get_settings_only('6022de2cc0ecf59ff14b57c6205ee170'));
}
+ public function data_md5_vb_check()
+ {
+ return array(
+ array(false, 'foobar', '083d11daea8675b1b4b502c7e55f8dbd'),
+ array(false, 'foobar', 'b86ee7e24008bfd2890dcfab1ed31333', array('user_passwd_salt' => 'yeOtfFO6')),
+ array(true, 'foobar', 'b452c54c44c588fc095d2d000935c470', array('user_passwd_salt' => '9^F')),
+ array(true, 'foobar', 'f23a8241bd115d270c703213e3ef7f52', array('user_passwd_salt' => 'iaU*U%`CBl;/e~>D%do2m@Xf/,KZB0')),
+ array(false, 'nope', 'f23a8241bd115d270c703213e3ef7f52', array('user_passwd_salt' => 'iaU*U%`CBl;/e~>D%do2m@Xf/,KZB0')),
+ );
+ }
+
+ /**
+ * @dataProvider data_md5_vb_check
+ */
+ public function test_md5_vb_check($expected, $password, $hash, $user_row = array())
+ {
+ $this->assertSame($expected, $this->passwords_drivers['passwords.driver.md5_vb']->check($password, $hash, $user_row));
+ }
+
+ public function test_md5_vb_driver()
+ {
+ $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_vb']->hash('foobar'));
+
+ $this->assertSame(false, $this->passwords_drivers['passwords.driver.md5_vb']->get_settings_only('6022de2cc0ecf59ff14b57c6205ee170'));
+ }
+
protected function utf8_to_cp1252($string)
{
static $transform = array(