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

[ticket/14542] Move cron to controller

PHPBB3-14542
This commit is contained in:
Máté Bartus
2016-03-18 22:57:02 +01:00
committed by Marc Alexander
parent 41956a8b90
commit 7a173877b7
13 changed files with 374 additions and 83 deletions

View File

@@ -50,7 +50,34 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
$tasks = array(
$this->task,
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phbEx);
$mock_config = new \phpbb\config\config(array(
'force_server_vars' => false,
'enable_mod_rewrite' => '',
));
$mock_router = $this->getMockBuilder('\phpbb\routing\router')
->setMethods(array('setContext', 'generate'))
->disableOriginalConstructor()
->getMock();
$mock_router->method('setContext')
->willReturn(true);
$mock_router->method('generate')
->willReturn('foobar');
$request = new \phpbb\request\request();
$routing_helper = new \phpbb\routing\helper(
$mock_config,
$mock_router,
new \phpbb\symfony_request($request),
$request,
new \phpbb\filesystem\filesystem(),
$phpbb_root_path,
$phpEx
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
$this->assertSame('0', $config['cron_lock']);
}
@@ -96,7 +123,34 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
{
$tasks = array(
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx);
$mock_config = new \phpbb\config\config(array(
'force_server_vars' => false,
'enable_mod_rewrite' => '',
));
$mock_router = $this->getMockBuilder('\phpbb\routing\router')
->setMethods(array('setContext', 'generate'))
->disableOriginalConstructor()
->getMock();
$mock_router->method('setContext')
->willReturn(true);
$mock_router->method('generate')
->willReturn('foobar');
$request = new \phpbb\request\request();
$routing_helper = new \phpbb\routing\helper(
$mock_config,
$mock_router,
new \phpbb\symfony_request($request),
$request,
new \phpbb\filesystem\filesystem(),
$phpbb_root_path,
$phpEx
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name));
@@ -109,7 +163,34 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
{
$tasks = array(
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx);
$mock_config = new \phpbb\config\config(array(
'force_server_vars' => false,
'enable_mod_rewrite' => '',
));
$mock_router = $this->getMockBuilder('\phpbb\routing\router')
->setMethods(array('setContext', 'generate'))
->disableOriginalConstructor()
->getMock();
$mock_router->method('setContext')
->willReturn(true);
$mock_router->method('generate')
->willReturn('foobar');
$request = new \phpbb\request\request();
$routing_helper = new \phpbb\routing\helper(
$mock_config,
$mock_router,
new \phpbb\symfony_request($request),
$request,
new \phpbb\filesystem\filesystem(),
$phpbb_root_path,
$phpEx
);
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
$command_tester = $this->get_command_tester();
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));