aboutsummaryrefslogtreecommitdiffstats
path: root/tests/console/cron
diff options
context:
space:
mode:
Diffstat (limited to 'tests/console/cron')
-rw-r--r--tests/console/cron/cron_list_test.php29
-rw-r--r--tests/console/cron/run_test.php87
2 files changed, 112 insertions, 4 deletions
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index fdc9a05cb2..99291ec215 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -74,7 +74,34 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
$task->set_name('command' . $i);
$i++;
}
- $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $pathEx);
+
+ $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,
+ $pathEx
+ );
+
+ $this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $pathEx);
}
public function get_command_tester()
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));