[ticket/13904] Remove unneeded parameters from avatars and fix tests

PHPBB3-13904
This commit is contained in:
Marc Alexander 2015-08-14 09:10:05 +02:00
parent 0a98fc2561
commit 57de896286
3 changed files with 6 additions and 19 deletions

View file

@ -61,10 +61,9 @@ services:
- @config
- %core.root_path%
- %core.php_ext%
- @filesystem
- @path_helper
- @mimetype.guesser
- @dispatcher
- @files.factory
- @cache.driver
calls:
- [set_name, [avatar.driver.upload]]

View file

@ -18,22 +18,12 @@ namespace phpbb\avatar\driver;
*/
class upload extends \phpbb\avatar\driver\driver
{
/**
* @var \phpbb\filesystem\filesystem_interface
*/
protected $filesystem;
/**
* @var \phpbb\mimetype\guesser
*/
protected $mimetype_guesser;
/**
* @var \phpbb\event\dispatcher_interface
*/
protected $dispatcher;
/**
/**sts
* @var \phpbb\files\factory
*/
protected $files_factory;
@ -44,21 +34,17 @@ class upload extends \phpbb\avatar\driver\driver
* @param \phpbb\config\config $config phpBB configuration
* @param string $phpbb_root_path Path to the phpBB root
* @param string $php_ext PHP file extension
* @param \phpbb\filesystem\filesystem_interface phpBB filesystem helper
* @param \phpbb\path_helper $path_helper phpBB path helper
* @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
* @param \phpbb\event\dispatcher_interface $dispatcher phpBB Event dispatcher object
* @param \phpbb\files\factory $files_factory File classes factory
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
*/
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\files\factory $files_factory, \phpbb\cache\driver\driver_interface $cache = null)
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\files\factory $files_factory, \phpbb\cache\driver\driver_interface $cache = null)
{
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->filesystem = $filesystem;
$this->path_helper = $path_helper;
$this->mimetype_guesser = $mimetype_guesser;
$this->dispatcher = $dispatcher;
$this->files_factory = $files_factory;
$this->cache = $cache;

View file

@ -73,6 +73,8 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
->will($this->returnValue('avatar.driver.barfoo'));
$avatar_drivers = array($this->avatar_foobar, $this->avatar_barfoo);
$files_factory = new \phpbb\files\factory($phpbb_container);
foreach ($this->avatar_drivers() as $driver)
{
if ($driver !== 'upload')
@ -81,7 +83,7 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case
}
else
{
$cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $filesystem, $path_helper, $guesser, $dispatcher, $cache));
$cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $path_helper, $dispatcher, $files_factory, $cache));
}
$cur_avatar->expects($this->any())
->method('get_name')