From 2472271bc0cd7c15c77783c86ccaac643ab1756a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 02:41:03 +0200 Subject: [ticket/11700] Fix tests after merging new develop code PHPBB3-11700 --- phpBB/install/index.php | 9 ---- phpBB/phpbb/auth/provider/oauth/oauth.php | 54 +++++++++++----------- phpBB/phpbb/auth/provider/oauth/service/bitly.php | 18 ++++---- phpBB/phpbb/auth/provider/oauth/token_storage.php | 14 +++--- phpBB/phpbb/cache/driver/file.php | 6 +-- phpBB/phpbb/log/null.php | 4 +- phpBB/phpbb/notification/type/group_request.php | 4 +- .../notification/type/group_request_approved.php | 4 +- phpBB/phpbb/template/base.php | 6 ++- phpBB/phpbb/template/twig/loader.php | 4 +- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/node/includecss.php | 2 +- phpBB/phpbb/template/twig/node/includejs.php | 2 +- tests/auth/provider_oauth_token_storage_test.php | 10 ++-- tests/mock/auth_provider.php | 2 +- tests/notification/base.php | 12 ++--- tests/notification/group_request_test.php | 6 +-- tests/session/check_ban_test.php | 4 +- tests/session/testable_facade.php | 24 +++++----- tests/template/template_test_case_with_tree.php | 2 +- 20 files changed, 98 insertions(+), 91 deletions(-) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 90d840aa31..e94c393922 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -244,20 +244,11 @@ $config = new \phpbb\config\config(array( 'load_tplcompile' => '1' )); -<<<<<<< HEAD -$phpbb_style_resource_locator = new \phpbb\style\resource_locator(); -$phpbb_style_path_provider = new \phpbb\style\path_provider(); $template = new \phpbb\template\twig\twig($phpbb_root_path, $phpEx, $config, $user, new \phpbb\template\context()); -$phpbb_style = new \phpbb\style\style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template); -$phpbb_style->set_ext_dir_prefix('adm/'); -$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); -======= -$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); $template->set_custom_style('adm', $paths); ->>>>>>> github-phpbb/develop $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index be0b8bb7d6..e92462b344 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth; + /** * @ignore */ @@ -23,33 +25,33 @@ use OAuth\Common\Http\Uri\Uri; * * @package auth */ -class phpbb_auth_provider_oauth extends phpbb_auth_provider_base +class oauth extends \phpbb\auth\provider\base { /** * Database driver * - * @var phpbb_db_driver + * @var \phpbb\db\driver */ protected $db; /** * phpBB config * - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * phpBB request object * - * @var phpbb_request + * @var \phpbb\request\request_interface */ protected $request; /** * phpBB user * - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -70,7 +72,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * All OAuth service providers * - * @var phpbb_di_service_collection Contains phpbb_auth_provider_oauth_service_interface + * @var \phpbb\di\service_collection Contains \phpbb\auth\provider\oauth\service_interface */ protected $service_providers; @@ -105,18 +107,18 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * OAuth Authentication Constructor * - * @param phpbb_db_driver $db - * @param phpbb_config $config - * @param phpbb_request $request - * @param phpbb_user $user + * @param \phpbb\db\driver $db + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + * @param \phpbb\user $user * @param string $auth_provider_oauth_token_storage_table * @param string $auth_provider_oauth_token_account_assoc - * @param phpbb_di_service_collection $service_providers Contains phpbb_auth_provider_oauth_service_interface + * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, phpbb_di_service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -156,7 +158,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Temporary workaround for only having one authentication provider available if (!$this->request->is_set('oauth_service')) { - $provider = new phpbb_auth_provider_db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext); + $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext); return $provider->login($username, $password); } @@ -175,11 +177,11 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Get the service credentials for the given service $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $query = 'mode=login&login=external&oauth_service=' . $service_name_original; $service = $this->get_service($service_name_original, $storage, $service_credentials, $this->service_providers[$service_name]->get_auth_scope(), $query); - if ($this->request->is_set('code', phpbb_request_interface::GET)) + if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -258,7 +260,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base } $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); - $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(phpbb_request_interface::SERVER)); + $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER)); $current_uri->setQuery($query); $this->current_uri = $current_uri; @@ -269,15 +271,15 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base * Returns a new service object * * @param string $service_name The name of the service - * @param phpbb_auth_oauth_token_storage $storage - * @param array $service_credentials {@see phpbb_auth_provider_oauth::get_service_credentials} + * @param \phpbb\auth\provider\oauth\token_storage $storage + * @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials} * @param array $scope The scope of the request against * the api. * @param string $query The query string of the * current_uri used in redirection * @return \OAuth\Common\Service\ServiceInterface */ - protected function get_service($service_name, phpbb_auth_provider_oauth_token_storage $storage, array $service_credentials, array $scopes = array(), $query) + protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, array $scopes = array(), $query) { $current_uri = $this->get_current_uri($service_name, $query); @@ -434,7 +436,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * Performs the account linking for login_link * - * @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account} + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} * @param string $service_name The name of the service being used in * linking. * @return string|null Returns a language constant (string) if an error is @@ -442,7 +444,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base */ protected function link_account_login_link(array $link_data, $service_name) { - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); // Check for an access token, they should have one if (!$storage->has_access_token_by_session($service_name)) @@ -477,7 +479,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base /** * Performs the account linking for auth_link * - * @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account} + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} * @param string $service_name The name of the service being used in * linking. * @return string|null Returns a language constant (string) if an error is @@ -485,13 +487,13 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base */ protected function link_account_auth_link(array $link_data, $service_name) { - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']); $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); $scopes = $this->service_providers[$service_name]->get_auth_scope(); $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query); - if ($this->request->is_set('code', phpbb_request_interface::GET)) + if ($this->request->is_set('code', \phpbb\request\request_interface::GET)) { $this->service_providers[$service_name]->set_external_service_provider($service); $unique_id = $this->service_providers[$service_name]->perform_auth_login(); @@ -530,7 +532,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base public function logout($data, $new_session) { // Clear all tokens belonging to the user - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $storage->clearAllTokens(); return; @@ -610,7 +612,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base // Clear all tokens belonging to the user on this servce $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']); - $storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table); $storage->clearToken($service_name); return; diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php index 3bafdd59ce..47cf7ee380 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth\service; + /** * @ignore */ @@ -20,29 +22,29 @@ if (!defined('IN_PHPBB')) * * @package auth */ -class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_service_base +class bitly extends \phpbb\auth\provider\oauth\service\base { /** * phpBB config * - * @var phpbb_config + * @var \phpbb\config\config */ protected $config; /** * phpBB request * - * @var phpbb_request + * @var \phpbb\request\request_interface */ protected $request; /** * Constructor * - * @param phpbb_config $config - * @param phpbb_request $request + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request */ - public function __construct(phpbb_config $config, phpbb_request $request) + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) { $this->config = $config; $this->request = $request; @@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // This was a callback request from bitly, get the token @@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ { if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) { - throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); } // Send a request with it diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php index d21deb8999..2ce0e32da3 100644 --- a/phpBB/phpbb/auth/provider/oauth/token_storage.php +++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\auth\provider\oauth; + /** * @ignore */ @@ -27,19 +29,19 @@ use OAuth\Common\Storage\Exception\TokenNotFoundException; * * @package auth */ -class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface +class token_storage implements TokenStorageInterface { /** * Cache driver. * - * @var phpbb_db_driver + * @var \phpbb\db\driver\driver */ protected $db; /** * phpBB user * - * @var phpbb_user + * @var \phpbb\user */ protected $user; @@ -58,11 +60,11 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface /** * Creates token storage for phpBB. * - * @param phpbb_db_driver $db - * @param phpbb_user $user + * @param \phpbb\db\driver\driver $db + * @param \phpbb\user $user * @param string $auth_provider_oauth_table */ - public function __construct(phpbb_db_driver $db, phpbb_user $user, $auth_provider_oauth_table) + public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table) { $this->db = $db; $this->user = $user; diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index 36525e7f55..6e63b6a716 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -207,9 +207,9 @@ class file extends \phpbb\cache\driver\base function purge() { // Purge all phpbb cache files - try + try { - $iterator = new DirectoryIterator($this->cache_dir); + $iterator = new \DirectoryIterator($this->cache_dir); } catch (Exception $e) { @@ -258,7 +258,7 @@ class file extends \phpbb\cache\driver\base */ protected function remove_dir($dir) { - try + try { $iterator = new DirectoryIterator($dir); } diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/null.php index 14b5f65eec..2ef69926ee 100644 --- a/phpBB/phpbb/log/null.php +++ b/phpBB/phpbb/log/null.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\log; + /** * @ignore */ @@ -20,7 +22,7 @@ if (!defined('IN_PHPBB')) * * @package phpbb_log */ -class phpbb_log_null implements phpbb_log_interface +class null implements log_interface { /** * {@inheritdoc} diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php index 1a3b5b6992..1768a8fffa 100644 --- a/phpBB/phpbb/notification/type/group_request.php +++ b/phpBB/phpbb/notification/type/group_request.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\notification\type; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_notification_type_group_request extends phpbb_notification_type_base +class group_request extends \phpbb\notification\type\base { /** * {@inheritdoc} diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php index ce83329ff3..be4a902acd 100644 --- a/phpBB/phpbb/notification/type/group_request_approved.php +++ b/phpBB/phpbb/notification/type/group_request_approved.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\notification\type; + /** * @ignore */ @@ -15,7 +17,7 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_notification_type_group_request_approved extends phpbb_notification_type_base +class group_request_approved extends \phpbb\notification\type\base { /** * {@inheritdoc} diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 3778424a96..86868707f0 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template; + /** * @ignore */ @@ -15,13 +17,13 @@ if (!defined('IN_PHPBB')) exit; } -abstract class phpbb_template_base implements phpbb_template +abstract class base implements template { /** * Template context. * Stores template data used during template rendering. * - * @var phpbb_template_context + * @var \phpbb\template\context */ protected $context; diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 0829e519f7..910061dc0f 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\template\twig; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Twig Template loader * @package phpBB3 */ -class phpbb_template_twig_loader extends Twig_Loader_Filesystem +class loader extends \Twig_Loader_Filesystem { protected $safe_directories = array(); diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index d632469c9e..eeedeb31f0 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -73,5 +73,5 @@ abstract class includeasset extends \Twig_Node * @param Twig_Compiler A Twig_Compiler instance * @return null */ - abstract protected function append_asset(Twig_Compiler $compiler); + abstract protected function append_asset(\Twig_Compiler $compiler); } diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php index 9601cc5155..deb279fa4a 100644 --- a/phpBB/phpbb/template/twig/node/includecss.php +++ b/phpBB/phpbb/template/twig/node/includecss.php @@ -22,7 +22,7 @@ class includecss extends \phpbb\template\twig\node\includeasset /** * {@inheritdoc} */ - public function append_asset(Twig_Compiler $compiler) + public function append_asset(\Twig_Compiler $compiler) { $compiler ->raw("environment->get_phpbb_config(); diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php index 401f049405..fdc08833a3 100644 --- a/tests/auth/provider_oauth_token_storage_test.php +++ b/tests/auth/provider_oauth_token_storage_test.php @@ -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); diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php index a576ef6b67..734e682ee9 100644 --- a/tests/mock/auth_provider.php +++ b/tests/mock/auth_provider.php @@ -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) { diff --git a/tests/notification/base.php b/tests/notification/base.php index 8de162a1fb..549545f01b 100644 --- a/tests/notification/base.php +++ b/tests/notification/base.php @@ -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); diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php index 368e4ae973..b812fff8f8 100644 --- a/tests/notification/group_request_test.php +++ b/tests/notification/group_request_test.php @@ -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 diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php index 8d6c9a866d..3f13b9f216 100644 --- a/tests/session/check_ban_test.php +++ b/tests/session/check_ban_test.php @@ -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, diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php index 9f0a3c5f59..f289c48f69 100644 --- a/tests/session/testable_facade.php +++ b/tests/session/testable_facade.php @@ -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); } } diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php index 461534a49d..438aa66471 100644 --- a/tests/template/template_test_case_with_tree.php +++ b/tests/template/template_test_case_with_tree.php @@ -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)); } } -- cgit v1.2.1