1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 16:56:44 +02:00

Merge pull request #5274 from rubencm/ticket/14285

[ticket/14285] Move downloads to controller
This commit is contained in:
Marc Alexander
2021-05-28 07:17:15 +02:00
committed by GitHub
26 changed files with 1037 additions and 1335 deletions

View File

@@ -11,6 +11,8 @@
*
*/
use phpbb\controller\helper;
require_once __DIR__ . '/template_test_case.php';
class phpbb_template_extension_test extends phpbb_template_template_test_case
@@ -66,10 +68,17 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
->disableOriginalConstructor()
->getMock();
$controller_helper = $this->createMock(helper::class);
$controller_helper
->method('route')
->willReturnCallback(function($route, $params) {
return 'download/avatar/' . $params['file'];
});
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$phpbb_container = new phpbb_mock_container_builder();
$files = new phpbb\files\factory($phpbb_container);
$upload_avatar_driver = new phpbb\avatar\driver\upload($config, $phpbb_root_path, $phpEx, $storage, $phpbb_path_helper, $phpbb_dispatcher, $files, new \bantu\IniGetWrapper\IniGetWrapper());
$upload_avatar_driver = new phpbb\avatar\driver\upload($config, $controller_helper, $phpbb_root_path, $phpEx, $storage, $phpbb_path_helper, $phpbb_dispatcher, $files, new \bantu\IniGetWrapper\IniGetWrapper());
$upload_avatar_driver->set_name('avatar.driver.upload');
$phpbb_container->set('avatar.manager', new \phpbb\avatar\manager($config, $phpbb_dispatcher, [
$upload_avatar_driver,
@@ -141,7 +150,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
],
[],
[],
'<img class="avatar" src="phpBB/download/file.php?avatar=great_avatar.png" width="90" height="90" alt="foo" />',
'<img class="avatar" src="download/avatar/great_avatar.png" width="90" height="90" alt="foo" />',
[]
],
[
@@ -159,7 +168,7 @@ class phpbb_template_extension_test extends phpbb_template_template_test_case
],
[],
[],
'<img class="avatar" src="phpBB/styles//theme/images/no_avatar.gif" data-src="phpBB/download/file.php?avatar=great_avatar.png" width="90" height="90" alt="foo" />',
'<img class="avatar" src="phpBB/styles//theme/images/no_avatar.gif" data-src="download/avatar/great_avatar.png" width="90" height="90" alt="foo" />',
[]
],
[