aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/cron/run_test.php
diff options
context:
space:
mode:
authorMáté Bartus <mate.bartus@gmail.com>2016-03-18 22:57:02 +0100
committerMarc Alexander <admin@m-a-styles.de>2019-05-06 21:45:15 +0200
commit7a173877b7244f4ab6a8ff7b6fa0d6450027751b (patch)
tree5f820d58f33a9e972815007dfc79494669d7e702 /tests/console/cron/run_test.php
parent41956a8b9050fa6e1e301bfae51d947e6f13c068 (diff)
downloadforums-7a173877b7244f4ab6a8ff7b6fa0d6450027751b.tar
forums-7a173877b7244f4ab6a8ff7b6fa0d6450027751b.tar.gz
forums-7a173877b7244f4ab6a8ff7b6fa0d6450027751b.tar.bz2
forums-7a173877b7244f4ab6a8ff7b6fa0d6450027751b.tar.xz
forums-7a173877b7244f4ab6a8ff7b6fa0d6450027751b.zip
[ticket/14542] Move cron to controller
PHPBB3-14542
Diffstat (limited to 'tests/console/cron/run_test.php')
-rw-r--r--tests/console/cron/run_test.php87
1 files changed, 84 insertions, 3 deletions
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index b4a0203325..8f5be00a80 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -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));