aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-08-27 16:56:46 +0200
committerMatt Friedman <maf675@gmail.com>2016-02-29 08:14:29 -0800
commitdf4a620ba146d895be4910761bc030045abbae93 (patch)
treec60befa50ee294214feccef68c09e49f1fe605ae
parent50761104ba6590de86ec651b5679983eaf2ff600 (diff)
downloadforums-df4a620ba146d895be4910761bc030045abbae93.tar
forums-df4a620ba146d895be4910761bc030045abbae93.tar.gz
forums-df4a620ba146d895be4910761bc030045abbae93.tar.bz2
forums-df4a620ba146d895be4910761bc030045abbae93.tar.xz
forums-df4a620ba146d895be4910761bc030045abbae93.zip
[ticket/12684] Fix tests
PHPBB3-12684
-rw-r--r--phpBB/phpbb/console/command/user/add.php18
-rw-r--r--tests/console/user/add_test.php4
2 files changed, 9 insertions, 13 deletions
diff --git a/phpBB/phpbb/console/command/user/add.php b/phpBB/phpbb/console/command/user/add.php
index e3f8243c02..fab69738e3 100644
--- a/phpBB/phpbb/console/command/user/add.php
+++ b/phpBB/phpbb/console/command/user/add.php
@@ -19,9 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface;
class add extends \phpbb\console\command\command
{
- /** @var \phpbb\user */
- protected $user;
-
/** @var \phpbb\db\driver\driver_interface */
protected $db;
@@ -41,13 +38,12 @@ class add extends \phpbb\console\command\command
*/
public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $password_manager)
{
- $this->user = $user;
$this->db = $db;
$this->config = $config;
$this->password_manager = $password_manager;
- $this->user->add_lang('ucp');
- parent::__construct();
+ $user->add_lang('ucp');
+ parent::__construct($user);
}
/**
@@ -121,13 +117,13 @@ class add extends \phpbb\console\command\command
'user_password' => $this->password_manager->hash($password),
'user_email' => $email,
'group_id' => $group_id,
- 'user_timezone' => $config['board_timezone'],
- 'user_lang' => $config['default_lang'],
+ 'user_timezone' => $this->config['board_timezone'],
+ 'user_lang' => $this->config['default_lang'],
'user_type' => USER_NORMAL,
'user_regdate' => time(),
);
- if (!function_exists(user_add))
+ if (!function_exists('user_add'))
{
require_once dirname(__FILE__) . '/../../../../includes/functions_user.php';
}
@@ -144,7 +140,7 @@ class add extends \phpbb\console\command\command
* This is repeted while the two are not the same
*
* @param OutputInterface $output The output stream, where messages are printed
- * @param Symfony\Component\Console\Helper\DialogHelper $dialog The dialog helper used to get answers to questions asked to the user
+ * @param \Symfony\Component\Console\Helper\DialogHelper $dialog The dialog helper used to get answers to questions asked to the user
*
* @return null
*/
@@ -177,7 +173,7 @@ class add extends \phpbb\console\command\command
*
* Go and find in the database the group_id corresponding to 'REGISTERED'
*
- * @throws RunTimeException if the group id does not exist in database.
+ * @throws \RunTimeException if the group id does not exist in database.
* @return null
*/
protected function get_group_id()
diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php
index 6c28c46815..6f80a8658a 100644
--- a/tests/console/user/add_test.php
+++ b/tests/console/user/add_test.php
@@ -50,7 +50,7 @@ class phpbb_console_command_user_add_test extends phpbb_database_test_case
$db = $this->db = $this->new_dbal();
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->method('lang')->will($this->returnArgument(0));
$driver_helper = new \phpbb\passwords\driver\helper($this->config);
@@ -90,7 +90,7 @@ class phpbb_console_command_user_add_test extends phpbb_database_test_case
$this->assertEquals(2, $this->get_user_id('Admin'));
- $this->dialog->setInputStream($this->getInputStream("bar\npass\npass\nbar@test.com\n"));
+ $this->dialog->setInputStream($this->getInputStream("bar\npassword\npassword\nbar@test.com\n"));
$command_tester->execute(array(
'command' => $this->command_name,