mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16891] Update test files to work with changed cache service
PHPBB3-16891
This commit is contained in:
parent
9dc25510a1
commit
7992b3f476
15 changed files with 36 additions and 21 deletions
|
@ -81,7 +81,8 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
||||||
$config = $this->config;
|
$config = $this->config;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->db = $this->new_dbal();
|
$this->db = $this->new_dbal();
|
||||||
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx);
|
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $this->phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
$this->request = $this->createMock('\phpbb\request\request');
|
$this->request = $this->createMock('\phpbb\request\request');
|
||||||
|
|
||||||
$this->filesystem = new \phpbb\filesystem\filesystem();
|
$this->filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
@ -136,7 +137,6 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
||||||
));
|
));
|
||||||
$this->factory = new \phpbb\files\factory($this->container);
|
$this->factory = new \phpbb\files\factory($this->container);
|
||||||
$this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
$this->files_upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||||
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
|
||||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||||
$this->user->data['user_id'] = ANONYMOUS;
|
$this->user->data['user_id'] = ANONYMOUS;
|
||||||
|
|
||||||
|
|
3
tests/cache/common_test_case.php
vendored
3
tests/cache/common_test_case.php
vendored
|
@ -74,7 +74,8 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
|
||||||
global $db, $cache, $phpbb_root_path, $phpEx;
|
global $db, $cache, $phpbb_root_path, $phpEx;
|
||||||
$config = new phpbb\config\config(array());
|
$config = new phpbb\config\config(array());
|
||||||
$db = $this->new_dbal();
|
$db = $this->new_dbal();
|
||||||
$cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
$sql = "SELECT * FROM phpbb_config
|
$sql = "SELECT * FROM phpbb_config
|
||||||
WHERE config_name = 'foo'";
|
WHERE config_name = 'foo'";
|
||||||
|
|
3
tests/cache/dummy_driver_test.php
vendored
3
tests/cache/dummy_driver_test.php
vendored
|
@ -50,7 +50,8 @@ class phpbb_cache_dummy_driver_test extends phpbb_database_test_case
|
||||||
global $db, $cache, $phpbb_root_path, $phpEx;
|
global $db, $cache, $phpbb_root_path, $phpEx;
|
||||||
$config = new phpbb\config\config(array());
|
$config = new phpbb\config\config(array());
|
||||||
$db = $this->new_dbal();
|
$db = $this->new_dbal();
|
||||||
$cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
$sql = "SELECT * FROM phpbb_config
|
$sql = "SELECT * FROM phpbb_config
|
||||||
WHERE config_name = 'foo'";
|
WHERE config_name = 'foo'";
|
||||||
|
|
|
@ -32,13 +32,13 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
|
||||||
$skip_add_log = true;
|
$skip_add_log = true;
|
||||||
|
|
||||||
$db = $this->db = $this->new_dbal();
|
$db = $this->db = $this->new_dbal();
|
||||||
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
|
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
|
||||||
$lang = new \phpbb\language\language($lang_loader);
|
$lang = new \phpbb\language\language($lang_loader);
|
||||||
$user = $this->user = new \phpbb\user($lang, '\phpbb\datetime');
|
$user = $this->user = new \phpbb\user($lang, '\phpbb\datetime');
|
||||||
|
|
||||||
$cache = new phpbb_mock_cache;
|
$cache = new phpbb_mock_cache;
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
|
||||||
$auth = $this->createMock('\phpbb\auth\auth');
|
$auth = $this->createMock('\phpbb\auth\auth');
|
||||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ class phpbb_dbal_migrator_tool_permission_role_test extends phpbb_database_test_
|
||||||
parent::setup();
|
parent::setup();
|
||||||
|
|
||||||
$db = $this->db = $this->new_dbal();
|
$db = $this->db = $this->new_dbal();
|
||||||
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
$this->auth = new \phpbb\auth\auth();
|
$this->auth = new \phpbb\auth\auth();
|
||||||
|
|
||||||
// Initialize this auth_admin instance later after adding new auth options via this->tool->add()
|
// Initialize this auth_admin instance later after adding new auth options via this->tool->add()
|
||||||
|
|
|
@ -38,7 +38,8 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
|
||||||
parent::setup();
|
parent::setup();
|
||||||
|
|
||||||
$db = $this->db = $this->new_dbal();
|
$db = $this->db = $this->new_dbal();
|
||||||
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
$cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), new \phpbb\config\config(array()), $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx);
|
||||||
$this->auth = new \phpbb\auth\auth();
|
$this->auth = new \phpbb\auth\auth();
|
||||||
|
|
||||||
$this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
|
$this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
|
||||||
|
|
|
@ -155,6 +155,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||||
{
|
{
|
||||||
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
|
$config = new \phpbb\config\config(array('version' => PHPBB_VERSION));
|
||||||
$db = $this->new_dbal();
|
$db = $this->new_dbal();
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$factory = new \phpbb\db\tools\factory();
|
$factory = new \phpbb\db\tools\factory();
|
||||||
$db_tools = $factory->get($db);
|
$db_tools = $factory->get($db);
|
||||||
$phpbb_root_path = __DIR__ . './../../phpBB/';
|
$phpbb_root_path = __DIR__ . './../../phpBB/';
|
||||||
|
@ -185,7 +186,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
|
||||||
'phpbb_ext',
|
'phpbb_ext',
|
||||||
__DIR__ . '/',
|
__DIR__ . '/',
|
||||||
$php_ext,
|
$php_ext,
|
||||||
($with_cache) ? new \phpbb\cache\service(new phpbb_mock_cache(), $config, $db, $phpbb_root_path, $php_ext) : null
|
($with_cache) ? new \phpbb\cache\service(new phpbb_mock_cache(), $config, $db, $phpbb_dispatcher, $phpbb_root_path, $php_ext) : null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,13 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
'version' => '3.1.0',
|
'version' => '3.1.0',
|
||||||
));
|
));
|
||||||
$this->db = $this->new_dbal();
|
$this->db = $this->new_dbal();
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$factory = new \phpbb\db\tools\factory();
|
$factory = new \phpbb\db\tools\factory();
|
||||||
$this->db_tools = $factory->get($this->db);
|
$this->db_tools = $factory->get($this->db);
|
||||||
$this->phpbb_root_path = __DIR__ . '/';
|
$this->phpbb_root_path = __DIR__ . '/';
|
||||||
$this->phpEx = 'php';
|
$this->phpEx = 'php';
|
||||||
|
|
||||||
$this->cache = new \phpbb\cache\service(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx);
|
$this->cache = new \phpbb\cache\service(new phpbb_mock_cache(), $this->config, $this->db, $phpbb_dispatcher, $this->phpbb_root_path, $this->phpEx);
|
||||||
|
|
||||||
$this->table_prefix = 'phpbb_';
|
$this->table_prefix = 'phpbb_';
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
||||||
$cache_path,
|
$cache_path,
|
||||||
null,
|
null,
|
||||||
$loader,
|
$loader,
|
||||||
new \phpbb\event\dispatcher($container),
|
$phpbb_dispatcher,
|
||||||
array(
|
array(
|
||||||
'cache' => false,
|
'cache' => false,
|
||||||
'debug' => false,
|
'debug' => false,
|
||||||
|
|
|
@ -79,17 +79,17 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
||||||
$auth = $this->auth = new phpbb_mock_notifications_auth();
|
$auth = $this->auth = new phpbb_mock_notifications_auth();
|
||||||
|
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$cache_driver = new \phpbb\cache\driver\dummy();
|
$cache_driver = new \phpbb\cache\driver\dummy();
|
||||||
$cache = $this->cache = new \phpbb\cache\service(
|
$cache = $this->cache = new \phpbb\cache\service(
|
||||||
$cache_driver,
|
$cache_driver,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->db,
|
$this->db,
|
||||||
|
$this->phpbb_dispatcher,
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
|
||||||
|
|
||||||
$phpbb_container = $this->container = new ContainerBuilder();
|
$phpbb_container = $this->container = new ContainerBuilder();
|
||||||
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures'));
|
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures'));
|
||||||
$loader->load('services_notification.yml');
|
$loader->load('services_notification.yml');
|
||||||
|
|
|
@ -58,17 +58,17 @@ class notification_method_email_test extends phpbb_tests_notification_base
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
$this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
|
||||||
$auth = $this->auth = new phpbb_mock_notifications_auth();
|
$auth = $this->auth = new phpbb_mock_notifications_auth();
|
||||||
|
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$cache_driver = new \phpbb\cache\driver\dummy();
|
$cache_driver = new \phpbb\cache\driver\dummy();
|
||||||
$cache = $this->cache = new \phpbb\cache\service(
|
$cache = $this->cache = new \phpbb\cache\service(
|
||||||
$cache_driver,
|
$cache_driver,
|
||||||
$this->config,
|
$this->config,
|
||||||
$this->db,
|
$this->db,
|
||||||
|
$this->phpbb_dispatcher,
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
|
||||||
|
|
||||||
$phpbb_container = $this->container = new ContainerBuilder();
|
$phpbb_container = $this->container = new ContainerBuilder();
|
||||||
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures'));
|
$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__ . '/fixtures'));
|
||||||
$loader->load('services_notification.yml');
|
$loader->load('services_notification.yml');
|
||||||
|
|
|
@ -79,18 +79,19 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
||||||
'allow_board_notifications' => true,
|
'allow_board_notifications' => true,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Event dispatcher
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
|
||||||
$cache_driver = new \phpbb\cache\driver\dummy();
|
$cache_driver = new \phpbb\cache\driver\dummy();
|
||||||
$cache = new \phpbb\cache\service(
|
$cache = new \phpbb\cache\service(
|
||||||
$cache_driver,
|
$cache_driver,
|
||||||
$config,
|
$config,
|
||||||
$db,
|
$db,
|
||||||
|
$phpbb_dispatcher,
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
// Event dispatcher
|
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
$lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
$lang = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
|
||||||
new \phpbb\cache\driver\dummy(),
|
new \phpbb\cache\driver\dummy(),
|
||||||
$config,
|
$config,
|
||||||
$db,
|
$db,
|
||||||
|
$phpbb_dispatcher,
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
|
@ -58,6 +58,10 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||||
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
$phpbb_filesystem = new \phpbb\filesystem\filesystem();
|
||||||
|
|
||||||
$this->backup_cache = $cache;
|
$this->backup_cache = $cache;
|
||||||
|
|
||||||
|
// Event dispatcher
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
|
|
||||||
// Change the global cache object for this test because
|
// Change the global cache object for this test because
|
||||||
// the mock cache object does not hit the database as is needed
|
// the mock cache object does not hit the database as is needed
|
||||||
// for this test.
|
// for this test.
|
||||||
|
@ -65,6 +69,7 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
|
||||||
new \phpbb\cache\driver\file(),
|
new \phpbb\cache\driver\file(),
|
||||||
$config,
|
$config,
|
||||||
$this->db,
|
$this->db,
|
||||||
|
$phpbb_dispatcher,
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
|
@ -253,8 +253,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
array(),
|
array(),
|
||||||
new \phpbb\db\migration\helper()
|
new \phpbb\db\migration\helper()
|
||||||
);
|
);
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$container->set('migrator', $migrator);
|
$container->set('migrator', $migrator);
|
||||||
$container->set('dispatcher', new phpbb_mock_event_dispatcher());
|
$container->set('dispatcher', $phpbb_dispatcher);
|
||||||
|
|
||||||
$extension_manager = new \phpbb\extension\manager(
|
$extension_manager = new \phpbb\extension\manager(
|
||||||
$container,
|
$container,
|
||||||
|
@ -264,7 +265,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||||
self::$config['table_prefix'] . 'ext',
|
self::$config['table_prefix'] . 'ext',
|
||||||
__DIR__ . '/',
|
__DIR__ . '/',
|
||||||
$phpEx,
|
$phpEx,
|
||||||
new \phpbb\cache\service($this->get_cache_driver(), $config, $this->db, $phpbb_root_path, $phpEx)
|
new \phpbb\cache\service($this->get_cache_driver(), $config, $this->db, $phpbb_dispatcher, $phpbb_root_path, $phpEx)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $extension_manager;
|
return $extension_manager;
|
||||||
|
|
|
@ -29,10 +29,11 @@ class version_helper_remote_test extends \phpbb_test_case
|
||||||
'version' => '3.1.0',
|
'version' => '3.1.0',
|
||||||
));
|
));
|
||||||
$container = new \phpbb_mock_container_builder();
|
$container = new \phpbb_mock_container_builder();
|
||||||
|
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||||
$db = new \phpbb\db\driver\factory($container);
|
$db = new \phpbb\db\driver\factory($container);
|
||||||
$this->cache = $this->getMockBuilder('\phpbb\cache\service')
|
$this->cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||||
->setMethods(array('get'))
|
->setMethods(array('get'))
|
||||||
->setConstructorArgs(array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php'))
|
->setConstructorArgs(array(new \phpbb\cache\driver\dummy(), $config, $db, $phpbb_dispatcher, '../../', 'php'))
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$this->cache->expects($this->any())
|
$this->cache->expects($this->any())
|
||||||
|
|
Loading…
Add table
Reference in a new issue