mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16346] Fix method arguments
PHPBB3-16346
This commit is contained in:
parent
758c28ca69
commit
490ddbc2cd
46 changed files with 78 additions and 144 deletions
|
@ -35,7 +35,7 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
|
|||
$phpbb_container = new phpbb_mock_container_builder();
|
||||
|
||||
$phpbb_container->set('auth.provider_collection', array(
|
||||
'auth.provider.acp_board_valid' => new phpbb\auth\provider\acp\board_valid('', ''),
|
||||
'auth.provider.acp_board_valid' => new phpbb\auth\provider\acp\board_valid,
|
||||
'auth.provider.acp_board_invalid' => new phpbb\auth\provider\acp\board_invalid,
|
||||
));
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ class phpbb_attachment_delete_test extends \phpbb_database_test_case
|
|||
*/
|
||||
public function test_attachment_delete_success($remove_success, $exists_success, $expected, $throw_exception = false)
|
||||
{
|
||||
$this->storage = $this->createMock('\phpbb\storage\storage', array('delete', 'exists'));
|
||||
$this->storage = $this->createMock('\phpbb\storage\storage');
|
||||
if ($throw_exception)
|
||||
{
|
||||
$this->storage->expects($this->any())
|
||||
|
|
|
@ -119,7 +119,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
|||
$this->mimetype_guesser
|
||||
));
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec_storage', new \phpbb\files\filespec_storage(
|
||||
$this->language,
|
||||
new \FastImageSize\FastImageSize(),
|
||||
|
@ -140,7 +140,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
|
|||
$this->request
|
||||
));
|
||||
$this->factory = new \phpbb\files\factory($this->container);
|
||||
$this->files_upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $phpbb_root_path);
|
||||
$this->files_upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$this->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$this->temp = new \phpbb\filesystem\temp($this->filesystem, '');
|
||||
$this->user = new \phpbb\user($this->language, '\phpbb\datetime');
|
||||
|
|
7
tests/console/cache/purge_test.php
vendored
7
tests/console/cache/purge_test.php
vendored
|
@ -28,8 +28,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->cache_dir = dirname(__FILE__) . '/tmp/cache/';
|
||||
|
||||
if (file_exists($this->cache_dir))
|
||||
|
@ -45,10 +43,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
|
|||
$this->db = $this->createMock('\phpbb\db\driver\driver_interface');
|
||||
|
||||
$this->config = new \phpbb\config\config(array('assets_version' => 1));
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime')
|
||||
);
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
}
|
||||
|
||||
public function test_purge()
|
||||
|
|
|
@ -26,10 +26,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime')
|
||||
);
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,10 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
|||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
$config = $this->config = new \phpbb\config\config(array('cron_lock' => '0'));
|
||||
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
|
||||
$this->task = new phpbb_cron_task_simple();
|
||||
|
|
|
@ -50,14 +50,11 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
|
|||
));
|
||||
|
||||
$this->db = $this->db = $this->new_dbal();
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime')
|
||||
);
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
$this->phpEx = $phpEx;
|
||||
|
||||
$this->cache = $this->createMock('\phpbb\cache\service', array(), array(new phpbb_mock_cache(), $this->config, $this->db, $this->phpbb_root_path, $this->phpEx));
|
||||
$this->cache = $this->createMock('\phpbb\cache\service');
|
||||
$this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array(
|
||||
'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE),
|
||||
'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE),
|
||||
|
|
|
@ -84,10 +84,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
|
||||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
$this->language,
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$user->method('lang')->will($this->returnArgument(0));
|
||||
|
||||
$cache = $this->getMockBuilder('\phpbb\cache\service')
|
||||
|
|
|
@ -62,10 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
|
|||
$this->language->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnArgument(0));
|
||||
$user = $this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
$this->language,
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->user = $this->createMock('\phpbb\user');
|
||||
|
||||
$this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
@ -151,7 +151,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
|
||||
);
|
||||
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager);
|
||||
$this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
|
||||
$this->router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
|
||||
$this->auth = new \phpbb\auth\auth();
|
||||
$this->cache = new \phpbb\cache\driver\dummy();
|
||||
$this->db = $this->new_dbal();
|
||||
|
|
|
@ -48,7 +48,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
|
|||
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
|
||||
);
|
||||
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager);
|
||||
$router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
|
||||
$router = new phpbb_mock_router($container, $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
|
||||
$routes = $router->get_routes();
|
||||
|
||||
// This will need to be updated if any new routes are defined
|
||||
|
|
|
@ -73,7 +73,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
|
|||
$cache_path,
|
||||
null,
|
||||
new \phpbb\template\twig\loader(''),
|
||||
new \phpbb\event\dispatcher($phpbb_container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -15,7 +15,7 @@ class phpbb_event_dispatcher_test extends phpbb_test_case
|
|||
{
|
||||
public function test_trigger_event()
|
||||
{
|
||||
$dispatcher = new \phpbb\event\dispatcher(new phpbb_mock_container_builder());
|
||||
$dispatcher = new \phpbb\event\dispatcher();
|
||||
|
||||
$dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) {
|
||||
$event['foo'] = $event['foo'] . '2';
|
||||
|
|
|
@ -28,7 +28,7 @@ class phpbb_event_export_php_test extends phpbb_test_case
|
|||
{
|
||||
global $phpbb_root_path;
|
||||
$exporter = new \phpbb\event\php_exporter($phpbb_root_path);
|
||||
$files = $exporter->get_recursive_file_list($phpbb_root_path);
|
||||
$files = $exporter->get_recursive_file_list();
|
||||
|
||||
$data_provider = array();
|
||||
foreach ($files as $file)
|
||||
|
|
|
@ -126,7 +126,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case
|
|||
);
|
||||
foreach ($styles as $path => $filter)
|
||||
{
|
||||
$files = $exporter->get_recursive_file_list($phpbb_root_path . $path, $path);
|
||||
$files = $exporter->get_recursive_file_list($phpbb_root_path . $path);
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$data_provider[] = array($filter, $path . $file);
|
||||
|
|
|
@ -69,7 +69,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -41,7 +41,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
|
|||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
|
|
@ -50,7 +50,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
|
|||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
@ -158,7 +158,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
|
|||
->willReturn($plupload);
|
||||
|
||||
$type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'));
|
||||
$type_form->set_upload($upload);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
|
|||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
@ -147,7 +147,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
|
|||
$this->factory = new \phpbb\files\factory($this->container);
|
||||
|
||||
$type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'));
|
||||
$type_local->set_upload($upload);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
|
|||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
@ -75,7 +75,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
|
|||
public function test_upload_fsock_fail()
|
||||
{
|
||||
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'));
|
||||
$type_remote->set_upload($upload);
|
||||
|
||||
|
@ -110,7 +110,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
|
|||
->method('getString')
|
||||
->willReturn($max_file_size);
|
||||
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $php_ini, $this->request);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'));
|
||||
$type_remote->set_upload($upload);
|
||||
|
||||
|
@ -122,7 +122,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
|
|||
public function test_upload_wrong_path()
|
||||
{
|
||||
$type_remote = new \phpbb\files\types\foo($this->config, $this->factory, $this->temp, $this->language, $this->php_ini, $this->request);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'));
|
||||
$type_remote->set_upload($upload);
|
||||
$type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path';
|
||||
|
|
|
@ -31,9 +31,6 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
/** @var \phpbb\request\request_interface */
|
||||
protected $request;
|
||||
|
||||
/** @var string phpBB root path */
|
||||
protected $phpbb_root_path;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
// Global $config required by unique_id
|
||||
|
@ -53,7 +50,7 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
$this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper;
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
@ -64,13 +61,11 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
|
||||
))));
|
||||
$this->factory = new \phpbb\files\factory($this->container);
|
||||
|
||||
$this->phpbb_root_path = $phpbb_root_path;
|
||||
}
|
||||
|
||||
public function test_reset_vars()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_max_filesize(500);
|
||||
$this->assertEquals(500, $upload->max_filesize);
|
||||
$upload->reset_vars();
|
||||
|
@ -79,7 +74,7 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
|
||||
public function test_set_disallowed_content()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$disallowed_content = new ReflectionProperty($upload, 'disallowed_content');
|
||||
$disallowed_content->setAccessible(true);
|
||||
|
||||
|
@ -97,7 +92,7 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
|
||||
public function test_is_valid()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$this->assertFalse($upload->is_valid('foobar'));
|
||||
}
|
||||
|
||||
|
@ -120,7 +115,7 @@ class phpbb_files_upload_test extends phpbb_test_case
|
|||
*/
|
||||
public function test_assign_internal_error($error_code, $expected)
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$this->assertSame($expected, $upload->assign_internal_error($error_code));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
|||
public function test_invalid_extension()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
|
@ -90,7 +90,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
|||
public function test_empty_file()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
|
@ -101,7 +101,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
|||
public function test_successful_upload()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('gif'))
|
||||
->set_max_filesize(2000);
|
||||
|
@ -114,7 +114,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
|
|||
public function test_too_large()
|
||||
{
|
||||
/** @var \phpbb\files\upload $upload */
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_error_prefix('')
|
||||
->set_allowed_extensions(array('gif'))
|
||||
->set_max_filesize(100);
|
||||
|
|
|
@ -152,7 +152,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca
|
|||
$cookies = self::$cookieJar->all();
|
||||
|
||||
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
|
||||
foreach ($cookies as $cookie);
|
||||
foreach ($cookies as $cookie)
|
||||
{
|
||||
if (substr($cookie->getName(), -4) == '_sid')
|
||||
{
|
||||
|
|
|
@ -162,7 +162,7 @@ class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_
|
|||
$this->create_user('unapproved_posts_test_user#2');
|
||||
$this->login('unapproved_posts_test_user#2');
|
||||
|
||||
$this->add_lang('posting', 'viewtopic', 'mcp');
|
||||
$this->add_lang(['posting', 'viewtopic', 'mcp']);
|
||||
|
||||
// should be able to see topic 1 but not unapproved post
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Unapproved Posts Test Topic #1']}&sid={$this->sid}");
|
||||
|
|
|
@ -43,7 +43,7 @@ class module_base_test extends phpbb_test_case
|
|||
$this->module = new test_installer_module($module_collection, true, false);
|
||||
|
||||
$iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface');
|
||||
$config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '', 'php');
|
||||
$config = new \phpbb\install\helper\config(new \phpbb\filesystem\filesystem(), new \bantu\IniGetWrapper\IniGetWrapper(), '');
|
||||
$this->module->setup($config, $iohandler);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,10 +159,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
|
|||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_mock_cache;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$auth = $this->createMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
|
|
@ -95,10 +95,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
|
|||
$storage = $this->createMock('\phpbb\storage\storage');
|
||||
|
||||
// User
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
$lang,
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$user->ip = '';
|
||||
$user->data = array(
|
||||
'user_id' => 2,
|
||||
|
|
|
@ -29,10 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
|||
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
@ -45,7 +42,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
|||
new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
|
||||
);
|
||||
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager);
|
||||
$router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
|
||||
$router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, 'php', dirname(__FILE__) . '/');
|
||||
|
||||
$request = new phpbb_mock_request();
|
||||
$request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
|
||||
|
|
|
@ -301,13 +301,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
|
|||
{
|
||||
if ($use_new_interface)
|
||||
{
|
||||
$test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface', array('needs_rehash', 'get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only'));
|
||||
$test_driver = $this->createMock('\phpbb\passwords\driver\rehashable_driver_interface');
|
||||
$test_driver->method('needs_rehash')
|
||||
->willReturn($needs_rehash);
|
||||
}
|
||||
else
|
||||
{
|
||||
$test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface', array('get_prefix', 'check', 'is_supported', 'is_legacy', 'hash', 'get_settings_only'));
|
||||
$test_driver = $this->createMock('\phpbb\passwords\driver\driver_interface');
|
||||
}
|
||||
$config = new \phpbb\config\config(array());
|
||||
|
||||
|
|
|
@ -165,9 +165,7 @@ class phpbb_path_helper_test extends phpbb_test_case
|
|||
*/
|
||||
public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction)
|
||||
{
|
||||
$symfony_request = $this->createMock('\phpbb\symfony_request', array(), array(
|
||||
new phpbb_mock_request(),
|
||||
));
|
||||
$symfony_request = $this->createMock('\phpbb\symfony_request');
|
||||
$symfony_request->expects($this->any())
|
||||
->method('getPathInfo')
|
||||
->will($this->returnValue($getPathInfo));
|
||||
|
@ -185,7 +183,7 @@ class phpbb_path_helper_test extends phpbb_test_case
|
|||
'php'
|
||||
);
|
||||
|
||||
$this->assertEquals($correction . $input, $path_helper->update_web_root_path($input, $symfony_request));
|
||||
$this->assertEquals($correction . $input, $path_helper->update_web_root_path($input));
|
||||
}
|
||||
|
||||
public function clean_url_data()
|
||||
|
|
|
@ -24,12 +24,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
$this->user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
|
|
@ -23,12 +23,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
|
|
@ -19,16 +19,13 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
|
|||
/**
|
||||
* Sets up basic test objects
|
||||
*
|
||||
* @access protected
|
||||
* @access protected
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
|
||||
global $config, $request, $user, $cache;
|
||||
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$cache = new phpbb_mock_cache;
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
|
|
|
@ -27,14 +27,11 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
|
|||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $config, $request, $user, $cache, $phpbb_root_path, $phpEx;
|
||||
global $config, $request, $user, $cache;
|
||||
|
||||
$config = new \phpbb\config\config([]);
|
||||
$cache = new phpbb_mock_cache;
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$user->expects($this->any())
|
||||
->method('lang')
|
||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||
|
|
|
@ -41,7 +41,7 @@ class phpbb_template_asset_test extends phpbb_test_case
|
|||
$path_helper->method('get_phpbb_root_path')
|
||||
->willReturn($phpbb_root_path);
|
||||
|
||||
$asset = new asset('', $path_helper, new phpbb\filesystem\filesystem());
|
||||
$asset = new asset('', $path_helper);
|
||||
|
||||
$asset->set_path($path, true);
|
||||
$this->assertEquals($expected, $asset->get_path());
|
||||
|
|
|
@ -90,7 +90,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($phpbb_container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
[
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -55,7 +55,6 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
|
|||
)
|
||||
);
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
|
@ -66,7 +65,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
|
|||
$cache_path,
|
||||
$this->extension_manager,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -149,7 +149,6 @@ Zeta test event in all',
|
|||
$phpEx
|
||||
);
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
|
@ -160,7 +159,7 @@ Zeta test event in all',
|
|||
$cache_path,
|
||||
$this->extension_manager,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -41,7 +41,6 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
|
|||
|
||||
$this->template_path = $this->test_path . '/templates';
|
||||
$this->parent_template_path = $this->test_path . '/parent_templates';
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
|
@ -52,7 +51,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -93,7 +93,6 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
|||
|
||||
$this->template_path = $this->test_path . '/templates';
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
|
@ -104,7 +103,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -36,7 +36,6 @@ 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';
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader('');
|
||||
|
@ -47,7 +46,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
|
|||
$cache_path,
|
||||
null,
|
||||
$loader,
|
||||
new \phpbb\event\dispatcher($container),
|
||||
new \phpbb\event\dispatcher(),
|
||||
array(
|
||||
'cache' => false,
|
||||
'debug' => false,
|
||||
|
|
|
@ -359,7 +359,7 @@ abstract class phpbb_database_test_case extends TestCase
|
|||
|
||||
static $core_tables = [];
|
||||
|
||||
if (empty($tables))
|
||||
if (empty($core_tables))
|
||||
{
|
||||
$tables_yml_data = \Symfony\Component\Yaml\Yaml::parseFile($phpbb_root_path . '/config/default/container/tables.yml');
|
||||
|
||||
|
|
|
@ -720,10 +720,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||
|
||||
$db = $this->get_db();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$auth = $this->createMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
@ -757,10 +754,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||
|
||||
$db = $this->get_db();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user = $this->createMock('\phpbb\user', array(), array(
|
||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||
'\phpbb\datetime'
|
||||
));
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
$auth = $this->createMock('\phpbb\auth\auth');
|
||||
|
||||
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
|
||||
|
@ -806,7 +800,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||
$cookies = self::$cookieJar->all();
|
||||
|
||||
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
|
||||
foreach ($cookies as $cookie);
|
||||
foreach ($cookies as $cookie)
|
||||
{
|
||||
if (substr($cookie->getName(), -4) == '_sid')
|
||||
{
|
||||
|
@ -855,7 +849,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
|||
$cookies = self::$cookieJar->all();
|
||||
|
||||
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
|
||||
foreach ($cookies as $cookie);
|
||||
foreach ($cookies as $cookie)
|
||||
{
|
||||
if (substr($cookie->getName(), -4) == '_sid')
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
$guessers[3]->set_priority(-2);
|
||||
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
|
||||
|
||||
$this->container = new phpbb_mock_container_builder($phpbb_root_path, $phpEx);
|
||||
$this->container = new phpbb_mock_container_builder();
|
||||
$this->container->set('files.filespec', new \phpbb\files\filespec(
|
||||
$this->filesystem,
|
||||
$this->language,
|
||||
|
@ -120,7 +120,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_common_checks_invalid_extension()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('png'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
|
@ -130,7 +130,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_common_checks_disallowed_content()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
$file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path);
|
||||
|
@ -149,7 +149,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_common_checks_invalid_filename()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
|
@ -160,7 +160,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_common_checks_too_large()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(100);
|
||||
$file = $this->gen_valid_filespec();
|
||||
|
@ -171,7 +171,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_common_checks_valid_file()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
$file = $this->gen_valid_filespec();
|
||||
|
@ -181,7 +181,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_local_upload()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
|
@ -195,7 +195,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_move_existent_file()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
|
@ -209,7 +209,7 @@ class phpbb_fileupload_test extends phpbb_test_case
|
|||
|
||||
public function test_move_existent_file_overwrite()
|
||||
{
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request, $this->phpbb_root_path);
|
||||
$upload = new \phpbb\files\upload($this->factory, $this->language, $this->php_ini, $this->request);
|
||||
$upload->set_allowed_extensions(array('jpg'))
|
||||
->set_max_filesize(1000);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class phpbb_viewonline_helper_test extends phpbb_test_case
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->viewonline_helper = new \phpbb\viewonline_helper(new \phpbb\filesystem\filesystem());
|
||||
$this->viewonline_helper = new \phpbb\viewonline_helper();
|
||||
}
|
||||
|
||||
public function session_pages_data()
|
||||
|
|
Loading…
Add table
Reference in a new issue