[ticket/11467] Add user object to extension manager for tests

PHPBB3-11467
This commit is contained in:
n-aleha 2014-05-12 02:31:52 +03:00
parent 56959a2f83
commit 7f00c38c50
7 changed files with 17 additions and 9 deletions

View file

@ -170,10 +170,10 @@ services:
- @dbal.conn - @dbal.conn
- @config - @config
- @filesystem - @filesystem
- @user
- %tables.ext% - %tables.ext%
- %core.root_path% - %core.root_path%
- %core.php_ext% - %core.php_ext%
- @user
- @cache.driver - @cache.driver
filesystem: filesystem:

View file

@ -40,25 +40,25 @@ class manager
* @param \phpbb\db\driver\driver_interface $db A database connection * @param \phpbb\db\driver\driver_interface $db A database connection
* @param \phpbb\config\config $config Config object * @param \phpbb\config\config $config Config object
* @param \phpbb\filesystem $filesystem * @param \phpbb\filesystem $filesystem
* @param \phpbb\user $user User object
* @param string $extension_table The name of the table holding extensions * @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension, defaults to php * @param string $php_ext php file extension, defaults to php
* @param \phpbb\user $user User object
* @param \phpbb\cache\driver\driver_interface $cache A cache instance or null * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext * @param string $cache_name The name of the cache variable, defaults to _ext
*/ */
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, \phpbb\user $user, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext')
{ {
$this->cache = $cache;
$this->cache_name = $cache_name;
$this->config = $config;
$this->container = $container; $this->container = $container;
$this->db = $db; $this->db = $db;
$this->config = $config;
$this->filesystem = $filesystem;
$this->extension_table = $extension_table; $this->extension_table = $extension_table;
$this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->user = $user; $this->user = $user;
$this->cache = $cache;
$this->cache_name = $cache_name;
$this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false;

View file

@ -71,7 +71,7 @@ class metadata_manager
* *
* @param string $ext_name Name (including vendor) of the extension * @param string $ext_name Name (including vendor) of the extension
* @param \phpbb\config\config $config phpBB Config instance * @param \phpbb\config\config $config phpBB Config instance
* @param \phpbb\extension\manager $extension_manager An instance of the phpBBb extension manager * @param \phpbb\extension\manager $extension_manager An instance of the phpBB extension manager
* @param \phpbb\template\template $template phpBB Template instance * @param \phpbb\template\template $template phpBB Template instance
* @param \phpbb\user $user User instance * @param \phpbb\user $user User instance
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
@ -262,7 +262,7 @@ class metadata_manager
{ {
if (!isset($author['name'])) if (!isset($author['name']))
{ {
throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'author name')); throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'author name'));
} }
} }

View file

@ -60,12 +60,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder(); $container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator); $container->set('migrator', $migrator);
$user = new \phpbb\user();
$this->extension_manager = new \phpbb\extension\manager( $this->extension_manager = new \phpbb\extension\manager(
$container, $container,
$this->db, $this->db,
$this->config, $this->config,
new phpbb\filesystem(), new phpbb\filesystem(),
$user,
'phpbb_ext', 'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/', dirname(__FILE__) . '/../../phpBB/',
'php', 'php',

View file

@ -101,6 +101,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$phpbb_root_path = __DIR__ . './../../phpBB/'; $phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php'; $php_ext = 'php';
$table_prefix = 'phpbb_'; $table_prefix = 'phpbb_';
$user = new \phpbb\user();
$migrator = new \phpbb\db\migrator( $migrator = new \phpbb\db\migrator(
$config, $config,
@ -121,6 +122,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$db, $db,
$config, $config,
new \phpbb\filesystem(), new \phpbb\filesystem(),
$user,
'phpbb_ext', 'phpbb_ext',
dirname(__FILE__) . '/', dirname(__FILE__) . '/',
$php_ext, $php_ext,

View file

@ -77,6 +77,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->db, $this->db,
$this->config, $this->config,
new \phpbb\filesystem(), new \phpbb\filesystem(),
$this->user,
'phpbb_ext', 'phpbb_ext',
$this->phpbb_root_path, $this->phpbb_root_path,
$this->phpEx, $this->phpEx,
@ -437,6 +438,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->config, $this->config,
$this->extension_manager, $this->extension_manager,
$this->template, $this->template,
$this->user,
$this->phpbb_root_path $this->phpbb_root_path
); );
} }

View file

@ -203,12 +203,14 @@ class phpbb_functional_test_case extends phpbb_test_case
); );
$container = new phpbb_mock_container_builder(); $container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator); $container->set('migrator', $migrator);
$user = new \phpbb\user();
$extension_manager = new \phpbb\extension\manager( $extension_manager = new \phpbb\extension\manager(
$container, $container,
$db, $db,
$config, $config,
new phpbb\filesystem(), new phpbb\filesystem(),
$user,
self::$config['table_prefix'] . 'ext', self::$config['table_prefix'] . 'ext',
dirname(__FILE__) . '/', dirname(__FILE__) . '/',
$phpEx, $phpEx,