diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-10-10 12:01:10 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-10-10 12:01:10 +0200 |
commit | fdf9ae7c18146ce58531bc6bbbb1eff5461691d2 (patch) | |
tree | 09da3943b55ea50009d94c6c8ae7782db805173c /tests/passwords | |
parent | [feature/passwords] Increase test coverage to 35 out ouf 36 methods (diff) | |
download | phpbb-fdf9ae7c18146ce58531bc6bbbb1eff5461691d2.tar.gz phpbb-fdf9ae7c18146ce58531bc6bbbb1eff5461691d2.tar.bz2 phpbb-fdf9ae7c18146ce58531bc6bbbb1eff5461691d2.zip |
[feature/passwords] Increase test coverage to 100% of methods
Obsolete code that is impossible to hit has been removed and the logic
of the salted md5 driver has been changed to correctly implement the
phpBB 3.0 phpbb_hash() function.
PHPBB3-11610
Diffstat (limited to 'tests/passwords')
-rw-r--r-- | tests/passwords/manager_test.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index 568c53be3f..77955bd464 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -149,17 +149,28 @@ class phpbb_passwords_manager_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected, $this->manager->check($password, $hash)); } - public function test_hash_password_length() + public function data_hash_password_length() { - foreach ($this->passwords_drivers as $driver) - { - $this->assertEquals(false, $driver->hash('foobar', 'foobar')); - } + return array( + array('passwords.driver.bcrypt', false), + array('passwords.driver.bcrypt_2y', false), + array('passwords.driver.salted_md5', '3858f62230ac3c915f300c664312c63f'), + array('passwords.driver.phpass', '3858f62230ac3c915f300c664312c63f'), + ); + } + + /** + * @dataProvider data_hash_password_length + */ + public function test_hash_password_length($driver, $expected) + { + $this->assertEquals($expected, $this->passwords_drivers[$driver]->hash('foobar', 'foobar')); } public function test_hash_password_8bit_bcrypt() { $this->assertEquals(false, $this->manager->hash('foobar𝄞', 'passwords.driver.bcrypt')); + $this->assertNotEquals(false, $this->manager->hash('foobar𝄞', 'passwords.driver.bcrypt_2y')); } public function test_combined_hash_data() |