aboutsummaryrefslogtreecommitdiffstats
path: root/tests/security
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2014-02-02 06:26:35 -0800
committerNils Adermann <naderman@naderman.de>2014-02-02 06:26:35 -0800
commitf8d6a07392f73bc7b85418a60047d761661a7657 (patch)
treecfefda4a9dab1019c9e6fad96c8055cec5b03c9e /tests/security
parentcb04252fbd17ac718c09ecc44dab4c7627a98b35 (diff)
parentb094c7999660703370566018bf449a9280148b8d (diff)
downloadforums-f8d6a07392f73bc7b85418a60047d761661a7657.tar
forums-f8d6a07392f73bc7b85418a60047d761661a7657.tar.gz
forums-f8d6a07392f73bc7b85418a60047d761661a7657.tar.bz2
forums-f8d6a07392f73bc7b85418a60047d761661a7657.tar.xz
forums-f8d6a07392f73bc7b85418a60047d761661a7657.zip
Merge pull request #1716 from marc1706/feature/passwords
[feature/passwords] Add password hashing manager with support for newer hashing algorithms
Diffstat (limited to 'tests/security')
-rw-r--r--tests/security/hash_test.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/security/hash_test.php b/tests/security/hash_test.php
index e226365ef3..bc1bebd87a 100644
--- a/tests/security/hash_test.php
+++ b/tests/security/hash_test.php
@@ -11,6 +11,31 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_security_hash_test extends phpbb_test_case
{
+ public function setUp()
+ {
+ global $phpbb_container;
+
+ $config = new \phpbb\config\config(array());
+ $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+ $driver_helper = new \phpbb\passwords\driver\helper($config);
+ $passwords_drivers = array(
+ 'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
+ 'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($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_helper = new \phpbb\passwords\helper;
+ // Set up passwords manager
+ $passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
+
+ $phpbb_container
+ ->expects($this->any())
+ ->method('get')
+ ->with('passwords.manager')
+ ->will($this->returnValue($passwords_manager));
+ }
+
public function test_check_hash_with_phpass()
{
$this->assertTrue(phpbb_check_hash('test', '$H$9isfrtKXWqrz8PvztXlL3.daw4U0zI1'));