mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 08:47:45 +02:00
[ticket/11700] Fix tests after merging new develop code
PHPBB3-11700
This commit is contained in:
@@ -25,7 +25,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$this->user = $this->getMock('phpbb_user');
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->service_name = 'auth.provider.oauth.service.testing';
|
||||
$this->token_storage_table = 'phpbb_oauth_tokens';
|
||||
|
||||
@@ -36,7 +36,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
// Set the user id to anonymous
|
||||
$this->user->data['user_id'] = ANONYMOUS;
|
||||
|
||||
$this->token_storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
$this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
}
|
||||
|
||||
public function getDataSet()
|
||||
@@ -74,7 +74,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
$expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
|
||||
|
||||
// Store a token in the database
|
||||
$temp_storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
$temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
$temp_storage->storeAccessToken($this->service_name, $expected_token);
|
||||
unset($temp_storage);
|
||||
|
||||
@@ -105,7 +105,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
$expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
|
||||
|
||||
// Store a token in the database
|
||||
$temp_storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
$temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
|
||||
$temp_storage->storeAccessToken($this->service_name, $expected_token);
|
||||
unset($temp_storage);
|
||||
|
||||
@@ -196,7 +196,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
|
||||
protected function get_token_row_by_session_id($session_id)
|
||||
{
|
||||
// Test that the token is stored in the database
|
||||
$sql = 'SELECT * FROM phpbb_oauth_tokens
|
||||
$sql = 'SELECT * FROM phpbb_oauth_tokens
|
||||
WHERE session_id = \'' . $this->db->sql_escape($session_id) . '\'';
|
||||
$result = $this->db->sql_query($sql);
|
||||
$row = $this->db->sql_fetchrow($result);
|
||||
|
@@ -10,7 +10,7 @@
|
||||
/**
|
||||
* Mock auth provider class with basic functions to help test sessions.
|
||||
*/
|
||||
class phpbb_mock_auth_provider extends phpbb_auth_provider_base
|
||||
class phpbb_mock_auth_provider extends \phpbb\auth\provider\base
|
||||
{
|
||||
public function login($username, $password)
|
||||
{
|
||||
|
@@ -46,17 +46,17 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
global $db, $config, $user, $auth, $cache, $phpbb_container;
|
||||
|
||||
$db = $this->db = $this->new_dbal();
|
||||
$config = $this->config = new phpbb_config(array(
|
||||
$config = $this->config = new \phpbb\config\config(array(
|
||||
'allow_privmsg' => true,
|
||||
'allow_bookmarks' => true,
|
||||
'allow_topic_notify' => true,
|
||||
'allow_forum_notify' => true,
|
||||
));
|
||||
$user = $this->user = new phpbb_user();
|
||||
$this->user_loader = new phpbb_user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
||||
$user = $this->user = new \phpbb\user();
|
||||
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
||||
$auth = $this->auth = new phpbb_mock_notifications_auth();
|
||||
$cache = $this->cache = new phpbb_cache_service(
|
||||
new phpbb_cache_driver_null(),
|
||||
$cache = $this->cache = new \phpbb\cache\service(
|
||||
new \phpbb\cache\driver\null(),
|
||||
$this->config,
|
||||
$this->db,
|
||||
$phpbb_root_path,
|
||||
@@ -87,7 +87,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||
$types = array();
|
||||
foreach ($this->get_notification_types() as $type)
|
||||
{
|
||||
$class = $this->build_type('phpbb_notification_type_' . $type);
|
||||
$class = $this->build_type('phpbb\notification\type\\' . $type);
|
||||
|
||||
$types[$type] = $class;
|
||||
$this->container->set('notification.type.' . $type, $class);
|
||||
|
@@ -37,17 +37,17 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
|
||||
|
||||
set_config(false, false, false, $this->config);
|
||||
|
||||
$this->container->set('groupposition.legend', new phpbb_groupposition_legend(
|
||||
$this->container->set('groupposition.legend', new \phpbb\groupposition\legend(
|
||||
$this->db,
|
||||
$this->user
|
||||
));
|
||||
$this->container->set('groupposition.teampage', new phpbb_groupposition_teampage(
|
||||
$this->container->set('groupposition.teampage', new \phpbb\groupposition\teampage(
|
||||
$this->db,
|
||||
$this->user,
|
||||
$this->cache->get_driver()
|
||||
));
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
||||
$phpbb_log = new phpbb_log_null();
|
||||
$phpbb_log = new \phpbb\log\null();
|
||||
|
||||
// Now on to the actual test
|
||||
|
||||
|
@@ -43,8 +43,8 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||
// Change the global cache object for this test because
|
||||
// the mock cache object does not hit the database as is needed
|
||||
// for this test.
|
||||
$cache = new phpbb_cache_service(
|
||||
new phpbb_cache_driver_file(),
|
||||
$cache = new \phpbb\cache\service(
|
||||
new \phpbb\cache\driver\file(),
|
||||
$config,
|
||||
$this->db,
|
||||
$phpbb_root_path,
|
||||
|
@@ -14,11 +14,11 @@ require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php';
|
||||
* This class exists to expose session.php's functions in a more testable way.
|
||||
*
|
||||
* Since many functions in session.php have global variables inside the function,
|
||||
* this exposes those functions through a testable facade that uses
|
||||
* testable_factory's mock global variables to modify global variables used in
|
||||
* this exposes those functions through a testable facade that uses
|
||||
* testable_factory's mock global variables to modify global variables used in
|
||||
* the functions.
|
||||
*
|
||||
* This is using the facade pattern to provide a testable "front" to the
|
||||
* This is using the facade pattern to provide a testable "front" to the
|
||||
* functions in sessions.php.
|
||||
*
|
||||
*/
|
||||
@@ -35,17 +35,17 @@ class phpbb_session_testable_facade
|
||||
|
||||
function extract_current_page(
|
||||
$root_path,
|
||||
$php_self,
|
||||
$php_self,
|
||||
$query_string,
|
||||
$request_uri
|
||||
)
|
||||
)
|
||||
{
|
||||
$this->session_factory->get_session($this->db);
|
||||
global $request;
|
||||
$request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER);
|
||||
$request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER);
|
||||
$request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER);
|
||||
return phpbb_session::extract_current_page($root_path);
|
||||
$request->overwrite('PHP_SELF', $php_self, \phpbb\request\request_interface::SERVER);
|
||||
$request->overwrite('QUERY_STRING', $query_string, \phpbb\request\request_interface::SERVER);
|
||||
$request->overwrite('REQUEST_URI', $request_uri, \phpbb\request\request_interface::SERVER);
|
||||
return \phpbb\session::extract_current_page($root_path);
|
||||
}
|
||||
|
||||
function extract_current_hostname(
|
||||
@@ -58,8 +58,8 @@ class phpbb_session_testable_facade
|
||||
global $config, $request;
|
||||
$config['server_name'] = $server_name_config;
|
||||
$config['cookie_domain'] = $cookie_domain_config;
|
||||
$request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER);
|
||||
$request->overwrite('Host', $host, phpbb_request_interface::SERVER);
|
||||
$request->overwrite('SERVER_NAME', $host, \phpbb\request\request_interface::SERVER);
|
||||
$request->overwrite('Host', $host, \phpbb\request\request_interface::SERVER);
|
||||
// Note: There is a php_uname function used as a fallthrough
|
||||
// that this function doesn't override
|
||||
return $session->extract_current_hostname();
|
||||
@@ -135,7 +135,7 @@ class phpbb_session_testable_facade
|
||||
$session->host = $host;
|
||||
$config['force_server_vars'] = $force_server_vars;
|
||||
$config['server_name'] = $server_name;
|
||||
$request->overwrite('SERVER_PORT', $server_port, phpbb_request_interface::SERVER);
|
||||
$request->overwrite('SERVER_PORT', $server_port, \phpbb\request\request_interface::SERVER);
|
||||
return $session->validate_referer($check_script_path);
|
||||
}
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
||||
|
||||
$this->template_path = $this->test_path . '/templates';
|
||||
$this->parent_template_path = $this->test_path . '/parent_templates';
|
||||
$this->template = new \phpbb\template\twig($phpbb_root_path, $phpEx, $config, $user, new \phpbb\template\context());
|
||||
$this->template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $user, new \phpbb\template\context());
|
||||
$this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user