diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-11-01 16:15:25 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-11-16 16:02:44 +0100 |
commit | 0cbe05faadfade06737f3f057fb1b9aa44a78693 (patch) | |
tree | d72f28d1e010f5493edb0d2c3380821443796668 /tests/passwords | |
parent | a00b8c29204e4517ada908cdc0bc6eacf93d7305 (diff) | |
download | forums-0cbe05faadfade06737f3f057fb1b9aa44a78693.tar forums-0cbe05faadfade06737f3f057fb1b9aa44a78693.tar.gz forums-0cbe05faadfade06737f3f057fb1b9aa44a78693.tar.bz2 forums-0cbe05faadfade06737f3f057fb1b9aa44a78693.tar.xz forums-0cbe05faadfade06737f3f057fb1b9aa44a78693.zip |
[ticket/12574] Remove special cases for PHP < 5.3.7
PHPBB3-12574
Diffstat (limited to 'tests/passwords')
-rw-r--r-- | tests/passwords/manager_test.php | 154 |
1 files changed, 47 insertions, 107 deletions
diff --git a/tests/passwords/manager_test.php b/tests/passwords/manager_test.php index dc5c539316..90dbb47f46 100644 --- a/tests/passwords/manager_test.php +++ b/tests/passwords/manager_test.php @@ -51,26 +51,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case public function hash_password_data() { - if (version_compare(PHP_VERSION, '5.3.7', '<')) - { - return array( - array('', '2a', 60), - array('passwords.driver.bcrypt_2y', '2a', 60), - array('passwords.driver.bcrypt', '2a', 60), - array('passwords.driver.salted_md5', 'H', 34), - array('passwords.driver.foobar', '', false), - ); - } - else - { - return array( - array('', '2y', 60), - array('passwords.driver.bcrypt_2y', '2y', 60), - array('passwords.driver.bcrypt', '2a', 60), - array('passwords.driver.salted_md5', 'H', 34), - array('passwords.driver.foobar', '', false), - ); - } + return array( + array('', '2y', 60), + array('passwords.driver.bcrypt_2y', '2y', 60), + array('passwords.driver.bcrypt', '2a', 60), + array('passwords.driver.salted_md5', 'H', 34), + array('passwords.driver.foobar', '', false), + ); } /** @@ -100,23 +87,12 @@ class phpbb_passwords_manager_test extends \phpbb_test_case public function check_password_data() { - if (version_compare(PHP_VERSION, '5.3.7', '<')) - { - return array( - array('passwords.driver.bcrypt'), - array('passwords.driver.salted_md5'), - array('passwords.driver.phpass'), - ); - } - else - { - return array( - array('passwords.driver.bcrypt_2y'), - array('passwords.driver.bcrypt'), - array('passwords.driver.salted_md5'), - array('passwords.driver.phpass'), - ); - } + return array( + array('passwords.driver.bcrypt_2y'), + array('passwords.driver.bcrypt'), + array('passwords.driver.salted_md5'), + array('passwords.driver.phpass'), + ); } /** @@ -136,7 +112,7 @@ class phpbb_passwords_manager_test extends \phpbb_test_case } // Check if convert_flag is correctly set - $default_type = (version_compare(PHP_VERSION, '5.3.7', '<')) ? 'passwords.driver.bcrypt' : 'passwords.driver.bcrypt_2y'; + $default_type = 'passwords.driver.bcrypt_2y'; $this->assertEquals(($hash_type !== $default_type), $this->manager->convert_flag); } @@ -200,79 +176,43 @@ class phpbb_passwords_manager_test extends \phpbb_test_case public function test_hash_password_8bit_bcrypt() { $this->assertEquals(false, $this->manager->hash('foobarš¯„˛', 'passwords.driver.bcrypt')); - if (version_compare(PHP_VERSION, '5.3.7', '<')) - { - $this->assertEquals(false, $this->manager->hash('foobarš¯„˛', 'passwords.driver.bcrypt_2y')); - } - else - { - $this->assertNotEquals(false, $this->manager->hash('foobarš¯„˛', 'passwords.driver.bcrypt_2y')); - } + $this->assertNotEquals(false, $this->manager->hash('foobarš¯„˛', 'passwords.driver.bcrypt_2y')); } public function combined_hash_data() { - if (version_compare(PHP_VERSION, '5.3.7', '<')) - { - return array( - array( - 'passwords.driver.salted_md5', - array('passwords.driver.bcrypt'), - ), - array( - 'passwords.driver.phpass', - array('passwords.driver.salted_md5'), - ), - array( - 'passwords.driver.salted_md5', - array('passwords.driver.phpass', 'passwords.driver.bcrypt'), - ), - array( - 'passwords.driver.salted_md5', - array('passwords.driver.salted_md5'), - false, - ), - array( - '$H$', - array('$2a$'), - ), - ); - } - else - { - return array( - array( - 'passwords.driver.salted_md5', - array('passwords.driver.bcrypt_2y'), - ), - array( - 'passwords.driver.salted_md5', - array('passwords.driver.bcrypt'), - ), - array( - 'passwords.driver.phpass', - array('passwords.driver.salted_md5'), - ), - array( - 'passwords.driver.salted_md5', - array('passwords.driver.bcrypt_2y', 'passwords.driver.bcrypt'), - ), - array( - 'passwords.driver.salted_md5', - array('passwords.driver.salted_md5'), - false, - ), - array( - 'passwords.driver.bcrypt_2y', - array('passwords.driver.salted_md4'), - false, - ), - array( - '$H$', - array('$2y$'), - ), - ); - } + return array( + array( + 'passwords.driver.salted_md5', + array('passwords.driver.bcrypt_2y'), + ), + array( + 'passwords.driver.salted_md5', + array('passwords.driver.bcrypt'), + ), + array( + 'passwords.driver.phpass', + array('passwords.driver.salted_md5'), + ), + array( + 'passwords.driver.salted_md5', + array('passwords.driver.bcrypt_2y', 'passwords.driver.bcrypt'), + ), + array( + 'passwords.driver.salted_md5', + array('passwords.driver.salted_md5'), + false, + ), + array( + 'passwords.driver.bcrypt_2y', + array('passwords.driver.salted_md4'), + false, + ), + array( + '$H$', + array('$2y$'), + ), + ); } /** |