mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 22:45:02 +02:00
[ticket/16565] Fixed cron.manager tests
PHPBB3-16565
This commit is contained in:
parent
fe97d19c66
commit
0daf6ccbcb
@ -102,7 +102,11 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
|
|||||||
$pathEx
|
$pathEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $pathEx);
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$this->cron_manager = new \phpbb\cron\manager($mock_container, $routing_helper, $phpbb_root_path, $pathEx);
|
||||||
|
$this->cron_manager->load_tasks($tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_command_tester()
|
public function get_command_tester()
|
||||||
|
@ -78,7 +78,11 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$this->cron_manager = new \phpbb\cron\manager($mock_container, $routing_helper, $phpbb_root_path, $phpEx);
|
||||||
|
$this->cron_manager->load_tasks($tasks);
|
||||||
|
|
||||||
$this->assertSame('0', $config['cron_lock']);
|
$this->assertSame('0', $config['cron_lock']);
|
||||||
}
|
}
|
||||||
@ -154,7 +158,12 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$this->cron_manager = new \phpbb\cron\manager($mock_container, $routing_helper, $phpbb_root_path, $phpEx);
|
||||||
|
$this->cron_manager->load_tasks($tasks);
|
||||||
|
|
||||||
$command_tester = $this->get_command_tester();
|
$command_tester = $this->get_command_tester();
|
||||||
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
$exit_status = $command_tester->execute(array('command' => $this->command_name));
|
||||||
|
|
||||||
@ -197,7 +206,12 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
|
|||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->cron_manager = new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$this->cron_manager = new \phpbb\cron\manager($mock_container, $routing_helper, $phpbb_root_path, $phpEx);
|
||||||
|
$this->cron_manager->load_tasks($tasks);
|
||||||
|
|
||||||
$command_tester = $this->get_command_tester();
|
$command_tester = $this->get_command_tester();
|
||||||
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
|
$exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true));
|
||||||
|
|
||||||
|
@ -203,13 +203,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -263,13 +266,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -323,13 +329,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -383,13 +392,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -443,13 +455,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -503,13 +518,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -560,13 +578,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -620,13 +641,16 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
*/
|
*/
|
||||||
public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
|
||||||
{
|
{
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->config = new \phpbb\config\config(['enable_mod_rewrite' => '1']);
|
$this->config = new \phpbb\config\config(['enable_mod_rewrite' => '1']);
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
@ -669,12 +693,15 @@ abstract class phpbb_controller_common_helper_route extends phpbb_database_test_
|
|||||||
'server_protocol' => $server_protocol,
|
'server_protocol' => $server_protocol,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
$this->routing_helper = new \phpbb\routing\helper($this->config, $this->router, $this->symfony_request, $this->request, $this->filesystem, $this->root_path, 'php');
|
||||||
$this->helper = new phpbb_mock_controller_helper(
|
$this->helper = new phpbb_mock_controller_helper(
|
||||||
$this->auth,
|
$this->auth,
|
||||||
$this->cache,
|
$this->cache,
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, $this->root_path, 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, $this->root_path, 'php'),
|
||||||
$this->db,
|
$this->db,
|
||||||
$this->dispatcher,
|
$this->dispatcher,
|
||||||
$this->language,
|
$this->language,
|
||||||
|
@ -102,6 +102,12 @@ class phpbb_cron_manager_test extends \phpbb_test_case
|
|||||||
$phpEx
|
$phpEx
|
||||||
);
|
);
|
||||||
|
|
||||||
return new \phpbb\cron\manager($tasks, $routing_helper, $phpbb_root_path, $phpEx);
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$cron_manager = new \phpbb\cron\manager($mock_container, $routing_helper, $phpbb_root_path, $phpEx);
|
||||||
|
$cron_manager->load_tasks($tasks);
|
||||||
|
|
||||||
|
return $cron_manager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,11 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
|||||||
new \phpbb\routing\file_locator($filesystem, dirname(__FILE__) . '/')
|
new \phpbb\routing\file_locator($filesystem, dirname(__FILE__) . '/')
|
||||||
);
|
);
|
||||||
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager);
|
$resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $manager);
|
||||||
$router = new phpbb_mock_router(new phpbb_mock_container_builder(), $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
|
|
||||||
|
$mock_container = new phpbb_mock_container_builder();
|
||||||
|
$mock_container->set('cron.task_collection', []);
|
||||||
|
|
||||||
|
$router = new phpbb_mock_router($mock_container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', false);
|
||||||
|
|
||||||
$request = new phpbb_mock_request();
|
$request = new phpbb_mock_request();
|
||||||
$request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
|
$request->overwrite('SCRIPT_NAME', '/app.php', \phpbb\request\request_interface::SERVER);
|
||||||
@ -66,7 +70,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
|||||||
new \phpbb\auth\auth(),
|
new \phpbb\auth\auth(),
|
||||||
new \phpbb\cache\driver\dummy(),
|
new \phpbb\cache\driver\dummy(),
|
||||||
$this->config,
|
$this->config,
|
||||||
new \phpbb\cron\manager([], $this->routing_helper, '', 'php'),
|
new \phpbb\cron\manager($mock_container, $this->routing_helper, '', 'php'),
|
||||||
$db,
|
$db,
|
||||||
new phpbb_mock_event_dispatcher(),
|
new phpbb_mock_event_dispatcher(),
|
||||||
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user