mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16790] Remove useless command parameter
PHPBB3-16790
This commit is contained in:
parent
2f41ce219c
commit
0650d6f302
12 changed files with 42 additions and 81 deletions
|
@ -44,9 +44,9 @@ class recreate extends \phpbb\console\command\command
|
|||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$parameters = array(
|
||||
'command' => 'thumbnail:delete'
|
||||
);
|
||||
$command = $this->getApplication()->find('thumbnail:delete');
|
||||
|
||||
$parameters = [];
|
||||
|
||||
if ($input->getOption('verbose'))
|
||||
{
|
||||
|
@ -56,14 +56,14 @@ class recreate extends \phpbb\console\command\command
|
|||
$this->getApplication()->setAutoExit(false);
|
||||
|
||||
$input_delete = new ArrayInput($parameters);
|
||||
$return = $this->getApplication()->run($input_delete, $output);
|
||||
$return = $command->run($input_delete, $output);
|
||||
|
||||
if ($return === symfony_command::SUCCESS)
|
||||
{
|
||||
$parameters['command'] = 'thumbnail:generate';
|
||||
$command = $this->getApplication()->find('thumbnail:generate');
|
||||
|
||||
$input_create = new ArrayInput($parameters);
|
||||
$return = $this->getApplication()->run($input_create, $output);
|
||||
$input_create = new ArrayInput([]);
|
||||
$return = $command->run($input_create, $output);
|
||||
}
|
||||
|
||||
$this->getApplication()->setAutoExit(true);
|
||||
|
|
4
tests/console/cache/purge_test.php
vendored
4
tests/console/cache/purge_test.php
vendored
|
@ -21,7 +21,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
|
|||
{
|
||||
protected $cache_dir;
|
||||
protected $cache;
|
||||
protected $command_name;
|
||||
protected $db;
|
||||
protected $config;
|
||||
protected $user;
|
||||
|
@ -60,7 +59,7 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
|
|||
);
|
||||
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
$this->assertSame(false, $this->cache->get('test_key'));
|
||||
$this->assertSame(2, $this->config['assets_version']);
|
||||
|
@ -90,7 +89,6 @@ class phpbb_console_command_cache_purge_test extends phpbb_test_case
|
|||
$application->add(new purge($this->user, $this->cache, $this->db, $this->createMock('\phpbb\auth\auth'), new \phpbb\log\dummy(), $this->config));
|
||||
|
||||
$command = $application->find('cache:purge');
|
||||
$this->command_name = $command->getName();
|
||||
return new CommandTester($command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
|
||||
$this->config = new \phpbb\config\config(array());
|
||||
|
||||
$this->user = $this->createMock('\phpbb\user');
|
||||
|
@ -34,9 +32,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
{
|
||||
$this->assertEmpty($this->config);
|
||||
|
||||
$command_tester = $this->get_command_tester('set');
|
||||
$command_tester = $this->get_command_tester('set', 'set');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'value' => 'test_value',
|
||||
'--dynamic' => true,
|
||||
|
@ -49,9 +46,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
{
|
||||
$this->assertEmpty($this->config);
|
||||
|
||||
$command_tester = $this->get_command_tester('set');
|
||||
$command_tester = $this->get_command_tester('set', 'set');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'value' => 'test_value',
|
||||
'--dynamic' => false,
|
||||
|
@ -67,9 +63,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'old_value', true);
|
||||
$this->assertSame($this->config['test_key'], 'old_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('set_atomic');
|
||||
$command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'old' => 'old_value',
|
||||
'new' => 'new_value',
|
||||
|
@ -86,9 +81,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'old_value', false);
|
||||
$this->assertSame($this->config['test_key'], 'old_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('set_atomic');
|
||||
$command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'old' => 'old_value',
|
||||
'new' => 'new_value',
|
||||
|
@ -105,9 +99,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'wrong_value', true);
|
||||
$this->assertSame($this->config['test_key'], 'wrong_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('set_atomic');
|
||||
$command_tester = $this->get_command_tester('set_atomic', 'set-atomic');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'old' => 'old_value',
|
||||
'new' => 'new_value',
|
||||
|
@ -122,9 +115,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'test_value', false);
|
||||
$this->assertSame($this->config['test_key'], 'test_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('get');
|
||||
$command_tester = $this->get_command_tester('get', 'get');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'--no-newline' => true,
|
||||
));
|
||||
|
@ -137,9 +129,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'test_value', false);
|
||||
$this->assertSame($this->config['test_key'], 'test_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('get');
|
||||
$command_tester = $this->get_command_tester('get', 'get');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'--no-newline' => false,
|
||||
));
|
||||
|
@ -152,9 +143,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'test_value', false);
|
||||
$this->assertSame($this->config['test_key'], 'test_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('get');
|
||||
$command_tester = $this->get_command_tester('get', 'get');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'wrong_key',
|
||||
'--no-newline' => false,
|
||||
));
|
||||
|
@ -167,9 +157,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 0, false);
|
||||
$this->assertSame($this->config['test_key'], 0);
|
||||
|
||||
$command_tester = $this->get_command_tester('increment');
|
||||
$command_tester = $this->get_command_tester('increment', 'increment');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => true,
|
||||
|
@ -184,9 +173,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 0, false);
|
||||
$this->assertSame($this->config['test_key'], 0);
|
||||
|
||||
$command_tester = $this->get_command_tester('increment');
|
||||
$command_tester = $this->get_command_tester('increment', 'increment');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => false,
|
||||
|
@ -200,9 +188,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
{
|
||||
$this->assertEmpty($this->config);
|
||||
|
||||
$command_tester = $this->get_command_tester('increment');
|
||||
$command_tester = $this->get_command_tester('increment', 'increment');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
'increment' => 2,
|
||||
'--dynamic' => true,
|
||||
|
@ -217,9 +204,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->config->set('test_key', 'test_value', false);
|
||||
$this->assertSame($this->config['test_key'], 'test_value');
|
||||
|
||||
$command_tester = $this->get_command_tester('delete');
|
||||
$command_tester = $this->get_command_tester('delete', 'delete');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'test_key',
|
||||
));
|
||||
|
||||
|
@ -231,9 +217,8 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
{
|
||||
$this->assertEmpty($this->config);
|
||||
|
||||
$command_tester = $this->get_command_tester('delete');
|
||||
$command_tester = $this->get_command_tester('delete', 'delete');
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'key' => 'wrong_key',
|
||||
));
|
||||
|
||||
|
@ -241,13 +226,12 @@ class phpbb_console_command_config_test extends phpbb_test_case
|
|||
$this->assertEmpty($this->config);
|
||||
}
|
||||
|
||||
public function get_command_tester($class_name)
|
||||
public function get_command_tester($class_name, $command_name)
|
||||
{
|
||||
$command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name;
|
||||
$application = new Application();
|
||||
$application->add(new $command_complete_name($this->user, $this->config));
|
||||
$command = $application->find('config:' . $this->command_name);
|
||||
$this->command_name = $command->getName();
|
||||
$command = $application->find('config:' . $command_name);
|
||||
return new CommandTester($command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
|||
/** @var \phpbb\user */
|
||||
protected $user;
|
||||
|
||||
protected $command_name;
|
||||
|
||||
protected $command_tester;
|
||||
|
||||
protected function setUp(): void
|
||||
|
@ -111,7 +109,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
|||
$application->add(new cron_list($this->user, $this->cron_manager));
|
||||
|
||||
$command = $application->find('cron:list');
|
||||
$this->command_name = $command->getName();
|
||||
return new CommandTester($command);
|
||||
}
|
||||
|
||||
|
@ -131,6 +128,6 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
|||
|
||||
$this->get_cron_manager($tasks);
|
||||
$this->command_tester = $this->get_command_tester();
|
||||
$this->command_tester->execute(array('command' => $this->command_name), array('decorated' => false));
|
||||
$this->command_tester->execute([], array('decorated' => false));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
protected $lock;
|
||||
protected $user;
|
||||
protected $cron_manager;
|
||||
protected $command_name;
|
||||
protected $task;
|
||||
|
||||
public function getDataSet()
|
||||
|
@ -86,7 +85,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
public function test_normal_use()
|
||||
{
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
$this->assertSame('', $command_tester->getDisplay());
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
|
@ -97,7 +96,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
public function test_verbose_mode()
|
||||
{
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
|
||||
$exit_status = $command_tester->execute(array('--verbose' => true));
|
||||
|
||||
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
|
@ -112,7 +111,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
|
||||
$this->lock->acquire();
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
$this->assertStringContainsString('CRON_LOCK_ERROR', $command_tester->getDisplay());
|
||||
$this->assertSame(false, $this->task->executed);
|
||||
|
@ -159,7 +158,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
$this->cron_manager->load_tasks($tasks);
|
||||
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
$this->assertSame('', $command_tester->getDisplay());
|
||||
$this->assertSame(0, $exit_status);
|
||||
|
@ -206,7 +205,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
$this->cron_manager->load_tasks($tasks);
|
||||
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
|
||||
$exit_status = $command_tester->execute(array('--verbose' => true));
|
||||
|
||||
$this->assertStringContainsString('CRON_NO_TASK', $command_tester->getDisplay());
|
||||
$this->assertSame(0, $exit_status);
|
||||
|
@ -216,7 +215,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
public function test_arg_valid()
|
||||
{
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple'));
|
||||
$exit_status = $command_tester->execute(array('name' => 'phpbb_cron_task_simple'));
|
||||
|
||||
$this->assertSame('', $command_tester->getDisplay());
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
|
@ -230,7 +229,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
$this->expectExceptionMessage('CRON_NO_SUCH_TASK');
|
||||
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo'));
|
||||
$exit_status = $command_tester->execute(array('name' => 'foo'));
|
||||
|
||||
$this->assertStringContainsString('CRON_NO_SUCH_TASK', $command_tester->getDisplay());
|
||||
$this->assertSame(false, $this->task->executed);
|
||||
|
@ -241,7 +240,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
public function test_arg_valid_verbose()
|
||||
{
|
||||
$command_tester = $this->get_command_tester();
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true));
|
||||
$exit_status = $command_tester->execute(array('name' => 'phpbb_cron_task_simple', '--verbose' => true));
|
||||
|
||||
$this->assertStringContainsString('RUNNING_TASK', $command_tester->getDisplay());
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
|
@ -255,7 +254,6 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||
$application->add(new run($this->user, $this->cron_manager, $this->lock));
|
||||
|
||||
$command = $application->find('cron:run');
|
||||
$this->command_name = $command->getName();
|
||||
return new CommandTester($command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
|
|||
public function test_thumbnails()
|
||||
{
|
||||
$command_tester = $this->get_command_tester('thumbnail:generate');
|
||||
$exit_status = $command_tester->execute(array('command' => 'thumbnail:generate'));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
|
||||
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));
|
||||
|
@ -96,7 +96,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
|
|||
self::assertSame(0, $exit_status);
|
||||
|
||||
$command_tester = $this->get_command_tester('thumbnail:delete');
|
||||
$exit_status = $command_tester->execute(array('command' => 'thumbnail:delete'));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
|
||||
self::assertSame(false, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));
|
||||
|
@ -104,7 +104,7 @@ class phpbb_console_command_thumbnail_test extends phpbb_database_test_case
|
|||
self::assertSame(0, $exit_status);
|
||||
|
||||
$command_tester = $this->get_command_tester('thumbnail:recreate');
|
||||
$exit_status = $command_tester->execute(array('command' => 'thumbnail:recreate'));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
|
||||
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_1'));
|
||||
self::assertSame(true, file_exists($this->phpbb_root_path . 'files/thumb_test_png_2'));
|
||||
|
|
|
@ -24,8 +24,6 @@ require_once __DIR__ . '/../../../phpBB/includes/utf/utf_tools.php';
|
|||
*/
|
||||
class phpbb_console_command_check_test extends phpbb_test_case
|
||||
{
|
||||
protected $command_name;
|
||||
|
||||
protected $version_helper;
|
||||
|
||||
/** @var \phpbb\language\language */
|
||||
|
@ -34,7 +32,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
public function test_up_to_date()
|
||||
{
|
||||
$command_tester = $this->get_command_tester('100000');
|
||||
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
|
||||
$status = $command_tester->execute(array('--no-ansi' => true));
|
||||
$this->assertSame('', $command_tester->getDisplay());
|
||||
$this->assertSame($status, 0);
|
||||
}
|
||||
|
@ -42,7 +40,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
public function test_up_to_date_verbose()
|
||||
{
|
||||
$command_tester = $this->get_command_tester('100000');
|
||||
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true));
|
||||
$status = $command_tester->execute(array('--no-ansi' => true, '--verbose' => true));
|
||||
$this->assertStringContainsString($this->language->lang('UPDATE_NOT_NEEDED'), $command_tester->getDisplay());
|
||||
$this->assertSame($status, 0);
|
||||
}
|
||||
|
@ -51,7 +49,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
public function test_not_up_to_date()
|
||||
{
|
||||
$command_tester = $this->get_command_tester('0');
|
||||
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
|
||||
$status = $command_tester->execute(array('--no-ansi' => true));
|
||||
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
|
||||
$this->assertSame($status, 1);
|
||||
}
|
||||
|
@ -59,7 +57,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
public function test_not_up_to_date_verbose()
|
||||
{
|
||||
$command_tester = $this->get_command_tester('0');
|
||||
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true, '--verbose' => true));
|
||||
$status = $command_tester->execute(array('--no-ansi' => true, '--verbose' => true));
|
||||
$this->assertStringContainsString($this->language->lang('UPDATE_NEEDED'), $command_tester->getDisplay());
|
||||
$this->assertStringContainsString($this->language->lang('UPDATES_AVAILABLE'), $command_tester->getDisplay());
|
||||
$this->assertSame($status, 1);
|
||||
|
@ -72,7 +70,7 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
$command_tester = $this->get_command_tester('1');
|
||||
$this->version_helper->set_file_location('acme.corp','foo', 'bar.json');
|
||||
|
||||
$status = $command_tester->execute(array('command' => $this->command_name, '--no-ansi' => true));
|
||||
$status = $command_tester->execute(array('--no-ansi' => true));
|
||||
$this->assertStringContainsString('VERSIONCHECK_FAIL', $command_tester->getDisplay());
|
||||
$this->assertSame($status, 2);
|
||||
}
|
||||
|
@ -100,7 +98,6 @@ class phpbb_console_command_check_test extends phpbb_test_case
|
|||
$application->add(new check($user, $config, $container, $this->language));
|
||||
|
||||
$command = $application->find('update:check');
|
||||
$this->command_name = $command->getName();
|
||||
return new CommandTester($command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
|
|||
));
|
||||
|
||||
$command = $application->find('user:activate');
|
||||
$this->command_name = $command->getName();
|
||||
|
||||
return new CommandTester($command);
|
||||
}
|
||||
|
@ -75,7 +74,6 @@ class phpbb_console_user_activate_test extends phpbb_console_user_base
|
|||
$command_tester = $this->get_command_tester();
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'username' => $username,
|
||||
'--deactivate' => $deactivate,
|
||||
));
|
||||
|
|
|
@ -36,7 +36,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
|
|||
));
|
||||
|
||||
$command = $application->find('user:add');
|
||||
$this->command_name = $command->getName();
|
||||
|
||||
if (!empty($question_answers))
|
||||
{
|
||||
|
@ -86,7 +85,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
|
|||
$this->assertEquals(2, $this->get_user_id('Admin'));
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'--username' => 'foo',
|
||||
'--password' => 'bar',
|
||||
'--email' => 'foo@test.com'
|
||||
|
@ -108,9 +106,7 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
|
|||
|
||||
$command_tester->setInputs(['bar', 'password', 'password', 'bar@test.com']);
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
));
|
||||
$command_tester->execute([]);
|
||||
|
||||
$this->assertNotEquals(null, $this->get_user_id('bar'));
|
||||
$this->assertStringContainsString('CLI_USER_ADD_SUCCESS', $command_tester->getDisplay());
|
||||
|
@ -124,7 +120,6 @@ class phpbb_console_user_add_test extends phpbb_console_user_base
|
|||
$this->assertEquals(3, $this->get_user_id('Test'));
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'--username' => 'Test',
|
||||
'--password' => '1',
|
||||
'--email' => 'foo'
|
||||
|
|
|
@ -19,7 +19,6 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
|
|||
protected $language;
|
||||
protected $log;
|
||||
protected $passwords_manager;
|
||||
protected $command_name;
|
||||
/** @var Symfony\Component\Console\Helper\QuestionHelper */
|
||||
protected $question;
|
||||
protected $user_loader;
|
||||
|
|
|
@ -32,7 +32,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
|
|||
));
|
||||
|
||||
$command = $application->find('user:delete');
|
||||
$this->command_name = $command->getName();
|
||||
$this->question = $command->getHelper('question');
|
||||
|
||||
return new CommandTester($command);
|
||||
|
@ -47,7 +46,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
|
|||
$command_tester->setInputs(['yes', '']);
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'username' => 'Test',
|
||||
'--delete-posts' => false,
|
||||
));
|
||||
|
@ -65,7 +63,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
|
|||
$command_tester->setInputs(['yes', '']);
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'username' => 'Foo',
|
||||
'--delete-posts' => false,
|
||||
));
|
||||
|
@ -82,7 +79,6 @@ class phpbb_console_user_delete_test extends phpbb_console_user_base
|
|||
$command_tester->setInputs(['no', '']);
|
||||
|
||||
$command_tester->execute(array(
|
||||
'command' => $this->command_name,
|
||||
'username' => 'Test',
|
||||
'--delete-posts' => false,
|
||||
));
|
||||
|
|
|
@ -29,7 +29,6 @@ class phpbb_console_user_reclean_test extends phpbb_console_user_base
|
|||
));
|
||||
|
||||
$command = $application->find('user:reclean');
|
||||
$this->command_name = $command->getName();
|
||||
|
||||
return new CommandTester($command);
|
||||
}
|
||||
|
@ -38,7 +37,7 @@ class phpbb_console_user_reclean_test extends phpbb_console_user_base
|
|||
{
|
||||
$command_tester = $this->get_command_tester();
|
||||
|
||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||
$exit_status = $command_tester->execute([]);
|
||||
$this->assertSame(0, $exit_status);
|
||||
|
||||
$result = $this->db->sql_query('SELECT user_id FROM ' . USERS_TABLE . " WHERE username_clean = 'test unclean'");
|
||||
|
|
Loading…
Add table
Reference in a new issue