aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/user
diff options
context:
space:
mode:
Diffstat (limited to 'tests/console/user')
-rw-r--r--tests/console/user/activate_test.php2
-rw-r--r--tests/console/user/add_test.php5
-rw-r--r--tests/console/user/base.php11
-rw-r--r--tests/console/user/delete_test.php6
4 files changed, 14 insertions, 10 deletions
diff --git a/tests/console/user/activate_test.php b/tests/console/user/activate_test.php
index 1588a76e47..51e9754b59 100644
--- a/tests/console/user/activate_test.php
+++ b/tests/console/user/activate_test.php
@@ -21,7 +21,7 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
{
protected $notifications;
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
diff --git a/tests/console/user/add_test.php b/tests/console/user/add_test.php
index bdfb8a8d2a..cc86cb27d3 100644
--- a/tests/console/user/add_test.php
+++ b/tests/console/user/add_test.php
@@ -61,7 +61,10 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
$output->writeln(print_r($response, true));
return $response;
};
- $helper = $this->getMock('\Symfony\Component\Console\Helper\QuestionHelper', array('ask'));
+ $helper = $this->getMockBuilder('\Symfony\Component\Console\Helper\QuestionHelper')
+ ->setMethods(['ask'])
+ ->disableOriginalConstructor()
+ ->getMock();
$helper->expects($this->any())
->method('ask')
->will($this->returnCallback($ask));
diff --git a/tests/console/user/base.php b/tests/console/user/base.php
index ad328ac893..74f04cf686 100644
--- a/tests/console/user/base.php
+++ b/tests/console/user/base.php
@@ -20,6 +20,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
protected $log;
protected $passwords_manager;
protected $command_name;
+ /** @var Symfony\Component\Console\Helper\QuestionHelper */
protected $question;
protected $user_loader;
protected $phpbb_root_path;
@@ -30,7 +31,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
}
- public function setUp()
+ public function setUp(): void
{
global $auth, $db, $cache, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
@@ -39,7 +40,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$phpbb_container->set('cache.driver', new phpbb_mock_cache());
$phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
- $auth = $this->getMock('\phpbb\auth\auth');
+ $auth = $this->createMock('\phpbb\auth\auth');
$cache = $phpbb_container->get('cache.driver');
@@ -50,7 +51,6 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
'min_name_chars' => 3,
'max_name_chars' => 10,
'min_pass_chars' => 3,
- 'max_pass_chars' => 10,
'pass_complex' => 'PASS_TYPE_ANY',
));
@@ -62,7 +62,7 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$this->language->expects($this->any())
->method('lang')
->will($this->returnArgument(0));
- $user = $this->user = $this->getMock('\phpbb\user', array(), array(
+ $user = $this->user = $this->createMock('\phpbb\user', array(), array(
$this->language,
'\phpbb\datetime'
));
@@ -112,7 +112,8 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
- return $row['user_id'];
+ $user_id = $row ? $row['user_id'] : null;
+ return $user_id;
}
public function getInputStream($input)
diff --git a/tests/console/user/delete_test.php b/tests/console/user/delete_test.php
index 88f91afab1..926e496e1e 100644
--- a/tests/console/user/delete_test.php
+++ b/tests/console/user/delete_test.php
@@ -45,7 +45,7 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$this->assertEquals(3, $this->get_user_id('Test'));
- $this->question->setInputStream($this->getInputStream("yes\n"));
+ $command_tester->setInputs(['yes', '']);
$command_tester->execute(array(
'command' => $this->command_name,
@@ -63,7 +63,7 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$this->assertNull($this->get_user_id('Foo'));
- $this->question->setInputStream($this->getInputStream("yes\n"));
+ $command_tester->setInputs(['yes', '']);
$command_tester->execute(array(
'command' => $this->command_name,
@@ -80,7 +80,7 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
$this->assertEquals(3, $this->get_user_id('Test'));
- $this->question->setInputStream($this->getInputStream("no\n"));
+ $command_tester->setInputs(['no', '']);
$command_tester->execute(array(
'command' => $this->command_name,