[ticket/12597] Update pull-request

Removes a useless comment.
Switchs command name from cron:execute-all to cron:run-all.
Replaces assertEquals by assertSame

PHPBB3-12597
This commit is contained in:
LEZY Thomas 2014-05-28 14:39:02 +02:00
parent 9761c1bf61
commit 6f279c1bf4
4 changed files with 13 additions and 14 deletions

View file

@ -46,8 +46,8 @@ services:
tags: tags:
- { name: console.command } - { name: console.command }
console.command.cron.execute_all: console.command.cron.run_all:
class: phpbb\console\command\cron\execute_all class: phpbb\console\command\cron\run_all
arguments: arguments:
- @cron.manager - @cron.manager
- @cron.lock_db - @cron.lock_db

View file

@ -50,7 +50,6 @@ if ($cron_lock->acquire())
{ {
$cron = $phpbb_container->get('cron.manager'); $cron = $phpbb_container->get('cron.manager');
// If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing
$task = $cron->find_task($cron_type); $task = $cron->find_task($cron_type);
if ($task) if ($task)
{ {

View file

@ -12,7 +12,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class execute_all extends \phpbb\console\command\command class run_all extends \phpbb\console\command\command
{ {
/** @var \phpbb\cron\manager */ /** @var \phpbb\cron\manager */
protected $cron_manager; protected $cron_manager;
@ -47,7 +47,7 @@ class execute_all extends \phpbb\console\command\command
protected function configure() protected function configure()
{ {
$this $this
->setName('cron:execute-all') ->setName('cron:run-all')
->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL')) ->setDescription($this->user->lang('CLI_DESCR_CRON_EXECUTE_ALL'))
; ;
} }

View file

@ -9,11 +9,11 @@
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tester\CommandTester;
use phpbb\console\command\cron\execute_all; use phpbb\console\command\cron\run_all;
require_once dirname(__FILE__) . '/tasks/simple.php'; require_once dirname(__FILE__) . '/tasks/simple.php';
class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_case class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
{ {
protected $db; protected $db;
protected $config; protected $config;
@ -47,7 +47,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca
$cron_num_exec = 0; $cron_num_exec = 0;
$this->assertEquals('0', $config['cron_lock']); $this->assertSame('0', $config['cron_lock']);
} }
public function test_normal_use() public function test_normal_use()
@ -57,8 +57,8 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$command_tester->execute(array('command' => $this->command_name)); $command_tester->execute(array('command' => $this->command_name));
$this->assertEquals('', $command_tester->getDisplay()); $this->assertSame('', $command_tester->getDisplay());
$this->assertEquals(1, $cron_num_exec); $this->assertSame(1, $cron_num_exec);
} }
public function test_verbose_mode() public function test_verbose_mode()
@ -69,7 +69,7 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca
$command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
$this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); $this->assertContains('RUNNING_TASK', $command_tester->getDisplay());
$this->assertEquals(1, $cron_num_exec); $this->assertSame(1, $cron_num_exec);
} }
public function test_error_lock() public function test_error_lock()
@ -81,15 +81,15 @@ class phpbb_console_command_cron_execute_all_test extends phpbb_database_test_ca
$command_tester->execute(array('command' => $this->command_name)); $command_tester->execute(array('command' => $this->command_name));
$this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay());
$this->assertEquals(0, $cron_num_exec); $this->assertSame(0, $cron_num_exec);
} }
public function get_command_tester() public function get_command_tester()
{ {
$application = new Application(); $application = new Application();
$application->add(new execute_all($this->cron_manager, $this->lock, $this->user)); $application->add(new run_all($this->cron_manager, $this->lock, $this->user));
$command = $application->find('cron:execute-all'); $command = $application->find('cron:run-all');
$this->command_name = $command->getName(); $this->command_name = $command->getName();
return new CommandTester($command); return new CommandTester($command);
} }