[ticket/12597] Fix constructor bug and servral doc blocs

PHPBB3-12597
This commit is contained in:
LEZY Thomas 2014-05-28 18:19:46 +02:00
parent 0d839cbefc
commit 18875894ec
3 changed files with 9 additions and 16 deletions

View file

@ -53,12 +53,15 @@ class run_all extends \phpbb\console\command\command
} }
/** /**
* Executes the function. Each cron tasks is executed. * Executes the function.
* If option "--verbose" is not seted, there will be no output in case of * Tries to acquire the cron lock, then runs all ready cron tasks.
* successful execution. * If the cron lock can not be obtained, an error message is printed
* and the exit status is set to 1.
*If the verbose option is specified, each start of a task is printed.
Otherwise there is no output.
* *
* @param InputInterface input The input stream, unused here * @param InputInterface $input The input stream, unused here
* @param OutputInterface output The output stream, used for printig verbose-mode * @param OutputInterface $output The output stream, used for printig verbose-mode
* and error information. * and error information.
* @return boolean 0 if all is ok, 1 if a lock error occured * @return boolean 0 if all is ok, 1 if a lock error occured
*/ */

View file

@ -31,7 +31,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
public function setUp() public function setUp()
{ {
global $db, $config, $phpbb_root_path, $pathEx; global $db, $config, $phpbb_root_path, $pathEx;
global $cron_num_exec;
$db = $this->db = $this->new_dbal(); $db = $this->db = $this->new_dbal();
$config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0'));
@ -47,15 +46,11 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
); );
$this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx); $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx);
$cron_num_exec = 0;
$this->assertSame('0', $config['cron_lock']); $this->assertSame('0', $config['cron_lock']);
} }
public function test_normal_use() public function test_normal_use()
{ {
global $cron_num_exec;
$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));
@ -65,8 +60,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
public function test_verbose_mode() public function test_verbose_mode()
{ {
global $cron_num_exec;
$command_tester = $this->get_command_tester(); $command_tester = $this->get_command_tester();
$command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
@ -76,8 +69,6 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
public function test_error_lock() public function test_error_lock()
{ {
global $cron_num_exec;
$this->lock->acquire(); $this->lock->acquire();
$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));

View file

@ -6,8 +6,7 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base
public function __construct() public function __construct()
{ {
$executed = false; $this->executed = false;
parent::__construct();
} }
public function get_name() public function get_name()