From 7a173877b7244f4ab6a8ff7b6fa0d6450027751b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Fri, 18 Mar 2016 22:57:02 +0100 Subject: [ticket/14542] Move cron to controller PHPBB3-14542 --- tests/console/cron/run_test.php | 87 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) (limited to 'tests/console/cron/run_test.php') 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)); -- cgit v1.2.1 From 271ac6b57e6725fb1aba869c832beb482f85d61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Fri, 5 Aug 2016 23:03:35 +0200 Subject: [ticket/14542] Fix tests PHPBB3-14542 --- tests/console/cron/run_test.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/console/cron/run_test.php') diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 8f5be00a80..c4dffa3686 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -66,6 +66,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case ->willReturn('foobar'); $request = new \phpbb\request\request(); + $request->enable_super_globals(); $routing_helper = new \phpbb\routing\helper( $mock_config, @@ -139,6 +140,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case ->willReturn('foobar'); $request = new \phpbb\request\request(); + $request->enable_super_globals(); $routing_helper = new \phpbb\routing\helper( $mock_config, @@ -179,6 +181,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case ->willReturn('foobar'); $request = new \phpbb\request\request(); + $request->enable_super_globals(); $routing_helper = new \phpbb\routing\helper( $mock_config, -- cgit v1.2.1 From 42b7782927713c2ca2fb704db6217016347b586e Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 19 Mar 2017 21:46:20 +0700 Subject: [ticket/14972] Migrate from deprecated getMock() method to createMock() PHPBB3-14972 --- tests/console/cron/run_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/console/cron/run_test.php') diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index c4dffa3686..76c7bb27c4 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -40,7 +40,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); - $this->user = $this->getMock('\phpbb\user', array(), array( + $this->user = $this->createMock('\phpbb\user', array(), array( new \phpbb\language\language(new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx)), '\phpbb\datetime' )); -- cgit v1.2.1 From ebac54aa9e705e99a562d2fe2c0f57bc6af8dd32 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 30 Dec 2018 11:36:08 +0100 Subject: [ticket/14948] Adjust calls for twig and phpunit updates PHPBB3-14948 --- tests/console/cron/run_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/console/cron/run_test.php') diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 76c7bb27c4..2744bf132c 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -32,7 +32,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); } - public function setUp() + public function setUp(): void { global $db, $config, $phpbb_root_path, $phpEx; -- cgit v1.2.1 From dcab0762210a4059cca7458344dcc1aeb0360c42 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 29 Dec 2019 02:12:36 +0700 Subject: [ticket/16276] Further fix PHP nightly tests PHPBB3-16276 --- tests/console/cron/run_test.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/console/cron/run_test.php') diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php index 2744bf132c..8402f9dd3e 100644 --- a/tests/console/cron/run_test.php +++ b/tests/console/cron/run_test.php @@ -122,6 +122,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case public function test_no_task() { + global $phpbb_root_path, $phpEx; + $tasks = array( ); @@ -163,6 +165,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case public function test_no_task_verbose() { + global $phpbb_root_path, $phpEx; + $tasks = array( ); -- cgit v1.2.1