[ticket/16346] Fix method arguments

PHPBB3-16346
This commit is contained in:
rubencm 2020-08-14 18:42:50 +00:00
parent 758c28ca69
commit 490ddbc2cd
46 changed files with 78 additions and 144 deletions

View file

@ -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 = new phpbb_mock_container_builder();
$phpbb_container->set('auth.provider_collection', array( $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, 'auth.provider.acp_board_invalid' => new phpbb\auth\provider\acp\board_invalid,
)); ));

View file

@ -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) 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) if ($throw_exception)
{ {
$this->storage->expects($this->any()) $this->storage->expects($this->any())

View file

@ -119,7 +119,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->mimetype_guesser $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->container->set('files.filespec_storage', new \phpbb\files\filespec_storage(
$this->language, $this->language,
new \FastImageSize\FastImageSize(), new \FastImageSize\FastImageSize(),
@ -140,7 +140,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case
$this->request $this->request
)); ));
$this->factory = new \phpbb\files\factory($this->container); $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->phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->temp = new \phpbb\filesystem\temp($this->filesystem, ''); $this->temp = new \phpbb\filesystem\temp($this->filesystem, '');
$this->user = new \phpbb\user($this->language, '\phpbb\datetime'); $this->user = new \phpbb\user($this->language, '\phpbb\datetime');

View file

@ -28,8 +28,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
protected function setUp(): void protected function setUp(): void
{ {
global $phpbb_root_path, $phpEx;
$this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; $this->cache_dir = dirname(__FILE__) . '/tmp/cache/';
if (file_exists($this->cache_dir)) 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->db = $this->createMock('\phpbb\db\driver\driver_interface');
$this->config = new \phpbb\config\config(array('assets_version' => 1)); $this->config = new \phpbb\config\config(array('assets_version' => 1));
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime')
);
} }
public function test_purge() public function test_purge()

View file

@ -26,10 +26,7 @@ class phpbb_console_command_config_test extends phpbb_test_case
$this->config = new \phpbb\config\config(array()); $this->config = new \phpbb\config\config(array());
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime')
);
$this->user->method('lang')->will($this->returnArgument(0)); $this->user->method('lang')->will($this->returnArgument(0));
} }

View file

@ -34,10 +34,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
{ {
global $phpbb_root_path, $phpEx; global $phpbb_root_path, $phpEx;
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$this->user->method('lang')->will($this->returnArgument(0)); $this->user->method('lang')->will($this->returnArgument(0));
} }

View file

@ -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')); $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0'));
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$this->user->method('lang')->will($this->returnArgument(0)); $this->user->method('lang')->will($this->returnArgument(0));
$this->task = new phpbb_cron_task_simple(); $this->task = new phpbb_cron_task_simple();

View file

@ -50,14 +50,11 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
)); ));
$this->db = $this->db = $this->new_dbal(); $this->db = $this->db = $this->new_dbal();
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime')
);
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->phpEx = $phpEx; $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( $this->cache->expects(self::any())->method('obtain_attach_extensions')->will(self::returnValue(array(
'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE), 'png' => array('display_cat' => ATTACHMENT_CATEGORY_IMAGE),
'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE), 'txt' => array('display_cat' => ATTACHMENT_CATEGORY_NONE),

View file

@ -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)); $this->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
$this->language,
'\phpbb\datetime'
));
$user->method('lang')->will($this->returnArgument(0)); $user->method('lang')->will($this->returnArgument(0));
$cache = $this->getMockBuilder('\phpbb\cache\service') $cache = $this->getMockBuilder('\phpbb\cache\service')

View file

@ -62,10 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$this->language->expects($this->any()) $this->language->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnArgument(0)); ->will($this->returnArgument(0));
$user = $this->user = $this->createMock('\phpbb\user', array(), array( $user = $this->user = $this->createMock('\phpbb\user');
$this->language,
'\phpbb\datetime'
));
$this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); $this->user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);

View file

@ -125,7 +125,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
$cache_path, $cache_path,
null, null,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => 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__) . '/') new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
); );
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); $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->auth = new \phpbb\auth\auth();
$this->cache = new \phpbb\cache\driver\dummy(); $this->cache = new \phpbb\cache\driver\dummy();
$this->db = $this->new_dbal(); $this->db = $this->new_dbal();

View file

@ -48,7 +48,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
new \phpbb\routing\file_locator(dirname(__FILE__) . '/') new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
); );
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); $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(); $routes = $router->get_routes();
// This will need to be updated if any new routes are defined // This will need to be updated if any new routes are defined

View file

@ -73,7 +73,7 @@ class phpbb_email_parsing_test extends phpbb_test_case
$cache_path, $cache_path,
null, null,
new \phpbb\template\twig\loader(''), new \phpbb\template\twig\loader(''),
new \phpbb\event\dispatcher($phpbb_container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -15,7 +15,7 @@ class phpbb_event_dispatcher_test extends phpbb_test_case
{ {
public function test_trigger_event() 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) { $dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) {
$event['foo'] = $event['foo'] . '2'; $event['foo'] = $event['foo'] . '2';

View file

@ -28,7 +28,7 @@ class phpbb_event_export_php_test extends phpbb_test_case
{ {
global $phpbb_root_path; global $phpbb_root_path;
$exporter = new \phpbb\event\php_exporter($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(); $data_provider = array();
foreach ($files as $file) foreach ($files as $file)

View file

@ -126,7 +126,7 @@ class phpbb_event_md_exporter_test extends phpbb_test_case
); );
foreach ($styles as $path => $filter) 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) foreach ($files as $file)
{ {
$data_provider[] = array($filter, $path . $file); $data_provider[] = array($filter, $path . $file);

View file

@ -69,7 +69,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), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -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->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,

View file

@ -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->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,
@ -158,7 +158,7 @@ class phpbb_files_types_form_test extends phpbb_test_case
->willReturn($plupload); ->willReturn($plupload);
$type_form = new \phpbb\files\types\form($this->factory, $this->language, $this->php_ini, $this->plupload, $this->request); $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')); $upload->set_allowed_extensions(array('png'));
$type_form->set_upload($upload); $type_form->set_upload($upload);

View file

@ -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->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,
@ -147,7 +147,7 @@ class phpbb_files_types_local_test extends phpbb_test_case
$this->factory = new \phpbb\files\factory($this->container); $this->factory = new \phpbb\files\factory($this->container);
$type_local = new \phpbb\files\types\local($this->factory, $this->language, $this->php_ini, $this->request); $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')); $upload->set_allowed_extensions(array('png'));
$type_local->set_upload($upload); $type_local->set_upload($upload);

View file

@ -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->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,
@ -75,7 +75,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
public function test_upload_fsock_fail() 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); $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')); $upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload); $type_remote->set_upload($upload);
@ -110,7 +110,7 @@ class phpbb_files_types_remote_test extends phpbb_test_case
->method('getString') ->method('getString')
->willReturn($max_file_size); ->willReturn($max_file_size);
$type_remote = new \phpbb\files\types\remote($this->config, $this->factory, $this->temp, $this->language, $php_ini, $this->request); $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')); $upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload); $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() 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); $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')); $upload->set_allowed_extensions(array('png'));
$type_remote->set_upload($upload); $type_remote->set_upload($upload);
$type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path'; $type_remote::$tempnam_path = $this->phpbb_root_path . 'cache/wrong/path';

View file

@ -31,9 +31,6 @@ class phpbb_files_upload_test extends phpbb_test_case
/** @var \phpbb\request\request_interface */ /** @var \phpbb\request\request_interface */
protected $request; protected $request;
/** @var string phpBB root path */
protected $phpbb_root_path;
protected function setUp(): void protected function setUp(): void
{ {
// Global $config required by unique_id // 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->language = new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
$this->php_ini = new \bantu\IniGetWrapper\IniGetWrapper; $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,
@ -64,13 +61,11 @@ class phpbb_files_upload_test extends phpbb_test_case
'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(), 'mimetype.extension_guesser' => new \phpbb\mimetype\extension_guesser(),
)))); ))));
$this->factory = new \phpbb\files\factory($this->container); $this->factory = new \phpbb\files\factory($this->container);
$this->phpbb_root_path = $phpbb_root_path;
} }
public function test_reset_vars() 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); $upload->set_max_filesize(500);
$this->assertEquals(500, $upload->max_filesize); $this->assertEquals(500, $upload->max_filesize);
$upload->reset_vars(); $upload->reset_vars();
@ -79,7 +74,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_set_disallowed_content() 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 = new ReflectionProperty($upload, 'disallowed_content');
$disallowed_content->setAccessible(true); $disallowed_content->setAccessible(true);
@ -97,7 +92,7 @@ class phpbb_files_upload_test extends phpbb_test_case
public function test_is_valid() 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')); $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) 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)); $this->assertSame($expected, $upload->assign_internal_error($error_code));
} }
} }

View file

@ -79,7 +79,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_invalid_extension() public function test_invalid_extension()
{ {
/** @var \phpbb\files\upload $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('') $upload->set_error_prefix('')
->set_allowed_extensions(array('jpg')) ->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
@ -90,7 +90,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_empty_file() public function test_empty_file()
{ {
/** @var \phpbb\files\upload $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('') $upload->set_error_prefix('')
->set_allowed_extensions(array('jpg')) ->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
@ -101,7 +101,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_successful_upload() public function test_successful_upload()
{ {
/** @var \phpbb\files\upload $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('') $upload->set_error_prefix('')
->set_allowed_extensions(array('gif')) ->set_allowed_extensions(array('gif'))
->set_max_filesize(2000); ->set_max_filesize(2000);
@ -114,7 +114,7 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
public function test_too_large() public function test_too_large()
{ {
/** @var \phpbb\files\upload $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('') $upload->set_error_prefix('')
->set_allowed_extensions(array('gif')) ->set_allowed_extensions(array('gif'))
->set_max_filesize(100); ->set_max_filesize(100);

View file

@ -152,7 +152,7 @@ class phpbb_functional_user_password_reset_test extends phpbb_functional_test_ca
$cookies = self::$cookieJar->all(); $cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie // 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') if (substr($cookie->getName(), -4) == '_sid')
{ {

View file

@ -162,7 +162,7 @@ class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_
$this->create_user('unapproved_posts_test_user#2'); $this->create_user('unapproved_posts_test_user#2');
$this->login('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 // 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}"); $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Unapproved Posts Test Topic #1']}&sid={$this->sid}");

View file

@ -43,7 +43,7 @@ class module_base_test extends phpbb_test_case
$this->module = new test_installer_module($module_collection, true, false); $this->module = new test_installer_module($module_collection, true, false);
$iohandler = $this->createMock('\phpbb\install\helper\iohandler\iohandler_interface'); $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); $this->module->setup($config, $iohandler);
} }

View file

@ -159,10 +159,7 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
$db = $this->new_dbal(); $db = $this->new_dbal();
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$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);

View file

@ -95,10 +95,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$storage = $this->createMock('\phpbb\storage\storage'); $storage = $this->createMock('\phpbb\storage\storage');
// User // User
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
$lang,
'\phpbb\datetime'
));
$user->ip = ''; $user->ip = '';
$user->data = array( $user->data = array(
'user_id' => 2, 'user_id' => 2,

View file

@ -29,10 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
global $phpbb_dispatcher, $phpbb_root_path, $phpEx; global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->user = $this->createMock('\phpbb\user', array(), array( $this->user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$this->user->expects($this->any()) $this->user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->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__) . '/') new \phpbb\routing\file_locator(dirname(__FILE__) . '/')
); );
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager); $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 = new phpbb_mock_request();
$request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER); $request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);

View file

@ -301,13 +301,13 @@ class phpbb_passwords_manager_test extends \phpbb_test_case
{ {
if ($use_new_interface) 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') $test_driver->method('needs_rehash')
->willReturn($needs_rehash); ->willReturn($needs_rehash);
} }
else 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()); $config = new \phpbb\config\config(array());

View file

@ -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) public function test_update_web_root_path($input, $getPathInfo, $getRequestUri, $getScriptName, $correction)
{ {
$symfony_request = $this->createMock('\phpbb\symfony_request', array(), array( $symfony_request = $this->createMock('\phpbb\symfony_request');
new phpbb_mock_request(),
));
$symfony_request->expects($this->any()) $symfony_request->expects($this->any())
->method('getPathInfo') ->method('getPathInfo')
->will($this->returnValue($getPathInfo)); ->will($this->returnValue($getPathInfo));
@ -185,7 +183,7 @@ class phpbb_path_helper_test extends phpbb_test_case
'php' '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() public function clean_url_data()

View file

@ -24,12 +24,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
*/ */
protected function setUp(): void protected function setUp(): void
{ {
global $phpbb_root_path, $phpEx; $this->user = $this->createMock('\phpbb\user');
$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->expects($this->any()) $this->user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -23,12 +23,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
*/ */
protected function setUp(): void protected function setUp(): void
{ {
global $phpbb_root_path, $phpEx; $user = $this->createMock('\phpbb\user');
$user = $this->createMock('\phpbb\user', array(), array(
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -19,16 +19,13 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
/** /**
* Sets up basic test objects * Sets up basic test objects
* *
* @access protected * @access protected
*/ */
protected function setUp(): void 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( $user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')

View file

@ -27,14 +27,11 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
*/ */
protected function setUp(): void protected function setUp(): void
{ {
global $config, $request, $user, $cache, $phpbb_root_path, $phpEx; global $config, $request, $user, $cache;
$config = new \phpbb\config\config([]); $config = new \phpbb\config\config([]);
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$user->expects($this->any()) $user->expects($this->any())
->method('lang') ->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode'))); ->will($this->returnCallback(array($this, 'return_callback_implode')));

View file

@ -41,7 +41,7 @@ class phpbb_template_asset_test extends phpbb_test_case
$path_helper->method('get_phpbb_root_path') $path_helper->method('get_phpbb_root_path')
->willReturn($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); $asset->set_path($path, true);
$this->assertEquals($expected, $asset->get_path()); $this->assertEquals($expected, $asset->get_path());

View file

@ -90,7 +90,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
$cache_path, $cache_path,
null, null,
$loader, $loader,
new \phpbb\event\dispatcher($phpbb_container), new \phpbb\event\dispatcher(),
[ [
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -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'; $cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context(); $context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(''); $loader = new \phpbb\template\twig\loader('');
@ -66,7 +65,7 @@ class phpbb_template_allfolder_test extends phpbb_template_template_test_case
$cache_path, $cache_path,
$this->extension_manager, $this->extension_manager,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -149,7 +149,6 @@ Zeta test event in all',
$phpEx $phpEx
); );
$container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig'; $cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context(); $context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(''); $loader = new \phpbb\template\twig\loader('');
@ -160,7 +159,7 @@ Zeta test event in all',
$cache_path, $cache_path,
$this->extension_manager, $this->extension_manager,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -41,7 +41,6 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$this->template_path = $this->test_path . '/templates'; $this->template_path = $this->test_path . '/templates';
$this->parent_template_path = $this->test_path . '/parent_templates'; $this->parent_template_path = $this->test_path . '/parent_templates';
$container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig'; $cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context(); $context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(''); $loader = new \phpbb\template\twig\loader('');
@ -52,7 +51,7 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
$cache_path, $cache_path,
null, null,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -93,7 +93,6 @@ class phpbb_template_template_test_case extends phpbb_test_case
$this->template_path = $this->test_path . '/templates'; $this->template_path = $this->test_path . '/templates';
$container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig'; $cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context(); $context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(''); $loader = new \phpbb\template\twig\loader('');
@ -104,7 +103,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$cache_path, $cache_path,
null, null,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -36,7 +36,6 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$this->template_path = $this->test_path . '/templates'; $this->template_path = $this->test_path . '/templates';
$this->parent_template_path = $this->test_path . '/parent_templates'; $this->parent_template_path = $this->test_path . '/parent_templates';
$container = new phpbb_mock_container_builder();
$cache_path = $phpbb_root_path . 'cache/twig'; $cache_path = $phpbb_root_path . 'cache/twig';
$context = new \phpbb\template\context(); $context = new \phpbb\template\context();
$loader = new \phpbb\template\twig\loader(''); $loader = new \phpbb\template\twig\loader('');
@ -47,7 +46,7 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
$cache_path, $cache_path,
null, null,
$loader, $loader,
new \phpbb\event\dispatcher($container), new \phpbb\event\dispatcher(),
array( array(
'cache' => false, 'cache' => false,
'debug' => false, 'debug' => false,

View file

@ -359,7 +359,7 @@ abstract class phpbb_database_test_case extends TestCase
static $core_tables = []; 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'); $tables_yml_data = \Symfony\Component\Yaml\Yaml::parseFile($phpbb_root_path . '/config/default/container/tables.yml');

View file

@ -720,10 +720,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db(); $db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$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);
@ -757,10 +754,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db(); $db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$user = $this->createMock('\phpbb\user', array(), array( $user = $this->createMock('\phpbb\user');
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
'\phpbb\datetime'
));
$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);
@ -806,7 +800,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$cookies = self::$cookieJar->all(); $cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie // 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') if (substr($cookie->getName(), -4) == '_sid')
{ {
@ -855,7 +849,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$cookies = self::$cookieJar->all(); $cookies = self::$cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie // 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') if (substr($cookie->getName(), -4) == '_sid')
{ {

View file

@ -68,7 +68,7 @@ class phpbb_fileupload_test extends phpbb_test_case
$guessers[3]->set_priority(-2); $guessers[3]->set_priority(-2);
$this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers); $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->container->set('files.filespec', new \phpbb\files\filespec(
$this->filesystem, $this->filesystem,
$this->language, $this->language,
@ -120,7 +120,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_invalid_extension() 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')) $upload->set_allowed_extensions(array('png'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -130,7 +130,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_disallowed_content() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
$file = new \phpbb\files\filespec($this->filesystem, $this->language, $this->php_ini, new \FastImageSize\FastImageSize(), $this->phpbb_root_path); $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() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -160,7 +160,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_too_large() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(100); ->set_max_filesize(100);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -171,7 +171,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_common_checks_valid_file() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
$file = $this->gen_valid_filespec(); $file = $this->gen_valid_filespec();
@ -181,7 +181,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_local_upload() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -195,7 +195,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);
@ -209,7 +209,7 @@ class phpbb_fileupload_test extends phpbb_test_case
public function test_move_existent_file_overwrite() 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')) $upload->set_allowed_extensions(array('jpg'))
->set_max_filesize(1000); ->set_max_filesize(1000);

View file

@ -19,7 +19,7 @@ class phpbb_viewonline_helper_test extends phpbb_test_case
{ {
parent::setUp(); 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() public function session_pages_data()