aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auth/provider_db_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auth/provider_db_test.php')
-rw-r--r--tests/auth/provider_db_test.php37
1 files changed, 17 insertions, 20 deletions
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
index 6ff77da564..8305e7caa4 100644
--- a/tests/auth/provider_db_test.php
+++ b/tests/auth/provider_db_test.php
@@ -15,14 +15,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
{
public function getDataSet()
{
- if ((version_compare(PHP_VERSION, '5.3.7', '<')))
- {
- return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user_533.xml');
- }
- else
- {
- return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
- }
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/user.xml');
}
public function test_login()
@@ -37,7 +30,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
));
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
- $request = $this->getMock('\phpbb\request\request');
+ $request = $this->createMock('\phpbb\request\request');
$user = new \phpbb\user($lang, '\phpbb\datetime');
$driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array(
@@ -52,16 +45,21 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
$passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
$phpbb_container = new phpbb_mock_container_builder();
+ $plugins = new \phpbb\di\service_collection($phpbb_container);
+ $plugins->add('core.captcha.plugins.nogd');
+ $phpbb_container->set(
+ 'captcha.factory',
+ new \phpbb\captcha\factory($phpbb_container, $plugins)
+ );
+ $phpbb_container->set(
+ 'core.captcha.plugins.nogd',
+ new \phpbb\captcha\plugins\nogd()
+ );
+ /** @var \phpbb\captcha\factory $captcha_factory */
+ $captcha_factory = $phpbb_container->get('captcha.factory');
- $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_container, $phpbb_root_path, $phpEx);
- if (version_compare(PHP_VERSION, '5.3.7', '<'))
- {
- $password_hash = '$2a$10$e01Syh9PbJjUkio66eFuUu4FhCE2nRgG7QPc1JACalsPXcIuG2bbi';
- }
- else
- {
- $password_hash = '$2y$10$4RmpyVu2y8Yf/lP3.yQBquKvE54TCUuEDEBJYY6FDDFN3LcbCGz9i';
- }
+ $provider = new \phpbb\auth\provider\db($captcha_factory, $config, $db, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx);
+ $password_hash = '$2y$10$4RmpyVu2y8Yf/lP3.yQBquKvE54TCUuEDEBJYY6FDDFN3LcbCGz9i';
$expected = array(
'status' => LOGIN_SUCCESS,
@@ -88,7 +86,6 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
// Check if convert works
$login_return = $provider->login('foobar2', 'example');
- $password_start = (version_compare(PHP_VERSION, '5.3.7', '<')) ? '$2a$10$' : '$2y$10$';
- $this->assertStringStartsWith($password_start, $login_return['user_row']['user_password']);
+ $this->assertStringStartsWith('$2y$10$', $login_return['user_row']['user_password']);
}
}