mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/12684] Fix tests
PHPBB3-12684
This commit is contained in:
parent
50761104ba
commit
df4a620ba1
2 changed files with 9 additions and 13 deletions
|
@ -19,9 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class add extends \phpbb\console\command\command
|
class add extends \phpbb\console\command\command
|
||||||
{
|
{
|
||||||
/** @var \phpbb\user */
|
|
||||||
protected $user;
|
|
||||||
|
|
||||||
/** @var \phpbb\db\driver\driver_interface */
|
/** @var \phpbb\db\driver\driver_interface */
|
||||||
protected $db;
|
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)
|
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->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->password_manager = $password_manager;
|
$this->password_manager = $password_manager;
|
||||||
|
|
||||||
$this->user->add_lang('ucp');
|
$user->add_lang('ucp');
|
||||||
parent::__construct();
|
parent::__construct($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,13 +117,13 @@ class add extends \phpbb\console\command\command
|
||||||
'user_password' => $this->password_manager->hash($password),
|
'user_password' => $this->password_manager->hash($password),
|
||||||
'user_email' => $email,
|
'user_email' => $email,
|
||||||
'group_id' => $group_id,
|
'group_id' => $group_id,
|
||||||
'user_timezone' => $config['board_timezone'],
|
'user_timezone' => $this->config['board_timezone'],
|
||||||
'user_lang' => $config['default_lang'],
|
'user_lang' => $this->config['default_lang'],
|
||||||
'user_type' => USER_NORMAL,
|
'user_type' => USER_NORMAL,
|
||||||
'user_regdate' => time(),
|
'user_regdate' => time(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!function_exists(user_add))
|
if (!function_exists('user_add'))
|
||||||
{
|
{
|
||||||
require_once dirname(__FILE__) . '/../../../../includes/functions_user.php';
|
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
|
* This is repeted while the two are not the same
|
||||||
*
|
*
|
||||||
* @param OutputInterface $output The output stream, where messages are printed
|
* @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
|
* @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'
|
* 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
|
* @return null
|
||||||
*/
|
*/
|
||||||
protected function get_group_id()
|
protected function get_group_id()
|
||||||
|
|
|
@ -50,7 +50,7 @@ class phpbb_console_command_user_add_test extends phpbb_database_test_case
|
||||||
|
|
||||||
$db = $this->db = $this->new_dbal();
|
$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));
|
$this->user->method('lang')->will($this->returnArgument(0));
|
||||||
|
|
||||||
$driver_helper = new \phpbb\passwords\driver\helper($this->config);
|
$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->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_tester->execute(array(
|
||||||
'command' => $this->command_name,
|
'command' => $this->command_name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue