mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-02 22:02:07 +02:00
[ticket/12597] Modification of return statuses and of test files
PHPBB3-12597
This commit is contained in:
parent
5fca308138
commit
0d839cbefc
@ -60,7 +60,7 @@ class run_all extends \phpbb\console\command\command
|
||||
* @param InputInterface input The input stream, unused here
|
||||
* @param OutputInterface output The output stream, used for printig verbose-mode
|
||||
* and error information.
|
||||
* @return null
|
||||
* @return boolean 0 if all is ok, 1 if a lock error occured
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
|
||||
protected $user;
|
||||
protected $cron_manager;
|
||||
protected $command_name;
|
||||
protected $task;
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
@ -40,8 +41,9 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
|
||||
$this->user = $this->getMock('\phpbb\user');
|
||||
$this->user->method('lang')->will($this->returnArgument(0));
|
||||
|
||||
$this->task = new phpbb_cron_task_simple();
|
||||
$tasks = array(
|
||||
new phpbb_cron_task_simple(),
|
||||
$this->task,
|
||||
);
|
||||
$this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx);
|
||||
|
||||
@ -58,7 +60,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
|
||||
$command_tester->execute(array('command' => $this->command_name));
|
||||
|
||||
$this->assertSame('', $command_tester->getDisplay());
|
||||
$this->assertSame(1, $cron_num_exec);
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
}
|
||||
|
||||
public function test_verbose_mode()
|
||||
@ -69,7 +71,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
|
||||
$command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
|
||||
|
||||
$this->assertContains('RUNNING_TASK', $command_tester->getDisplay());
|
||||
$this->assertSame(1, $cron_num_exec);
|
||||
$this->assertSame(true, $this->task->executed);
|
||||
}
|
||||
|
||||
public function test_error_lock()
|
||||
@ -81,7 +83,7 @@ class phpbb_console_command_cron_run_all_test extends phpbb_database_test_case
|
||||
$command_tester->execute(array('command' => $this->command_name));
|
||||
|
||||
$this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay());
|
||||
$this->assertSame(0, $cron_num_exec);
|
||||
$this->assertSame(false, $this->task->executed);
|
||||
}
|
||||
|
||||
public function get_command_tester()
|
||||
|
@ -2,6 +2,14 @@
|
||||
|
||||
class phpbb_cron_task_simple extends \phpbb\cron\task\base
|
||||
{
|
||||
public $executed;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$executed = false;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return get_class($this);
|
||||
@ -9,7 +17,6 @@ class phpbb_cron_task_simple extends \phpbb\cron\task\base
|
||||
|
||||
public function run()
|
||||
{
|
||||
global $cron_num_exec;
|
||||
$cron_num_exec++;
|
||||
$this->executed = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user