1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16790] Remove useless command parameter

PHPBB3-16790
This commit is contained in:
Ruben Calvo
2021-12-01 12:14:06 +01:00
parent 2f41ce219c
commit 0650d6f302
12 changed files with 42 additions and 81 deletions

View File

@@ -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);
}
}