aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auth
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-10-02 13:28:38 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-10-02 13:28:38 +0200
commit356f3eef0760f85b947cbffbf87918544e0f6c9d (patch)
tree4c6727bcf42d8cc036b362ba1c03d9511e093943 /tests/auth
parent61e4c0f25172231d203799e4c3c5920e665ab4fa (diff)
downloadforums-356f3eef0760f85b947cbffbf87918544e0f6c9d.tar
forums-356f3eef0760f85b947cbffbf87918544e0f6c9d.tar.gz
forums-356f3eef0760f85b947cbffbf87918544e0f6c9d.tar.bz2
forums-356f3eef0760f85b947cbffbf87918544e0f6c9d.tar.xz
forums-356f3eef0760f85b947cbffbf87918544e0f6c9d.zip
[feature/passwords] Inject passwords manager into auth providers
The passwords manager will replace the old method of using the functions phpbb_hash() and phpbb_check_hash(). PHPBB3-11610
Diffstat (limited to 'tests/auth')
-rw-r--r--tests/auth/provider_apache_test.php18
-rw-r--r--tests/auth/provider_db_test.php19
2 files changed, 35 insertions, 2 deletions
diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php
index e135a1f002..5388ae0b0d 100644
--- a/tests/auth/provider_apache_test.php
+++ b/tests/auth/provider_apache_test.php
@@ -25,8 +25,24 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$config = new \phpbb\config\config(array());
$this->request = $this->getMock('\phpbb\request\request');
$this->user = $this->getMock('\phpbb\user');
+ $driver_helper = new phpbb\passwords\driver\helper($config);
+ $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),
+ );
+
+ foreach ($passwords_drivers as $key => $driver)
+ {
+ $driver->set_name($key);
+ }
+
+ $passwords_helper = new phpbb\passwords\helper;
+ // Set up passwords manager
+ $passwords_manager = new phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, 'passwords.driver.bcrypt_2y');
- $this->provider = new \phpbb\auth\provider\apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx);
+ $this->provider = new \phpbb\auth\provider\apache($db, $config, $passwords_manager, $this->request, $this->user, $phpbb_root_path, $phpEx);
}
public function getDataSet()
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
index 140a28cd3d..74615a01ed 100644
--- a/tests/auth/provider_db_test.php
+++ b/tests/auth/provider_db_test.php
@@ -28,7 +28,24 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
));
$request = $this->getMock('\phpbb\request\request');
$user = $this->getMock('\phpbb\user');
- $provider = new \phpbb\auth\provider\db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
+ $driver_helper = new phpbb\passwords\driver\helper($config);
+ $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),
+ );
+
+ foreach ($passwords_drivers as $key => $driver)
+ {
+ $driver->set_name($key);
+ }
+
+ $passwords_helper = new phpbb\passwords\helper;
+ // Set up passwords manager
+ $passwords_manager = new phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, 'passwords.driver.bcrypt_2y');
+
+ $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx);
$expected = array(
'status' => LOGIN_SUCCESS,